Patchwork [10,of,18,"] verify: document the `checkentry` method

login
register
mail settings
Submitter Pierre-Yves David
Date March 6, 2019, 4:29 p.m.
Message ID <51efb7d6f032202abaea.1551889766@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39105/
State Accepted
Headers show

Comments

Pierre-Yves David - March 6, 2019, 4:29 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1551871084 -3600
#      Wed Mar 06 12:18:04 2019 +0100
# Node ID 51efb7d6f032202abaeaed8bf1b3a13a9f426cdd
# Parent  8092d6de83c346e069322eede70baa05896744d3
# EXP-Topic verify
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 51efb7d6f032
verify: document the `checkentry` method

This method checks various core propertes of a revision. We document inputs, outputs
and the checks performed.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -94,6 +94,25 @@  class verifier(object):
             self._warn(_("warning: `%s' uses revlog format 0") % name)
 
     def checkentry(self, obj, i, node, seen, linkrevs, f):
+        """verify a single revlog entry
+
+        arguments are:
+        - obj:      the source revlog
+        - i:        the revision number
+        - n:        the revision node id
+        - seen:     nodes previously seen for this revlog
+        - linkrevs: [changelog-revisions] introducing "n"
+        - f:        string label ("changelog", "manifest", or filename)
+
+        Performs the following checks:
+        - linkrev points to an existing changelog revision,
+        - linkrev points to a changelog revision that introduces this revision,
+        - linkrev points to the lowest of these changesets,
+        - both parents exist in the revlog,
+        - the revision is not duplicated.
+
+        Return the linkrev of the revision (or None for changelog's revisions).
+        """
         lr = obj.linkrev(obj.rev(node))
         if lr < 0 or (self.havecl and lr not in linkrevs):
             if lr < 0 or lr >= len(self.repo.changelog):