355
def example_branch(test):
358
file('hello', 'wt').write('foo')
359
test.runbzr('add hello')
360
test.runbzr('commit -m setup hello')
362
file('goodbye', 'wt').write('baz')
363
test.runbzr('add goodbye')
364
test.runbzr('commit -m setup goodbye')
357
367
class RevertCommand(ExternalBase):
358
368
def runTest(self):
362
file('hello', 'wt').write('foo')
363
self.runbzr('add hello')
364
self.runbzr('commit -m setup hello')
366
file('goodbye', 'wt').write('baz')
367
self.runbzr('add goodbye')
368
self.runbzr('commit -m setup goodbye')
370
370
file('hello', 'wt').write('bar')
371
371
file('goodbye', 'wt').write('qux')
372
372
self.runbzr('revert hello')
374
374
self.check_file_contents('goodbye', 'qux')
375
375
self.runbzr('revert')
376
376
self.check_file_contents('goodbye', 'baz')
377
os.mkdir('revertdir')
378
self.runbzr('add revertdir')
379
self.runbzr('commit -m f')
380
os.rmdir('revertdir')
381
self.runbzr('revert')
379
class MergeCommand(ExternalBase):
381
from bzrlib.branch import Branch
387
self.runbzr('branch a b')
389
file('goodbye', 'wt').write('quux')
390
self.runbzr(['commit', '-m', "more u's are always good"])
393
file('hello', 'wt').write('quuux')
394
# We can't merge when there are in-tree changes
395
self.runbzr('merge ../b', retcode=1)
396
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
397
self.runbzr('merge ../b')
398
self.check_file_contents('goodbye', 'quux')
399
# Merging a branch pulls its revision into the tree
402
a.get_revision_xml(b.last_patch())
403
assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
404
% (a.pending_merges(), b.last_patch())
405
self.runbzr('revert hello')
406
assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
407
% (a.pending_merges(), b.last_patch())
408
self.runbzr('revert')
409
assert a.pending_merges() == [], "Assertion %s %s" \
410
% (a.pending_merges(), b.last_patch())
411
self.runbzr('merge ../b -r2..3')
412
assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
413
% (a.pending_merges(), b.last_patch())
414
self.runbzr('revert')
415
self.runbzr('merge ../b -r3..3')
416
assert a.pending_merges() == [], "Assertion %s %s" \
417
% (a.pending_merges(), b.last_patch())