160
160
# But if we have more than that, all files should get the same result
161
161
self.assertEqual(st1.st_mtime, st2.st_mtime)
163
def test_change_root_id(self):
164
transform, root = self.get_transform()
165
self.assertNotEqual('new-root-id', self.wt.get_root_id())
166
transform.new_directory('', ROOT_PARENT, 'new-root-id')
167
transform.delete_contents(root)
168
transform.unversion_file(root)
169
transform.fixup_new_roots()
171
self.assertEqual('new-root-id', self.wt.get_root_id())
173
def test_change_root_id_add_files(self):
174
transform, root = self.get_transform()
175
self.assertNotEqual('new-root-id', self.wt.get_root_id())
176
new_trans_id = transform.new_directory('', ROOT_PARENT, 'new-root-id')
177
transform.new_file('file', new_trans_id, ['new-contents\n'],
179
transform.delete_contents(root)
180
transform.unversion_file(root)
181
transform.fixup_new_roots()
183
self.assertEqual('new-root-id', self.wt.get_root_id())
184
self.assertEqual('new-file-id', self.wt.path2id('file'))
185
self.assertFileEqual('new-contents\n', self.wt.abspath('file'))
187
def test_add_two_roots(self):
188
transform, root = self.get_transform()
189
new_trans_id = transform.new_directory('', ROOT_PARENT, 'new-root-id')
190
new_trans_id = transform.new_directory('', ROOT_PARENT, 'alt-root-id')
191
self.assertRaises(ValueError, transform.fixup_new_roots)
163
193
def test_hardlink(self):
164
194
self.requireFeature(HardlinkFeature)
165
195
transform, root = self.get_transform()
783
813
transform, root = self.get_transform()
784
814
transform.adjust_root_path('oldroot', fun)
785
new_root=transform.trans_id_tree_path('')
815
new_root = transform.trans_id_tree_path('')
786
816
transform.version_file('new-root', new_root)
787
817
transform.apply()
2705
2735
preview = self.get_empty_preview()
2706
2736
root = preview.new_directory('', ROOT_PARENT, 'tree-root')
2707
2737
# FIXME: new_directory should mark root.
2708
preview.adjust_path('', ROOT_PARENT, root)
2738
preview.fixup_new_roots()
2709
2739
preview_tree = preview.get_preview_tree()
2710
2740
file_trans_id = preview.new_file('a', preview.root, 'contents',