1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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)
193
163
def test_hardlink(self):
194
164
self.requireFeature(HardlinkFeature)
195
165
transform, root = self.get_transform()
813
783
transform, root = self.get_transform()
814
784
transform.adjust_root_path('oldroot', fun)
815
new_root = transform.trans_id_tree_path('')
785
new_root=transform.trans_id_tree_path('')
816
786
transform.version_file('new-root', new_root)
817
787
transform.apply()
1923
1893
self.assertTrue(source.is_executable('file1-id'))
1925
1895
def install_rot13_content_filter(self, pattern):
1927
# self.addCleanup(filters._reset_registry, filters._reset_registry())
1928
# below, but that looks a bit... hard to read even if it's exactly
1930
1896
original_registry = filters._reset_registry()
1931
1897
def restore_registry():
1932
1898
filters._reset_registry(original_registry)
2739
2705
preview = self.get_empty_preview()
2740
2706
root = preview.new_directory('', ROOT_PARENT, 'tree-root')
2741
2707
# FIXME: new_directory should mark root.
2742
preview.fixup_new_roots()
2708
preview.adjust_path('', ROOT_PARENT, root)
2743
2709
preview_tree = preview.get_preview_tree()
2744
2710
file_trans_id = preview.new_file('a', preview.root, 'contents',