313
313
self.assertEqual(['t', 'u'], tree._locks)
314
314
self.assertRaises(TypeError, tree.method_that_raises, 'foo')
315
315
self.assertEqual(['t', 'u', 't', 'u'], tree._locks)
318
class TestAutoResolve(TestCaseWithTransport):
320
def test_auto_resolve(self):
321
base = self.make_branch_and_tree('base')
322
self.build_tree_contents([('base/hello', 'Hello')])
323
base.add('hello', 'hello_id')
325
other = base.bzrdir.sprout('other').open_workingtree()
326
self.build_tree_contents([('other/hello', 'hELLO')])
327
other.commit('Case switch')
328
this = base.bzrdir.sprout('this').open_workingtree()
329
self.failUnlessExists('this/hello')
330
self.build_tree_contents([('this/hello', 'Hello World')])
331
this.commit('Add World')
332
this.merge_from_branch(other.branch)
333
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
336
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
338
self.build_tree_contents([('this/hello', '<<<<<<<')])
340
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
342
self.build_tree_contents([('this/hello', '=======')])
344
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
346
self.build_tree_contents([('this/hello', '\n>>>>>>>')])
347
remaining, resolved = this.auto_resolve()
348
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
350
self.assertEqual([], resolved)
351
self.build_tree_contents([('this/hello', 'hELLO wORLD')])
352
remaining, resolved = this.auto_resolve()
353
self.assertEqual([], this.conflicts())
354
self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
356
self.failIfExists('this/hello.BASE')
358
def test_auto_resolve_dir(self):
359
tree = self.make_branch_and_tree('tree')
360
self.build_tree(['tree/hello/'])
361
tree.add('hello', 'hello-id')
362
file_conflict = conflicts.TextConflict('file', 'hello_id')
363
tree.set_conflicts(conflicts.ConflictList([file_conflict]))