verify: document the `checkentry` method
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 06 Mar 2019 12:18:04 +0100
changeset 41875 00c9fde75c1a
parent 41874 4da2261e949b
child 41876 9e737ca539f6
verify: document the `checkentry` method This method checks various core propertes of a revision. We document inputs, outputs and the checks performed.
mercurial/verify.py
--- a/mercurial/verify.py	Wed Mar 06 11:43:21 2019 +0100
+++ b/mercurial/verify.py	Wed Mar 06 12:18:04 2019 +0100
@@ -94,6 +94,25 @@
             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
+        - node:        the revision node id
+        - seen:     nodes previously seen for this revlog
+        - linkrevs: [changelog-revisions] introducing "node"
+        - 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):