Rev 2743: (robertc) Add a private repository attribute to tell reonccile tests what the repository does to inventories during reconcile(). (Robert Collins). in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Aug 22 06:28:35 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2743
revision-id: pqm at pqm.ubuntu.com-20070822052832-nxby1d1plok4syek
parent: pqm at pqm.ubuntu.com-20070822044432-tfi063jpsr3vgnao
parent: robertc at robertcollins.net-20070822000438-ytdb6rp46lnk2jlx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-08-22 06:28:32 +0100
message:
(robertc) Add a private repository attribute to tell reonccile tests what the repository does to inventories during reconcile(). (Robert Collins).
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
------------------------------------------------------------
revno: 2671.4.3
merged: robertc at robertcollins.net-20070822000438-ytdb6rp46lnk2jlx
parent: robertc at robertcollins.net-20070808053751-72npeyouas425fck
committer: Robert Collins <robertc at robertcollins.net>
branch nick: reconcile
timestamp: Wed 2007-08-22 10:04:38 +1000
message:
Reformat comment to be more presentable.
------------------------------------------------------------
revno: 2671.4.2
merged: robertc at robertcollins.net-20070808053751-72npeyouas425fck
parent: robertc at robertcollins.net-20070805095335-dn7artt5nlwr8kwe
committer: Robert Collins <robertc at robertcollins.net>
branch nick: reconcile
timestamp: Wed 2007-08-08 15:37:51 +1000
message:
Review feedback.
------------------------------------------------------------
revno: 2671.4.1
merged: robertc at robertcollins.net-20070805095335-dn7artt5nlwr8kwe
parent: pqm at pqm.ubuntu.com-20070803043116-l7u1uypblmx1uxnr
committer: Robert Collins <robertc at robertcollins.net>
branch nick: reconcile
timestamp: Sun 2007-08-05 19:53:35 +1000
message:
* Add a new method ``bzrlib.repository.Repository.reconcile_actions``
allowing conditional test cases on the sorts of things reconcile
will actually perform. (Robert Collins)
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2007-08-21 01:40:39 +0000
+++ b/bzrlib/remote.py 2007-08-22 05:28:32 +0000
@@ -252,6 +252,8 @@
self._lock_token = None
self._lock_count = 0
self._leave_lock = False
+ # for tests
+ self._reconcile_does_inventory_gc = True
def abort_write_group(self):
"""Complete a write group on the decorated repository.
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-08-21 01:40:39 +0000
+++ b/bzrlib/repository.py 2007-08-22 05:28:32 +0000
@@ -246,6 +246,8 @@
self._revision_store = _revision_store
# backwards compatibility
self.weave_store = text_store
+ # for tests
+ self._reconcile_does_inventory_gc = True
# not right yet - should be more semantically clear ?
#
self.control_store = control_store
=== modified file 'bzrlib/tests/repository_implementations/test_reconcile.py'
--- a/bzrlib/tests/repository_implementations/test_reconcile.py 2007-08-07 22:59:45 +0000
+++ b/bzrlib/tests/repository_implementations/test_reconcile.py 2007-08-22 05:28:32 +0000
@@ -139,10 +139,14 @@
# and no backup weave should have been needed/made.
self.checkNoBackupInventory(d)
- def test_reconile_empty(self):
+ def test_reconcile_empty(self):
# in an empty repo, theres nothing to do.
self.checkEmptyReconcile()
+ def test_repo_has_reconcile_does_inventory_gc_attribute(self):
+ repo = self.make_repository('repo')
+ self.assertNotEqual(None, repo._reconcile_does_inventory_gc)
+
def test_reconcile_empty_thorough(self):
# reconcile should accept thorough=True
self.checkEmptyReconcile(thorough=True)
@@ -151,6 +155,9 @@
# smoke test for the all in one ui tool
bzrdir_url = self.get_url('inventory_without_revision')
bzrdir = bzrlib.bzrdir.BzrDir.open(bzrdir_url)
+ repo = bzrdir.open_repository()
+ if not repo._reconcile_does_inventory_gc:
+ raise TestSkipped('Irrelevant test')
reconcile(bzrdir)
# now the backup should have it but not the current inventory
repo = bzrdir.open_repository()
@@ -161,11 +168,13 @@
d_url = self.get_url('inventory_without_revision')
d = bzrlib.bzrdir.BzrDir.open(d_url)
repo = d.open_repository()
+ if not repo._reconcile_does_inventory_gc:
+ raise TestSkipped('Irrelevant test')
self.checkUnreconciled(d, repo.reconcile())
reconciler = repo.reconcile(thorough=True)
# no bad parents
self.assertEqual(0, reconciler.inconsistent_parents)
- # and one garbage inventoriy
+ # and one garbage inventory
self.assertEqual(1, reconciler.garbage_inventories)
self.check_missing_was_removed(repo)
@@ -173,10 +182,13 @@
**kwargs):
# actual low level test.
repo = aBzrDir.open_repository()
- if ([None, 'missing', 'references_missing']
+ if ([None, 'missing', 'references_missing']
!= repo.get_ancestry('references_missing')):
# the repo handles ghosts without corruption, so reconcile has
- # nothing to do here
+ # nothing to do here. Specifically, this test has the inventory
+ # 'missing' present and the revision 'missing' missing, so clearly
+ # 'missing' cannot be reported in the present ancestry -> missing
+ # is something that can be filled as a ghost.
expected_inconsistent_parents = 0
else:
expected_inconsistent_parents = 1
@@ -206,6 +218,8 @@
# other tests use the lower level repo.reconcile()
d_url = self.get_url('inventory_without_revision_and_ghost')
d = bzrlib.bzrdir.BzrDir.open(d_url)
+ if not d.open_repository()._reconcile_does_inventory_gc:
+ raise TestSkipped('Irrelevant test')
def reconcile():
reconciler = Reconciler(d)
reconciler.reconcile()
@@ -217,6 +231,8 @@
d_url = self.get_url('inventory_without_revision_and_ghost')
d = bzrlib.bzrdir.BzrDir.open(d_url)
repo = d.open_repository()
+ if not repo._reconcile_does_inventory_gc:
+ raise TestSkipped('Irrelevant test')
# nothing should have been altered yet : inventories without
# revisions are not data loss incurring for current format
self.check_thorough_reweave_missing_revision(d, repo.reconcile,
@@ -351,8 +367,8 @@
g = repo.get_revision_graph()
self.assertEqual(('1', '2'), g['wrong-first-parent'])
- def test_reconcile_wrong_order_secondary(self):
- # a wrong order in secondary parents is ignored.
+ def test_reconcile_wrong_order_secondary_inventory(self):
+ # a wrong order in the parents for inventories is ignored.
t = get_transport(self.get_url()).clone('reversed-secondary-parents')
d = bzrlib.bzrdir.BzrDir.open_from_transport(t)
repo = d.open_repository()
More information about the bazaar-commits
mailing list