/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rename_map.py

  • Committer: Aaron Bentley
  • Date: 2009-03-14 00:09:42 UTC
  • mto: This revision was merged to the branch mainline in revision 4196.
  • Revision ID: aaron@aaronbentley.com-20090314000942-03n04smifnkwlram
Move all rename-guessing into RenameMap

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
 
18
import os
 
19
 
18
20
from bzrlib.rename_map import RenameMap
19
21
from bzrlib.tests import TestCaseWithTransport
20
22
 
105
107
        matches = RenameMap().match_parents(required_parents, missing_parents)
106
108
        self.assertEqual({'path3/path4': 'path4-id', 'path2': 'path2-id'},
107
109
                         matches)
 
110
 
 
111
    def test_guess_renames(self):
 
112
        tree = self.make_branch_and_tree('tree')
 
113
        tree.lock_write()
 
114
        self.addCleanup(tree.unlock)
 
115
        self.build_tree(['tree/file'])
 
116
        tree.add('file', 'file-id')
 
117
        tree.commit('Added file')
 
118
        os.rename('tree/file', 'tree/file2')
 
119
        RenameMap.guess_renames(tree)
 
120
        self.assertEqual('file2', tree.id2path('file-id'))
 
121
 
 
122
    def test_guess_renames_handles_directories(self):
 
123
        tree = self.make_branch_and_tree('tree')
 
124
        tree.lock_write()
 
125
        self.addCleanup(tree.unlock)
 
126
        self.build_tree(['tree/dir/', 'tree/dir/file'])
 
127
        tree.add(['dir', 'dir/file'], ['dir-id', 'file-id'])
 
128
        tree.commit('Added file')
 
129
        os.rename('tree/dir', 'tree/dir2')
 
130
        RenameMap.guess_renames(tree)
 
131
        self.assertEqual('dir2/file', tree.id2path('file-id'))