109
111
return template % (b'<' * 7, tree, b'=' * 7, merge, b'>' * 7)
112
class TestInventoryAltered(tests.TestCaseWithTransport):
114
def test_inventory_altered_unchanged(self):
115
tree = self.make_branch_and_tree('tree')
116
self.build_tree(['tree/foo'])
117
tree.add('foo', b'foo-id')
118
with tree.preview_transform() as tt:
119
self.assertEqual([], tt._inventory_altered())
121
def test_inventory_altered_changed_parent_id(self):
122
tree = self.make_branch_and_tree('tree')
123
self.build_tree(['tree/foo'])
124
tree.add('foo', b'foo-id')
125
with tree.preview_transform() as tt:
126
tt.unversion_file(tt.root)
127
tt.version_file(tt.root, file_id=b'new-id')
128
foo_trans_id = tt.trans_id_tree_path('foo')
129
foo_tuple = ('foo', foo_trans_id)
130
root_tuple = ('', tt.root)
131
self.assertEqual([root_tuple, foo_tuple], tt._inventory_altered())
133
def test_inventory_altered_noop_changed_parent_id(self):
134
tree = self.make_branch_and_tree('tree')
135
self.build_tree(['tree/foo'])
136
tree.add('foo', b'foo-id')
137
with tree.preview_transform() as tt:
138
tt.unversion_file(tt.root)
139
tt.version_file(tt.root, file_id=tree.path2id(''))
140
tt.trans_id_tree_path('foo')
141
self.assertEqual([], tt._inventory_altered())
144
114
class TestTransformMerge(TestCaseInTempDir):
146
116
def test_text_merge(self):
1603
1573
"""If the file to be linked is unmodified, link"""
1604
1574
transform.link_tree(self.child_tree, self.parent_tree)
1605
1575
self.assertTrue(self.hardlinked())
1578
class ErrorTests(tests.TestCase):
1580
def test_transform_rename_failed(self):
1581
e = TransformRenameFailed(u"from", u"to", "readonly file", 2)
1583
u"Failed to rename from to to: readonly file",