Rev 4337: Add Branch._get_check_refs. in http://people.ubuntu.com/~robertc/baz2.0/check

Robert Collins robertc at robertcollins.net
Mon May 11 02:12:47 BST 2009


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

------------------------------------------------------------
revno: 4337
revision-id: robertc at robertcollins.net-20090511011236-svd297xfll30g1wm
parent: robertc at robertcollins.net-20090508062301-yu577nacsdcp2u9p
committer: Robert Collins <robertc at robertcollins.net>
branch nick: check
timestamp: Mon 2009-05-11 11:12:36 +1000
message:
  Add Branch._get_check_refs.
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2009-05-08 05:10:18 +0000
+++ b/bzrlib/branch.py	2009-05-11 01:12:36 +0000
@@ -129,6 +129,14 @@
             raise errors.UnstackableRepositoryFormat(self.repository._format,
                 self.repository.base)
 
+    def _get_check_refs(self):
+        """Get the references needed for check().
+
+        See bzrlib.check.
+        """
+        revid = self.last_revision()
+        return [('revision-existence', revid), ('lefthand-distance', revid)]
+
     @staticmethod
     def open(base, _unsupported=False, possible_transports=None):
         """Open the branch rooted at base.

=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py	2009-05-08 02:06:36 +0000
+++ b/bzrlib/check.py	2009-05-11 01:12:36 +0000
@@ -39,7 +39,11 @@
 so that when the dependent object is checked, matches can be pulled out and
 evaluated in-line rather than re-reading the same data many times.
 check_refs are tuples (kind, value). Currently defined kinds are:
-* 'trees', where value is a revid.
+* 'trees', where value is a revid and the looked up objects are revision trees.
+* 'lefthand-distance', where value is a revid and the looked up objects are the
+  distance along the lefthand path to NULL for that revid.
+* 'revision-existence', where value is a revid, and the result is True or False
+  indicating that the revision was found/not found.
 """
 
 from bzrlib import errors, osutils

=== modified file 'bzrlib/tests/branch_implementations/test_check.py'
--- a/bzrlib/tests/branch_implementations/test_check.py	2009-05-08 05:10:18 +0000
+++ b/bzrlib/tests/branch_implementations/test_check.py	2009-05-11 01:12:36 +0000
@@ -70,4 +70,9 @@
         result.report_results(verbose=True)
         result.report_results(verbose=False)
 
-
+    def test__get_check_refs(self):
+        tree = self.make_branch_and_tree('.')
+        revid = tree.commit('foo')
+        self.assertEqual(
+            set([('revision-existence', revid), ('lefthand-distance', revid)]),
+            set(tree.branch._get_check_refs()))




More information about the bazaar-commits mailing list