Finishing inventory twice for commit builders

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Mar 31 16:19:11 BST 2009


In bzrlib/tests/per_repository/test_commit_builder.py,
test_commit_with_revision_id_record_iter_changes was doing:

=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
--- bzrlib/tests/per_repository/test_commit_builder.py	2009-03-25 07:54:11 +0000
+++ bzrlib/tests/per_repository/test_commit_builder.py	2009-03-31 13:54:51 +0000


            self.assertFalse(builder.random_revid)
            try:
                builder.record_iter_changes(tree, tree.last_revision(),
                    tree.iter_changes(tree.basis_tree()))
                builder.finish_inventory()
            except:
                builder.abort()
                raise
-            builder.finish_inventory()
            self.assertEqual(revision_id, builder.commit('foo bar'))

i.e. calling finish_inventory twice for the same commit.

It made the test fail for CHK formats. 

That means the second finish_inventory was a no-op for other
formats. I deleted the second call to make tests pass.

Robert, can you give some feedback here: was the second call
unintentional or do you want really want the feature ?

In the later case I'd prefer an explicit test as otherwise the
failure is masked by a:

    BzrError: Must end write group before releasing write lock on GCCHKPackRepository('file:///tmp/testbzr-f2PNkn.tmp/bzrlib.tests.per_repository.test_commit_builder.TestCommitBuilder.test_commit_with_revision_id_record_iter_changes%28RepositoryFormatPackGCCHK255Big%29/work/.bzr/repository/')

message which obscures the root cause.

        Vincent



More information about the bazaar mailing list