Rev 5777: (jelmer) Move revision_graph_can_have_wrong_parents from Repository to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Apr 9 01:20:46 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5777 [merge]
revision-id: pqm at pqm.ubuntu.com-20110409012042-1c0hnd2ryglf85y3
parent: pqm at pqm.ubuntu.com-20110409003535-lu3d1bkltkbqul3x
parent: jelmer at samba.org-20110409001312-5ejoauwayrob2cp0
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2011-04-09 01:20:42 +0000
message:
  (jelmer) Move revision_graph_can_have_wrong_parents from Repository to
   RepositoryFormat. (Jelmer Vernooij)
modified:
  bzrlib/check.py                check.py-20050309040759-f3a679400c06bcc1
  bzrlib/plugins/weave_fmt/repository.py presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/per_repository/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
  bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py	2011-02-21 20:47:35 +0000
+++ b/bzrlib/check.py	2011-04-08 12:28:37 +0000
@@ -172,7 +172,7 @@
         # - we can fill out existence flags at this point
         # - we can read the revision inventory sha at this point
         # - we can check properties and serialisers etc.
-        if not self.repository.revision_graph_can_have_wrong_parents():
+        if not self.repository._format.revision_graph_can_have_wrong_parents:
             # The check against the index isn't needed.
             self.revs_with_bad_parents_in_index = None
             for thing in revision_iterator:

=== modified file 'bzrlib/plugins/weave_fmt/repository.py'
--- a/bzrlib/plugins/weave_fmt/repository.py	2011-04-05 01:12:15 +0000
+++ b/bzrlib/plugins/weave_fmt/repository.py	2011-04-09 00:13:12 +0000
@@ -188,11 +188,6 @@
         """Returns the policy for making working trees on new branches."""
         return True
 
-    def revision_graph_can_have_wrong_parents(self):
-        # XXX: This is an old format that we don't support full checking on, so
-        # just claim that checking for this inconsistency is not required.
-        return False
-
 
 class WeaveMetaDirRepository(MetaDirVersionedFileRepository):
     """A subclass of MetaDirRepository to set weave specific policy."""
@@ -263,9 +258,6 @@
         return self.inventories.add_lines((revision_id,), final_parents, lines,
             check_content=check_content)[0]
 
-    def revision_graph_can_have_wrong_parents(self):
-        return False
-
 
 class PreSplitOutRepositoryFormat(RepositoryFormat):
     """Base class for the pre split out repository formats."""
@@ -280,6 +272,9 @@
     fast_deltas = False
     supports_leaving_lock = False
     supports_full_versioned_files = True
+    # XXX: This is an old format that we don't support full checking on, so
+    # just claim that checking for this inconsistency is not required.
+    revision_graph_can_have_wrong_parents = False
 
     def initialize(self, a_bzrdir, shared=False, _internal=False):
         """Create a weave repository."""
@@ -502,6 +497,7 @@
     supports_chks = False
     supports_funky_characters = False
     supports_full_versioned_files = True
+    revision_graph_can_have_wrong_parents = False
 
     _fetch_order = 'topological'
     _fetch_reconcile = True

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2011-03-10 17:27:04 +0000
+++ b/bzrlib/remote.py	2011-04-08 12:28:37 +0000
@@ -729,6 +729,7 @@
         self._custom_format = None
         self._network_name = None
         self._creating_bzrdir = None
+        self._revision_graph_can_have_wrong_parents = None
         self._supports_chks = None
         self._supports_external_lookups = None
         self._supports_tree_reference = None
@@ -782,6 +783,14 @@
                 self._custom_format.supports_tree_reference
         return self._supports_tree_reference
 
+    @property
+    def revision_graph_can_have_wrong_parents(self):
+        if self._revision_graph_can_have_wrong_parents is None:
+            self._ensure_real()
+            self._revision_graph_can_have_wrong_parents = \
+                self._custom_format.revision_graph_can_have_wrong_parents
+        return self._revision_graph_can_have_wrong_parents
+
     def _vfs_initialize(self, a_bzrdir, shared):
         """Helper for common code in initialize."""
         if self._custom_format:
@@ -1986,11 +1995,6 @@
         return self._real_repository.item_keys_introduced_by(revision_ids,
             _files_pb=_files_pb)
 
-    def revision_graph_can_have_wrong_parents(self):
-        # The answer depends on the remote repo format.
-        self._ensure_real()
-        return self._real_repository.revision_graph_can_have_wrong_parents()
-
     def _find_inconsistent_revision_parents(self, revisions_iterator=None):
         self._ensure_real()
         return self._real_repository._find_inconsistent_revision_parents(

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2011-02-24 15:38:56 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2011-04-08 12:28:37 +0000
@@ -263,11 +263,6 @@
             raise errors.BzrCheckError(
                 "Revision knit has inconsistent parents.")
 
-    def revision_graph_can_have_wrong_parents(self):
-        # The revision.kndx could potentially claim a revision has a different
-        # parent to the revision text.
-        return True
-
 
 class RepositoryFormatKnit(MetaDirRepositoryFormat):
     """Bzr repository knit format (generalized).
@@ -306,6 +301,9 @@
     fast_deltas = False
     supports_funky_characters = True
     supports_full_versioned_files = True
+    # The revision.kndx could potentially claim a revision has a different
+    # parent to the revision text.
+    revision_graph_can_have_wrong_parents = True
 
     def _get_inventories(self, repo_transport, repo, name='inventory'):
         mapper = versionedfile.ConstantMapper(name)

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2011-04-08 22:59:00 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2011-04-09 01:20:42 +0000
@@ -2263,6 +2263,7 @@
     fast_deltas = False
     supports_full_versioned_files = True
     supports_funky_characters = True
+    revision_graph_can_have_wrong_parents = True
 
     def initialize(self, a_bzrdir, shared=False):
         """Create a pack based repository.

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2011-04-08 10:54:03 +0000
+++ b/bzrlib/repository.py	2011-04-08 22:51:59 +0000
@@ -2765,17 +2765,6 @@
                 except UnicodeDecodeError:
                     raise errors.NonAsciiRevisionId(method, self)
 
-    def revision_graph_can_have_wrong_parents(self):
-        """Is it possible for this repository to have a revision graph with
-        incorrect parents?
-
-        If True, then this repository must also implement
-        _find_inconsistent_revision_parents so that check and reconcile can
-        check for inconsistencies before proceeding with other checks that may
-        depend on the revision index being consistent.
-        """
-        raise NotImplementedError(self.revision_graph_can_have_wrong_parents)
-
 
 def install_revision(repository, rev, revision_tree):
     """Install all revision data into a repository."""
@@ -3019,6 +3008,8 @@
     supports_full_versioned_files = None
     # Does this format support signing revision signatures?
     supports_revision_signatures = True
+    # Can the revision graph have incorrect parents?
+    revision_graph_can_have_wrong_parents = None
 
     def __repr__(self):
         return "%s()" % self.__class__.__name__

=== modified file 'bzrlib/tests/per_repository/test_check.py'
--- a/bzrlib/tests/per_repository/test_check.py	2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/per_repository/test_check.py	2011-04-08 12:28:37 +0000
@@ -74,7 +74,7 @@
         no broken revisions.
         """
         repo = self.make_repository('empty-repo')
-        if not repo.revision_graph_can_have_wrong_parents():
+        if not repo._format.revision_graph_can_have_wrong_parents:
             raise TestNotApplicable(
                 '%r cannot have corrupt revision index.' % repo)
         repo.lock_read()

=== modified file 'bzrlib/tests/per_repository/test_repository.py'
--- a/bzrlib/tests/per_repository/test_repository.py	2011-04-08 10:54:03 +0000
+++ b/bzrlib/tests/per_repository/test_repository.py	2011-04-08 22:51:59 +0000
@@ -99,6 +99,10 @@
         self.assertFormatAttribute('supports_leaving_lock',
             (True, False))
 
+    def test_attribute_format_revision_graph_can_have_wrong_parents(self):
+        self.assertFormatAttribute('revision_graph_can_have_wrong_parents',
+            (True, False))
+
     def test_format_is_deprecated(self):
         repo = self.make_repository('repo')
         self.assertSubset([repo._format.is_deprecated()], (True, False))
@@ -695,7 +699,7 @@
         """
         repo = self.make_repository('.')
         # This should work, not raise NotImplementedError:
-        if not repo.revision_graph_can_have_wrong_parents():
+        if not repo._format.revision_graph_can_have_wrong_parents:
             return
         repo.lock_read()
         self.addCleanup(repo.unlock)

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-04-08 12:28:05 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-04-08 22:51:59 +0000
@@ -97,6 +97,10 @@
 
 * New method ``Hooks.uninstall_named_hook``. (Jelmer Vernooij, #301472)
 
+* ``revision_graph_can_have_wrong_parents`` is now an attribute
+  on ``RepositoryFormat`` rather than a method on ``Repository``.
+  (Jelmer Vernooij)
+
 * The ``revno`` parameter of ``log.LogRevision`` may now be None,
   representing a revision which is not in the current branch.
   (Matt Giuca, #241998)




More information about the bazaar-commits mailing list