/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-11-16 18:35:30 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7178.
  • Revision ID: jelmer@jelmer.uk-20181116183530-ue8yx60h5tinl2wy
Merge more-cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
 
238
238
    def test_revision_tree_record_iter_changes(self):
239
239
        tree = self.make_branch_and_tree(".")
240
 
        tree.lock_write()
241
 
        try:
 
240
        with tree.lock_write():
242
241
            builder = tree.branch.get_commit_builder([])
243
242
            try:
244
243
                list(builder.record_iter_changes(tree,
254
253
            # the RevisionTree api.
255
254
            self.assertEqual(rev_id, rev_tree.get_revision_id())
256
255
            self.assertEqual((), tuple(rev_tree.get_parent_ids()))
257
 
        finally:
258
 
            tree.unlock()
259
256
 
260
257
    def test_root_entry_has_revision(self):
261
258
        # test the root revision created and put in the basis
268
265
        basis_tree = tree.basis_tree()
269
266
        basis_tree.lock_read()
270
267
        self.addCleanup(basis_tree.unlock)
271
 
        self.assertEqual(rev_id,
272
 
                         basis_tree.get_file_revision(u'', basis_tree.get_root_id()))
 
268
        self.assertEqual(rev_id, basis_tree.get_file_revision(u''))
273
269
 
274
270
    def _get_revtrees(self, tree, revision_ids):
275
 
        tree.lock_read()
276
 
        try:
 
271
        with tree.lock_read():
277
272
            trees = list(tree.branch.repository.revision_trees(revision_ids))
278
273
            for _tree in trees:
279
274
                _tree.lock_read()
280
275
                self.addCleanup(_tree.unlock)
281
276
            return trees
282
 
        finally:
283
 
            tree.unlock()
284
277
 
285
278
    def test_last_modified_revision_after_commit_root_unchanged(self):
286
279
        # commiting without changing the root does not change the
663
656
                in_tree, name, 'new_' + name, False,
664
657
                delta_against_basis=changed_in_tree)
665
658
            tree3, = self._get_revtrees(in_tree, [rev2])
666
 
            self.assertEqual(
667
 
                rev2,
668
 
                tree3.get_file_revision('new_' + name, file_id))
 
659
            self.assertEqual(rev2, tree3.get_file_revision('new_' + name))
669
660
            expected_graph = {}
670
661
            expected_graph[(file_id, rev1)] = ()
671
662
            expected_graph[(file_id, rev2)] = ((file_id, rev1),)