~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rename_map.py

  • Committer: Aaron Bentley
  • Date: 2009-03-23 21:22:21 UTC
  • mto: This revision was merged to the branch mainline in revision 4196.
  • Revision ID: aaron@aaronbentley.com-20090323212221-lmrxjykkcm6d3qo3
Add test for guessing renames.

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
        os.rename('tree/topdir', 'tree/topdir2')
145
145
        RenameMap.guess_renames(tree)
146
146
        self.assertEqual('topdir2', tree.id2path('topdir-id'))
 
147
 
 
148
    def test_guess_renames_preserves_children(self):
 
149
        """When a directory has been moved, its children are preserved."""
 
150
        tree = self.make_branch_and_tree('tree')
 
151
        tree.lock_write()
 
152
        self.build_tree_contents([('tree/foo/', ''),
 
153
                                  ('tree/foo/bar', 'bar'),
 
154
                                  ('tree/foo/empty', '')])
 
155
        tree.add(['foo', 'foo/bar', 'foo/empty'],
 
156
                 ['foo-id', 'bar-id', 'empty-id'])
 
157
        tree.commit('rev1')
 
158
        os.rename('tree/foo', 'tree/baz')
 
159
        RenameMap.guess_renames(tree)
 
160
        self.assertEqual('baz/empty', tree.id2path('empty-id'))