D7710: revlog: split the content verification of a node into a separate method

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Dec 23 12:46:08 EST 2019


Closed by commit rHG7c3118b9a9db: revlog: split the content verification of a node into a separate method (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7710?vs=18906&id=18916

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7710/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7710

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -148,6 +148,16 @@
     return int(int(offset) << 16 | type)
 
 
+def _verify_revision(rl, skipflags, state, node):
+    """Verify the integrity of the given revlog ``node`` while providing a hook
+    point for extensions to influence the operation."""
+    if skipflags:
+        state[b'skipread'].add(node)
+    else:
+        # Side-effect: read content and verify hash.
+        rl.revision(node)
+
+
 @attr.s(slots=True, frozen=True)
 class _revisioninfo(object):
     """Information about a revision that allows building its fulltext
@@ -2914,11 +2924,7 @@
                 if skipflags:
                     skipflags &= self.flags(rev)
 
-                if skipflags:
-                    state[b'skipread'].add(node)
-                else:
-                    # Side-effect: read content and verify hash.
-                    self.revision(node)
+                _verify_revision(self, skipflags, state, node)
 
                 l1 = self.rawsize(rev)
                 l2 = len(self.rawdata(node))



To: mharbison72, indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list