/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/per_repository/test_commit_builder.py

  • Committer: Jelmer Vernooij
  • Date: 2018-10-29 11:27:33 UTC
  • mto: This revision was merged to the branch mainline in revision 7170.
  • Revision ID: jelmer@jelmer.uk-20181029112733-bjvm24z12svwl53m
Get rid of file_ids in most of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
235
235
 
236
236
    def test_revision_tree_record_iter_changes(self):
237
237
        tree = self.make_branch_and_tree(".")
238
 
        tree.lock_write()
239
 
        try:
 
238
        with tree.lock_write():
240
239
            builder = tree.branch.get_commit_builder([])
241
240
            try:
242
241
                list(builder.record_iter_changes(tree,
252
251
            # the RevisionTree api.
253
252
            self.assertEqual(rev_id, rev_tree.get_revision_id())
254
253
            self.assertEqual((), tuple(rev_tree.get_parent_ids()))
255
 
        finally:
256
 
            tree.unlock()
257
254
 
258
255
    def test_root_entry_has_revision(self):
259
256
        # test the root revision created and put in the basis
266
263
        basis_tree = tree.basis_tree()
267
264
        basis_tree.lock_read()
268
265
        self.addCleanup(basis_tree.unlock)
269
 
        self.assertEqual(rev_id,
270
 
            basis_tree.get_file_revision(u'', basis_tree.get_root_id()))
 
266
        self.assertEqual(rev_id, basis_tree.get_file_revision(u''))
271
267
 
272
268
    def _get_revtrees(self, tree, revision_ids):
273
 
        tree.lock_read()
274
 
        try:
 
269
        with tree.lock_read():
275
270
            trees = list(tree.branch.repository.revision_trees(revision_ids))
276
271
            for _tree in trees:
277
272
                _tree.lock_read()
278
273
                self.addCleanup(_tree.unlock)
279
274
            return trees
280
 
        finally:
281
 
            tree.unlock()
282
275
 
283
276
    def test_last_modified_revision_after_commit_root_unchanged(self):
284
277
        # commiting without changing the root does not change the
655
648
            tree3, = self._get_revtrees(in_tree, [rev2])
656
649
            self.assertEqual(
657
650
                    rev2,
658
 
                    tree3.get_file_revision('new_' + name, file_id))
 
651
                    tree3.get_file_revision('new_' + name))
659
652
            expected_graph = {}
660
653
            expected_graph[(file_id, rev1)] = ()
661
654
            expected_graph[(file_id, rev2)] = ((file_id, rev1),)