/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 breezy/tests/test_rename_map.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    a_lines = b'a\nb\nc\n'.splitlines(True)
33
33
    b_lines = b'b\nc\nd\n'.splitlines(True)
34
34
 
35
 
 
36
35
    def test_add_edge_hashes(self):
37
36
        rn = RenameMap(None)
38
37
        rn.add_edge_hashes(self.a_lines, 'a')
175
174
    @staticmethod
176
175
    def captureNotes(cmd, *args, **kwargs):
177
176
        notes = []
 
177
 
178
178
        def my_note(fmt, *args):
179
179
            notes.append(fmt % args)
180
180
        old_note = trace.note
195
195
        tree.commit('Added file')
196
196
        os.rename('tree/file', 'tree/file2')
197
197
        notes = self.captureNotes(
198
 
                RenameMap.guess_renames, tree.basis_tree(), tree,
199
 
                dry_run=True)[0]
 
198
            RenameMap.guess_renames, tree.basis_tree(), tree,
 
199
            dry_run=True)[0]
200
200
        self.assertEqual('file => file2', ''.join(notes))
201
201
        notes = self.captureNotes(RenameMap.guess_renames, tree.basis_tree(),
202
 
                tree, dry_run=False)[0]
 
202
                                  tree, dry_run=False)[0]
203
203
        self.assertEqual('file => file2', ''.join(notes))
204
204
 
205
205
    def test_guess_rename_handles_new_directories(self):
206
206
        """When a file was moved into a new directory."""
207
207
        tree = self.make_branch_and_tree('.')
208
208
        tree.lock_write()
209
 
        #self.addCleanup(tree.unlock)
 
209
        # self.addCleanup(tree.unlock)
210
210
        self.build_tree(['file'])
211
211
        tree.add('file', b'file-id')
212
212
        tree.commit('Added file')
213
213
        os.mkdir('folder')
214
214
        os.rename('file', 'folder/file2')
215
215
        notes = self.captureNotes(
216
 
                RenameMap.guess_renames, tree.basis_tree(), tree)[0]
 
216
            RenameMap.guess_renames, tree.basis_tree(), tree)[0]
217
217
        self.assertEqual('file => folder/file2', ''.join(notes))
218
218
 
219
219
        tree.unlock()