432
420
this.merge_from_branch(other.branch)
433
421
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
434
422
this.conflicts())
435
self._auto_resolve(this)
436
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
438
self.build_tree_contents([('this/hello', '<<<<<<<')])
439
self._auto_resolve(this)
440
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
442
self.build_tree_contents([('this/hello', '=======')])
443
self._auto_resolve(this)
444
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
446
self.build_tree_contents([('this/hello', '\n>>>>>>>')])
447
remaining, resolved = self._auto_resolve(this)
424
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
426
self.build_tree_contents([('this/hello', b'<<<<<<<')])
428
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
430
self.build_tree_contents([('this/hello', b'=======')])
432
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
434
self.build_tree_contents([('this/hello', b'\n>>>>>>>')])
435
remaining, resolved = this.auto_resolve()
448
436
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
449
437
this.conflicts())
450
438
self.assertEqual([], resolved)
451
439
self.build_tree_contents([('this/hello', b'hELLO wORLD')])
452
remaining, resolved = self._auto_resolve(this)
440
remaining, resolved = this.auto_resolve()
453
441
self.assertEqual([], this.conflicts())
454
442
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
456
444
self.assertPathDoesNotExist('this/hello.BASE')
458
def test_unsupported_symlink_auto_resolve(self):
459
self.requireFeature(SymlinkFeature)
460
base = self.make_branch_and_tree('base')
461
self.build_tree_contents([('base/hello', 'Hello')])
462
base.add('hello', b'hello_id')
463
base.commit('commit 0')
464
other = base.controldir.sprout('other').open_workingtree()
465
self.build_tree_contents([('other/hello', 'Hello')])
466
os.symlink('other/hello', 'other/foo')
467
other.add('foo', b'foo_id')
468
other.commit('commit symlink')
469
this = base.controldir.sprout('this').open_workingtree()
470
self.assertPathExists('this/hello')
471
self.build_tree_contents([('this/hello', 'Hello')])
472
this.commit('commit 2')
474
trace.push_log_file(log)
475
os_symlink = getattr(os, 'symlink', None)
478
this.merge_from_branch(other.branch)
481
os.symlink = os_symlink
482
self.assertContainsRe(
484
b'Unable to create symlink "foo" on this filesystem')
486
446
def test_auto_resolve_dir(self):
487
447
tree = self.make_branch_and_tree('tree')
488
448
self.build_tree(['tree/hello/'])
489
449
tree.add('hello', b'hello-id')
490
file_conflict = conflicts.TextConflict('hello', b'hello-id')
491
tree.set_conflicts(conflicts.ConflictList([file_conflict]))
492
remaining, resolved = self._auto_resolve(tree)
495
conflicts.ConflictList([conflicts.TextConflict(u'hello', 'hello-id')]))
496
self.assertEqual(resolved, [])
498
def test_auto_resolve_missing(self):
499
tree = self.make_branch_and_tree('tree')
500
file_conflict = conflicts.TextConflict('hello', b'hello-id')
501
tree.set_conflicts(conflicts.ConflictList([file_conflict]))
502
remaining, resolved = self._auto_resolve(tree)
503
self.assertEqual(remaining, [])
506
conflicts.ConflictList([conflicts.TextConflict(u'hello', 'hello-id')]))
450
file_conflict = conflicts.TextConflict('file', b'hello-id')
451
tree.set_conflicts(conflicts.ConflictList([file_conflict]))
509
455
class TestStoredUncommitted(TestCaseWithTransport):