26
26
def make_tree_with_conflicts(test, this_path='this', other_path='other',
28
28
this_tree = test.make_branch_and_tree(this_path)
29
29
test.build_tree_contents([
30
30
('%s/%sfile' % (this_path, prefix), b'this content\n'),
31
31
('%s/%s_other_file' % (this_path, prefix), b'this content\n'),
32
32
('%s/%sdir/' % (this_path, prefix),),
34
this_tree.add(prefix+'file')
35
this_tree.add(prefix+'_other_file')
36
this_tree.add(prefix+'dir')
34
this_tree.add(prefix + 'file')
35
this_tree.add(prefix + '_other_file')
36
this_tree.add(prefix + 'dir')
37
37
this_tree.commit(message="new")
38
38
other_tree = this_tree.controldir.sprout(other_path).open_workingtree()
39
39
test.build_tree_contents([
40
40
('%s/%sfile' % (other_path, prefix), b'contentsb\n'),
41
41
('%s/%s_other_file' % (other_path, prefix), b'contentsb\n'),
43
other_tree.rename_one(prefix+'dir', prefix+'dir2')
43
other_tree.rename_one(prefix + 'dir', prefix + 'dir2')
44
44
other_tree.commit(message="change")
45
45
test.build_tree_contents([
46
46
('%s/%sfile' % (this_path, prefix), b'contentsa2\n'),
47
47
('%s/%s_other_file' % (this_path, prefix), b'contentsa2\n'),
49
this_tree.rename_one(prefix+'dir', prefix+'dir3')
49
this_tree.rename_one(prefix + 'dir', prefix + 'dir3')
50
50
this_tree.commit(message='change')
51
51
this_tree.merge_from_branch(other_tree.branch)
52
52
return this_tree, other_tree
97
97
"""Conflict messages involving non-ascii paths are displayed okay"""
98
98
make_tree_with_conflicts(self, "branch", prefix=u"\xA7")
99
99
out, err = self.run_bzr(["conflicts", "-d", "branch"],
100
encoding=self.encoding)
100
encoding=self.encoding)
101
101
self.assertEqual(out if PY3 else out.decode(self.encoding),
102
u"Text conflict in \xA7_other_file\n"
103
u"Path conflict: \xA7dir3 / \xA7dir2\n"
104
u"Text conflict in \xA7file\n")
102
u"Text conflict in \xA7_other_file\n"
103
u"Path conflict: \xA7dir3 / \xA7dir2\n"
104
u"Text conflict in \xA7file\n")
105
105
self.assertEqual(err, "")
107
107
def test_text_conflict_paths(self):
108
108
"""Text conflicts on non-ascii paths are displayed okay"""
109
109
make_tree_with_conflicts(self, "branch", prefix=u"\xA7")
110
110
out, err = self.run_bzr(["conflicts", "-d", "branch", "--text"],
111
encoding=self.encoding)
111
encoding=self.encoding)
112
112
self.assertEqual(out if PY3 else out.decode(self.encoding),
115
115
self.assertEqual(err, "")