37
38
file('myfile', 'wb').write('contentsa\n')
38
39
file('my_other_file', 'wb').write('contentsa\n')
41
self.runbzr('commit -m new')
42
self.run_bzr('commit -m new')
43
self.runbzr('branch a b')
44
self.run_bzr('branch a b')
45
46
file('myfile', 'wb').write('contentsb\n')
46
47
file('my_other_file', 'wb').write('contentsb\n')
47
self.runbzr('mv mydir mydir2')
48
self.runbzr('commit -m change')
48
self.run_bzr('mv mydir mydir2')
49
self.run_bzr('commit -m change')
50
51
file('myfile', 'wb').write('contentsa2\n')
51
52
file('my_other_file', 'wb').write('contentsa2\n')
52
self.runbzr('mv mydir mydir3')
53
self.runbzr('commit -m change')
54
self.runbzr('merge ../b', retcode=1)
53
self.run_bzr('mv mydir mydir3')
54
self.run_bzr('commit -m change')
55
self.run_bzr('merge ../b', retcode=1)
56
57
def test_conflicts(self):
57
conflicts = self.runbzr('conflicts', backtick=True)
58
conflicts, errs = self.run_bzr(['conflicts'])
58
59
self.assertEqual(3, len(conflicts.splitlines()))
60
61
def test_conflicts_text(self):
62
63
self.assertEqual(['my_other_file', 'myfile'], conflicts)
64
65
def test_resolve(self):
65
self.runbzr('resolve myfile')
66
conflicts = self.runbzr('conflicts', backtick=True)
66
self.run_bzr('resolve myfile')
67
conflicts, errs = self.run_bzr(['conflicts'])
67
68
self.assertEqual(2, len(conflicts.splitlines()))
68
self.runbzr('resolve my_other_file')
69
self.runbzr('resolve mydir2')
70
conflicts = self.runbzr('conflicts', backtick=True)
69
self.run_bzr('resolve my_other_file')
70
self.run_bzr('resolve mydir2')
71
conflicts, errs = self.run_bzr(['conflicts'])
71
72
self.assertEqual(len(conflicts.splitlines()), 0)
73
74
def test_resolve_all(self):
74
self.runbzr('resolve --all')
75
conflicts = self.runbzr('conflicts', backtick=True)
75
self.run_bzr('resolve --all')
76
conflicts, errs = self.run_bzr(['conflicts'])
76
77
self.assertEqual(len(conflicts.splitlines()), 0)
78
79
def test_resolve_in_subdir(self):
84
self.runbzr("resolve ../myfile")
85
self.run_bzr("resolve ../myfile")
85
86
os.chdir("../../b")
86
self.runbzr("resolve ../a/myfile")
87
self.run_bzr("resolve ../a/myfile")
87
88
wt = WorkingTree.open_containing('.')[0]
88
89
conflicts = wt.conflicts()
89
90
if not conflicts.is_empty():