Rev 2664: All experimental format tests passing again. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Wed Jul 18 04:40:38 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 2664
revision-id: robertc at robertcollins.net-20070718034026-d3ado6wvo5lkma58
parent: robertc at robertcollins.net-20070717163212-0e57gzpdc4glp6sw
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Wed 2007-07-18 13:40:26 +1000
message:
All experimental format tests passing again.
modified:
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py 2007-07-17 16:32:12 +0000
+++ b/bzrlib/repofmt/knitrepo.py 2007-07-18 03:40:26 +0000
@@ -335,7 +335,7 @@
def get_revision_file(self, transaction):
"""Get the revision versioned file object."""
- if getattr(self.repo, '_revision_knit', None):
+ if getattr(self.repo, '_revision_knit', None) is not None:
return self.repo._revision_knit
index_transport = self.get_indices_transport()
self.repo._revision_indices = file_collection.FileCollection(
@@ -368,7 +368,7 @@
def flush(self):
"""Write out pending indices."""
# have we done anything?
- if getattr(self.repo, '_revision_knit', None):
+ if getattr(self.repo, '_revision_knit', None) is not None:
index_transport = self.get_indices_transport()
new_name = self.repo._revision_indices.allocate()
new_index_name = self.name_to_index_name(new_name)
@@ -403,12 +403,20 @@
_revision_store, control_store, text_store)
self._revision_store = GraphKnitRevisionStore(self, self._revision_store)
- def unlock(self):
- if self.control_files._lock_count == 1:
- if self.control_files._lock_mode == 'w':
- self._revision_store.flush()
+ def _abort_write_group(self):
+ # FIXME: just drop the transient index.
+ self._revision_store.reset()
+
+ def _refresh_data(self):
+ if self.control_files._lock_count==1:
self._revision_store.reset()
- self.control_files.unlock()
+
+ def _start_write_group(self):
+ pass
+
+ def _commit_write_group(self):
+ self._revision_store.flush()
+ self._revision_store.reset()
class GraphKnitRepository3(KnitRepository3):
@@ -420,12 +428,20 @@
_revision_store, control_store, text_store)
self._revision_store = GraphKnitRevisionStore(self, self._revision_store)
- def unlock(self):
- if self.control_files._lock_count == 1:
- if self.control_files._lock_mode == 'w':
- self._revision_store.flush()
+ def _abort_write_group(self):
+ # FIXME: just drop the transient index.
+ self._revision_store.reset()
+
+ def _refresh_data(self):
+ if self.control_files._lock_count==1:
self._revision_store.reset()
- self.control_files.unlock()
+
+ def _start_write_group(self):
+ pass
+
+ def _commit_write_group(self):
+ self._revision_store.flush()
+ self._revision_store.reset()
class RepositoryFormatKnit(MetaDirRepositoryFormat):
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-07-17 16:32:12 +0000
+++ b/bzrlib/repository.py 2007-07-18 03:40:26 +0000
@@ -395,7 +395,9 @@
"""
if self._write_group is not self.get_transaction():
# has an unlock or relock occured ?
- raise errors.BzrError('mismatched lock context and write group.')
+ raise errors.BzrError('mismatched lock context %r and '
+ 'write group %r.' %
+ (self.get_transaction(), self._write_group))
self._commit_write_group()
self._write_group = None
=== modified file 'bzrlib/tests/repository_implementations/test_reconcile.py'
--- a/bzrlib/tests/repository_implementations/test_reconcile.py 2007-03-28 07:48:37 +0000
+++ b/bzrlib/tests/repository_implementations/test_reconcile.py 2007-07-18 03:40:26 +0000
@@ -56,15 +56,21 @@
t = get_transport(self.get_url())
# an empty inventory with no revision for testing with.
repo = self.make_repository('inventory_without_revision')
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id='missing')
inv.root.revision = 'missing'
repo.add_inventory('missing', inv, [])
+ repo.commit_write_group()
+ repo.unlock()
# an empty inventory with no revision for testing with.
# this is referenced by 'references_missing' to let us test
# that all the cached data is correctly converted into ghost links
# and the referenced inventory still cleaned.
repo = self.make_repository('inventory_without_revision_and_ghost')
+ repo.lock_write()
+ repo.start_write_group()
repo.add_inventory('missing', inv, [])
inv = Inventory(revision_id='references_missing')
inv.root.revision = 'references_missing'
@@ -77,10 +83,14 @@
revision_id='references_missing')
rev.parent_ids = ['missing']
repo.add_revision('references_missing', rev)
+ repo.commit_write_group()
+ repo.unlock()
# a inventory with no parents and the revision has parents..
# i.e. a ghost.
repo = self.make_repository('inventory_one_ghost')
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id='ghost')
inv.root.revision = 'ghost'
sha1 = repo.add_inventory('ghost', inv, [])
@@ -92,12 +102,16 @@
revision_id='ghost')
rev.parent_ids = ['the_ghost']
repo.add_revision('ghost', rev)
+ repo.commit_write_group()
+ repo.unlock()
# a inventory with a ghost that can be corrected now.
t.copy_tree('inventory_one_ghost', 'inventory_ghost_present')
bzrdir_url = self.get_url('inventory_ghost_present')
bzrdir = bzrlib.bzrdir.BzrDir.open(bzrdir_url)
repo = bzrdir.open_repository()
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id='the_ghost')
inv.root.revision = 'the_ghost'
sha1 = repo.add_inventory('the_ghost', inv, [])
@@ -109,6 +123,8 @@
revision_id='the_ghost')
rev.parent_ids = []
repo.add_revision('the_ghost', rev)
+ repo.commit_write_group()
+ repo.unlock()
def checkEmptyReconcile(self, **kwargs):
"""Check a reconcile on an empty repository."""
@@ -281,6 +297,8 @@
# now setup the wrong-first parent case
repo = tree.branch.repository
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id='wrong-first-parent')
inv.root.revision = 'wrong-first-parent'
sha1 = repo.add_inventory('wrong-first-parent', inv, ['2', '1'])
@@ -292,9 +310,13 @@
revision_id='wrong-first-parent')
rev.parent_ids = ['1', '2']
repo.add_revision('wrong-first-parent', rev)
+ repo.commit_write_group()
+ repo.unlock()
# now setup the wrong-secondary parent case
repo = repo_secondary
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id='wrong-secondary-parent')
inv.root.revision = 'wrong-secondary-parent'
sha1 = repo.add_inventory('wrong-secondary-parent', inv, ['1', '3', '2'])
@@ -306,6 +328,8 @@
revision_id='wrong-secondary-parent')
rev.parent_ids = ['1', '2', '3']
repo.add_revision('wrong-secondary-parent', rev)
+ repo.commit_write_group()
+ repo.unlock()
def test_reconcile_wrong_order(self):
# a wrong order in primary parents is optionally correctable
=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py 2007-06-22 05:05:22 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py 2007-07-18 03:40:26 +0000
@@ -598,6 +598,8 @@
# a inventory with no parents and the revision has parents..
# i.e. a ghost.
repo = self.make_repository('inventory_with_unnecessary_ghost')
+ repo.lock_write()
+ repo.start_write_group()
inv = Inventory(revision_id = 'ghost')
inv.root.revision = 'ghost'
sha1 = repo.add_inventory('ghost', inv, [])
@@ -624,6 +626,8 @@
# check its setup usefully
inv_weave = repo.get_inventory_weave()
self.assertEqual(['ghost'], inv_weave.get_ancestry(['ghost']))
+ repo.commit_write_group()
+ repo.unlock()
def test_corrupt_revision_access_asserts_if_reported_wrong(self):
repo_url = self.get_url('inventory_with_unnecessary_ghost')
More information about the bazaar-commits
mailing list