431
418
self.build_tree_contents([('this/hello', b'Hello World')])
432
419
this.commit('Add World')
433
420
this.merge_from_branch(other.branch)
434
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
436
self._auto_resolve(this)
437
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
439
self.build_tree_contents([('this/hello', '<<<<<<<')])
440
self._auto_resolve(this)
441
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
443
self.build_tree_contents([('this/hello', '=======')])
444
self._auto_resolve(this)
445
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
447
self.build_tree_contents([('this/hello', '\n>>>>>>>')])
448
remaining, resolved = self._auto_resolve(this)
449
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
421
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
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()
436
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
450
437
this.conflicts())
451
438
self.assertEqual([], resolved)
452
439
self.build_tree_contents([('this/hello', b'hELLO wORLD')])
453
remaining, resolved = self._auto_resolve(this)
440
remaining, resolved = this.auto_resolve()
454
441
self.assertEqual([], this.conflicts())
455
self.assertEqual([_mod_bzr_conflicts.TextConflict('hello', b'hello_id')],
442
self.assertEqual([conflicts.TextConflict('hello', b'hello_id')],
457
444
self.assertPathDoesNotExist('this/hello.BASE')
459
def test_unsupported_symlink_auto_resolve(self):
460
self.requireFeature(SymlinkFeature)
461
base = self.make_branch_and_tree('base')
462
self.build_tree_contents([('base/hello', 'Hello')])
463
base.add('hello', b'hello_id')
464
base.commit('commit 0')
465
other = base.controldir.sprout('other').open_workingtree()
466
self.build_tree_contents([('other/hello', 'Hello')])
467
os.symlink('other/hello', 'other/foo')
468
other.add('foo', b'foo_id')
469
other.commit('commit symlink')
470
this = base.controldir.sprout('this').open_workingtree()
471
self.assertPathExists('this/hello')
472
self.build_tree_contents([('this/hello', 'Hello')])
473
this.commit('commit 2')
475
trace.push_log_file(log)
476
os_symlink = getattr(os, 'symlink', None)
479
this.merge_from_branch(other.branch)
482
os.symlink = os_symlink
483
self.assertContainsRe(
485
b'Unable to create symlink "foo" on this filesystem')
487
446
def test_auto_resolve_dir(self):
488
447
tree = self.make_branch_and_tree('tree')
489
448
self.build_tree(['tree/hello/'])
490
449
tree.add('hello', b'hello-id')
491
file_conflict = _mod_bzr_conflicts.TextConflict('hello', b'hello-id')
492
tree.set_conflicts([file_conflict])
493
remaining, resolved = self._auto_resolve(tree)
496
conflicts.ConflictList([_mod_bzr_conflicts.TextConflict(u'hello', 'hello-id')]))
497
self.assertEqual(resolved, [])
499
def test_auto_resolve_missing(self):
500
tree = self.make_branch_and_tree('tree')
501
file_conflict = _mod_bzr_conflicts.TextConflict('hello', b'hello-id')
502
tree.set_conflicts([file_conflict])
503
remaining, resolved = self._auto_resolve(tree)
504
self.assertEqual(remaining, [])
507
conflicts.ConflictList([_mod_bzr_conflicts.TextConflict(u'hello', 'hello-id')]))
450
file_conflict = conflicts.TextConflict('file', b'hello-id')
451
tree.set_conflicts(conflicts.ConflictList([file_conflict]))
455
class TestFindTrees(TestCaseWithTransport):
457
def test_find_trees(self):
458
self.make_branch_and_tree('foo')
459
self.make_branch_and_tree('foo/bar')
460
# Sticking a tree inside a control dir is heinous, so let's skip it
461
self.make_branch_and_tree('foo/.bzr/baz')
462
self.make_branch('qux')
463
trees = workingtree.WorkingTree.find_trees('.')
464
self.assertEqual(2, len(list(trees)))
510
467
class TestStoredUncommitted(TestCaseWithTransport):