Rev 2721: Merge reviewed reconcile test tweaking patch. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Wed Aug 22 01:16:11 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 2721
revision-id: robertc at robertcollins.net-20070822001608-o8767a8ekyq5q3q3
parent: robertc at robertcollins.net-20070816094119-934cn03uls16spes
parent: robertc at robertcollins.net-20070822000438-ytdb6rp46lnk2jlx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Wed 2007-08-22 10:16:08 +1000
message:
  Merge reviewed reconcile test tweaking patch.
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: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.1.3
    revision-id: 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.
    modified:
      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.2
    revision-id: 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.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      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
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2007-08-08 05:17:26 +0000
+++ b/bzrlib/remote.py	2007-08-22 00:16:08 +0000
@@ -248,6 +248,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-16 09:40:35 +0000
+++ b/bzrlib/repository.py	2007-08-22 00:16:08 +0000
@@ -247,6 +247,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
@@ -911,13 +913,6 @@
         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-08-08 05:17:26 +0000
+++ b/bzrlib/tests/repository_implementations/test_reconcile.py	2007-08-22 00:16:08 +0000
@@ -143,10 +143,9 @@
         # 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."""
+    def test_repo_has_reconcile_does_inventory_gc_attribute(self):
         repo = self.make_repository('repo')
-        self.assertNotEqual(None, set(repo.reconcile_actions()))
+        self.assertNotEqual(None, repo._reconcile_does_inventory_gc)
 
     def test_reconcile_empty_thorough(self):
         # reconcile should accept thorough=True
@@ -157,9 +156,8 @@
         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
+        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()
@@ -170,9 +168,8 @@
         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
+        if not repo._reconcile_does_inventory_gc:
+            raise TestSkipped('Irrelevant test')
         self.checkUnreconciled(d, repo.reconcile())
         reconciler = repo.reconcile(thorough=True)
         # no bad parents
@@ -188,10 +185,9 @@
         if ([None, 'missing', 'references_missing']
             != repo.get_ancestry('references_missing')):
             # the repo handles ghosts without corruption, so reconcile has
-            # 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
+            # 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:
@@ -222,9 +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 'inventory_gc' not in d.open_repository().reconcile_actions():
-            # irrelevant test.
-            return
+        if not d.open_repository()._reconcile_does_inventory_gc:
+            raise TestSkipped('Irrelevant test')
         def reconcile():
             reconciler = Reconciler(d)
             reconciler.reconcile()
@@ -236,9 +231,8 @@
         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
+        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,



More information about the bazaar-commits mailing list