~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-12 21:08:30 UTC
  • mfrom: (4634.119.4 2.0)
  • mto: This revision was merged to the branch mainline in revision 4954.
  • Revision ID: john@arbash-meinel.com-20100112210830-met16yivsvxb5i0u
Merge bzr.stable, including the bugfix for #494269

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
163
193
    def test_hardlink(self):
164
194
        self.requireFeature(HardlinkFeature)
165
195
        transform, root = self.get_transform()
782
812
        create.apply()
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()
788
818
 
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',
2711
2741
                                         'a-id')