Rev 2955: Lock correctness for check/reconcile tests. in http://people.ubuntu.com/~robertc/baz2.0/reconcile
Robert Collins
robertc at robertcollins.net
Wed Oct 31 23:28:07 GMT 2007
At http://people.ubuntu.com/~robertc/baz2.0/reconcile
------------------------------------------------------------
revno: 2955
revision-id:robertc at robertcollins.net-20071031232803-igxkczmug4hpmvq4
parent: robertc at robertcollins.net-20071031223353-rwxukxnvocam1jlb
committer: Robert Collins <robertc at robertcollins.net>
branch nick: reconcile
timestamp: Thu 2007-11-01 10:28:03 +1100
message:
Lock correctness for check/reconcile tests.
modified:
bzrlib/tests/repository_implementations/test_check_reconcile.py test_broken.py-20070928125406-62236394w0jpbpd6-2
=== modified file 'bzrlib/tests/repository_implementations/test_check_reconcile.py'
--- a/bzrlib/tests/repository_implementations/test_check_reconcile.py 2007-10-26 06:58:43 +0000
+++ b/bzrlib/tests/repository_implementations/test_check_reconcile.py 2007-10-31 23:28:03 +0000
@@ -58,6 +58,10 @@
"""
inv.revision_id = revision_id
inv.root.revision = revision_id
+ root_id = inv.root.file_id
+ vf = repo.weave_store.get_weave_or_empty(root_id,
+ repo.get_transaction())
+ vf.add_lines(revision_id, [], [])
repo.add_inventory(revision_id, inv, parent_ids)
revision = Revision(revision_id, committer='jrandom at example.com',
timestamp=0, inventory_sha1='', timezone=0, message='foo',
@@ -147,23 +151,34 @@
scenario = self.scenario_class(self)
repo = self.make_populated_repository(scenario.populate_repository)
self.require_repo_suffers_text_parent_corruption(repo)
- self.assertParentsMatch(scenario.populated_parents(), repo, 'before')
- vf_shas = self.shas_for_versions_of_file(
- repo, scenario.all_versions_after_reconcile())
+ repo.lock_read()
+ try:
+ self.assertParentsMatch(scenario.populated_parents(), repo,
+ 'before')
+ vf_shas = self.shas_for_versions_of_file(
+ repo, scenario.all_versions_after_reconcile())
+ finally:
+ repo.unlock()
result = repo.reconcile(thorough=True)
- self.assertParentsMatch(scenario.corrected_parents(), repo, 'after')
- # The contents of the versions in the versionedfile should be the same
- # after the reconcile.
- self.assertEqual(
- vf_shas,
- self.shas_for_versions_of_file(
- repo, scenario.all_versions_after_reconcile()))
+ repo.lock_read()
+ try:
+ self.assertParentsMatch(scenario.corrected_parents(), repo,
+ 'after')
+ # The contents of the versions in the versionedfile should be the
+ # same after the reconcile.
+ self.assertEqual(
+ vf_shas,
+ self.shas_for_versions_of_file(
+ repo, scenario.all_versions_after_reconcile()))
- for file_version in scenario.corrected_fulltexts():
- vf = repo.weave_store.get_weave(
- 'a-file-id', repo.get_transaction())
- self.assertEqual('fulltext', vf._index.get_method(file_version),
- '%r should be fulltext' % (file_version,))
+ for file_version in scenario.corrected_fulltexts():
+ vf = repo.weave_store.get_weave(
+ 'a-file-id', repo.get_transaction())
+ self.assertEqual('fulltext',
+ vf._index.get_method(file_version),
+ '%r should be fulltext' % (file_version,))
+ finally:
+ repo.unlock()
def test_check_behaviour(self):
"""Populate a repository and check it, and verify the output."""
More information about the bazaar-commits
mailing list