Rev 2705: Merge reconcile support pre-requisites for packs. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Sun Aug 5 10:58:39 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 2705
revision-id: robertc at robertcollins.net-20070805095835-w7zz6gijehcfs3v8
parent: robertc at robertcollins.net-20070805082934-uwqwq6nqew47ugcy
parent: robertc at robertcollins.net-20070805095335-dn7artt5nlwr8kwe
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sun 2007-08-05 19:58:35 +1000
message:
Merge reconcile support pre-requisites for packs.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.1.1
revision-id: 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:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
=== modified file 'NEWS'
--- a/NEWS 2007-08-05 08:20:29 +0000
+++ b/NEWS 2007-08-05 09:58:35 +0000
@@ -224,6 +224,10 @@
without requiring that all the data be buffered in memory.
(Robert Collins)
+ * Add a new method ``bzrlib.repository.Repository.reconcile_actions``
+ allowing conditional test cases on the sorts of things reconcile
+ will actually perform. (Robert Collins)
+
TESTING:
* Remove selftest ``--clean-output``, ``--numbered-dirs`` and
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-08-03 00:23:52 +0000
+++ b/bzrlib/repository.py 2007-08-05 09:58:35 +0000
@@ -890,6 +890,13 @@
reconciler.reconcile()
return reconciler
+ def reconcile_actions(self):
+ """Return a set of actions taken by reconcile on this repository.
+
+ :return: A set of actions. e.g. set(['inventory_gc']).
+ """
+ return set(['inventory_gc'])
+
def _refresh_data(self):
"""Helper called from lock_* to ensure coherency with disk.
=== modified file 'bzrlib/tests/repository_implementations/test_reconcile.py'
--- a/bzrlib/tests/repository_implementations/test_reconcile.py 2007-07-20 02:38:23 +0000
+++ b/bzrlib/tests/repository_implementations/test_reconcile.py 2007-08-05 09:58:35 +0000
@@ -139,10 +139,15 @@
# 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_reconcile_actions(self):
+ """reconcile_actions() returns a set naming what a repo reconciles."""
+ repo = self.make_repository('repo')
+ self.assertNotEqual(None, set(repo.reconcile_actions()))
+
def test_reconcile_empty_thorough(self):
# reconcile should accept thorough=True
self.checkEmptyReconcile(thorough=True)
@@ -151,6 +156,10 @@
# 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 'inventory_gc' not in repo.reconcile_actions():
+ # irrelevant test.
+ return
reconcile(bzrdir)
# now the backup should have it but not the current inventory
repo = bzrdir.open_repository()
@@ -161,11 +170,14 @@
d_url = self.get_url('inventory_without_revision')
d = bzrlib.bzrdir.BzrDir.open(d_url)
repo = d.open_repository()
+ if 'inventory_gc' not in repo.reconcile_actions():
+ # irrelevant test.
+ return
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 +185,14 @@
**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 +222,9 @@
# 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 'inventory_gc' not in d.open_repository().reconcile_actions():
+ # irrelevant test.
+ return
def reconcile():
reconciler = Reconciler(d)
reconciler.reconcile()
@@ -217,6 +236,9 @@
d_url = self.get_url('inventory_without_revision_and_ghost')
d = bzrlib.bzrdir.BzrDir.open(d_url)
repo = d.open_repository()
+ if 'inventory_gc' not in repo.reconcile_actions():
+ # irrelevant test.
+ return
# 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 +373,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