~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-13 08:19:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4196.
  • Revision ID: aaron@aaronbentley.com-20090313081906-168g1ihto9jmenjf
Get directory rename handling working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        required_parents = rn.get_required_parents({
82
82
            'path1': 'a',
83
83
            'path2/tr': 'b',
 
84
            'path3/path4/path5': 'c',
84
85
        }, tree)
85
 
        self.assertEqual({'path2': ['path2/tr']}, required_parents)
 
86
        self.assertEqual(
 
87
            {'path2': set(['b']), 'path3/path4': set(['c']), 'path3': set()},
 
88
            required_parents)
 
89
 
 
90
    def test_find_directory_renames(self):
 
91
        rn = RenameMap()
 
92
        tree = self.make_branch_and_tree('tree')
 
93
        matches = {
 
94
            'path1': 'a',
 
95
            'path3/path4/path5': 'c',
 
96
        }
 
97
        required_parents = {
 
98
            'path2': set(['b']),
 
99
            'path3/path4': set(['c']),
 
100
            'path3': set([])}
 
101
        missing_parents = {
 
102
            'path2-id': set(['b']),
 
103
            'path4-id': set(['c']),
 
104
            'path3-id': set(['path4-id'])}
 
105
        matches = RenameMap().match_parents(required_parents, missing_parents)
 
106
        self.assertEqual({'path3/path4': 'path4-id', 'path2': 'path2-id'},
 
107
                         matches)