308
308
a.get_revision_xml(b.last_revision())
309
309
self.log('pending merges: %s', a.pending_merges())
310
310
# assert a.pending_merges() == [b.last_revision()], "Assertion %s %s" \
311
# % (a.pending_merges(), b.last_revision())
311
# % (a.pending_merges(), b.last_patch())
313
def test_merge_with_missing_file(self):
314
"""Merge handles missing file conflicts"""
318
print >> file('sub/a.txt', 'wb'), "hello"
319
print >> file('b.txt', 'wb'), "hello"
320
print >> file('sub/c.txt', 'wb'), "hello"
323
self.runbzr(('commit', '-m', 'added a'))
324
self.runbzr('branch . ../b')
325
print >> file('sub/a.txt', 'ab'), "there"
326
print >> file('b.txt', 'ab'), "there"
327
print >> file('sub/c.txt', 'ab'), "there"
328
self.runbzr(('commit', '-m', 'Added there'))
329
os.unlink('sub/a.txt')
330
os.unlink('sub/c.txt')
333
self.runbzr(('commit', '-m', 'Removed a.txt'))
335
print >> file('sub/a.txt', 'ab'), "something"
336
print >> file('b.txt', 'ab'), "something"
337
print >> file('sub/c.txt', 'ab'), "something"
338
self.runbzr(('commit', '-m', 'Modified a.txt'))
339
self.runbzr('merge ../a/')
340
assert os.path.exists('sub/a.txt.THIS')
341
assert os.path.exists('sub/a.txt.BASE')
343
self.runbzr('merge ../b/')
344
assert os.path.exists('sub/a.txt.OTHER')
345
assert os.path.exists('sub/a.txt.BASE')
313
347
def test_merge_with_missing_file(self):
314
348
"""Merge handles missing file conflicts"""
393
427
self.runbzr('commit -m blah8 --unchanged')
394
428
self.runbzr('pull ../b')
395
429
self.runbzr('pull ../b')
431
def test_locations(self):
432
"""Using and remembering different locations"""
436
self.runbzr('commit -m unchanged --unchanged')
437
self.runbzr('pull', retcode=1)
438
self.runbzr('merge', retcode=1)
439
self.runbzr('branch . ../b')
442
self.runbzr('branch . ../c')
443
self.runbzr('pull ../c')
446
self.runbzr('pull ../b')
448
self.runbzr('pull ../c')
449
self.runbzr('branch ../c ../d')
450
shutil.rmtree('../c')
455
self.runbzr('pull', retcode=1)
456
self.runbzr('pull ../a --remember')
397
459
def test_add_reports(self):
398
460
"""add command prints the names of added files."""
413
475
self.assertEquals(out, '')
414
476
err.index('unknown command')
478
def test_conflicts(self):
479
"""Handling of merge conflicts"""
482
file('hello', 'wb').write("hi world")
483
file('answer', 'wb').write("42")
486
self.runbzr('commit -m base')
487
self.runbzr('branch . ../other')
488
self.runbzr('branch . ../this')
490
file('hello', 'wb').write("Hello.")
491
file('answer', 'wb').write("Is anyone there?")
492
self.runbzr('commit -m other')
494
file('hello', 'wb').write("Hello, world")
495
self.runbzr('mv answer question')
496
file('question', 'wb').write("What do you get when you multiply six"
498
self.runbzr('commit -m this')
499
self.runbzr('merge ../other')
500
result = self.runbzr('conflicts', backtick=1)
501
self.assertEquals(result, "hello\nquestion\n")
502
result = self.runbzr('status', backtick=1)
503
assert "conflicts:\n hello\n question\n" in result, result
504
self.runbzr('resolve hello')
505
result = self.runbzr('conflicts', backtick=1)
506
self.assertEquals(result, "question\n")
507
self.runbzr('commit -m conflicts', retcode=1)
508
self.runbzr('resolve --all')
509
result = self.runbzr('conflicts', backtick=1)
510
self.runbzr('commit -m conflicts')
511
self.assertEquals(result, "")
417
513
def listdir_sorted(dir):
418
514
L = os.listdir(dir)