~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Martin Pool
  • Date: 2010-01-12 06:30:41 UTC
  • mfrom: (4634.119.3 2.0)
  • mto: This revision was merged to the branch mainline in revision 4951.
  • Revision ID: mbp@sourcefrog.net-20100112063041-qp2ei0clx5gh0e9e
merge 2.0 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Canonical Ltd
2
2
#
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)
162
162
 
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()
170
 
        transform.apply()
171
 
        self.assertEqual('new-root-id', self.wt.get_root_id())
172
 
 
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'],
178
 
                           'new-file-id')
179
 
        transform.delete_contents(root)
180
 
        transform.unversion_file(root)
181
 
        transform.fixup_new_roots()
182
 
        transform.apply()
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'))
186
 
 
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)
192
 
 
193
163
    def test_hardlink(self):
194
164
        self.requireFeature(HardlinkFeature)
195
165
        transform, root = self.get_transform()
812
782
        create.apply()
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()
818
788
 
1923
1893
        self.assertTrue(source.is_executable('file1-id'))
1924
1894
 
1925
1895
    def install_rot13_content_filter(self, pattern):
1926
 
        # We could use
1927
 
        # self.addCleanup(filters._reset_registry, filters._reset_registry())
1928
 
        # below, but that looks a bit... hard to read even if it's exactly
1929
 
        # the same thing.
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',
2745
2711
                                         'a-id')