20
from bzrlib.tests import TestCaseInTempDir
20
from bzrlib.tests import TestCaseWithTransport
21
21
from bzrlib.branch import Branch
22
from bzrlib.commit import Commit
23
22
from bzrlib.conflicts import restore
24
23
from bzrlib.errors import NotConflicted
26
25
# TODO: Test commit with some added, and added-but-missing files
26
# RBC 20060124 is that not tested in test_commit.py ?
28
class TestConflicts(TestCaseInTempDir):
28
class TestConflicts(TestCaseWithTransport):
30
30
def test_conflicts(self):
31
31
"""Conflicts are detected properly"""
32
b = Branch.initialize(u'.')
32
tree = self.make_branch_and_tree('.')
33
34
file('hello', 'w').write('hello world4')
34
35
file('hello.THIS', 'w').write('hello world2')
35
36
file('hello.BASE', 'w').write('hello world1')
36
37
file('hello.OTHER', 'w').write('hello world3')
37
38
file('hello.sploo.BASE', 'w').write('yellow world')
38
39
file('hello.sploo.OTHER', 'w').write('yellow world2')
39
tree = b.working_tree()
40
40
self.assertEqual(len(list(tree.list_files())), 6)
41
41
conflicts = list(tree.iter_conflicts())
42
42
self.assertEqual(len(conflicts), 2)