[PATCH 08 of 15 RFC] verify: treat revision linking to existing ones as valid at partial verification

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Oct 3 16:39:05 UTC 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349281445 -32400
# Node ID 2575408c7af16acad6df1827bfa460263ace8998
# Parent  3ed256772546976661ffa4f45b5872aa1f71968f
verify: treat revision linking to existing ones as valid at partial verification

At whole verification, all valid revision numbers are stored into
"mflinkrevs" and "filelinkrevs", so these can be used to check
"linkrev" correctness of each entries in manifest and filelogs.

In the other hand, at partial verification, only version numbers of
verification target revisions are stored into "mflinkrevs" and
"filelinkrevs".

"linkrev" information of each manifest and filelogs entries only refer
the revision which newly created themselves, so "linkrev" may be other
than ones of verification target revisions: for example, revision
creating new named branch shares manifest entry (and filelog entries)
with parent of it.

This patch treats revision linking as valid, if linked revisions
really exist at partial verification.

diff -r 3ed256772546 -r 2575408c7af1 mercurial/verify.py
--- a/mercurial/verify.py	Thu Oct 04 01:24:05 2012 +0900
+++ b/mercurial/verify.py	Thu Oct 04 01:24:05 2012 +0900
@@ -77,9 +77,14 @@
         elif revlogv1:
             warn(_("warning: `%s' uses revlog format 0") % name)
 
+    if partially:
+        knownrev = lambda lr, lrs: lr < len(repo)
+    else:
+        knownrev = lambda lr, lrs: lr in lrs
+
     def checkentry(obj, i, node, seen, linkrevs, f):
         lr = obj.linkrev(obj.rev(node))
-        if lr < 0 or (havecl and lr not in linkrevs):
+        if lr < 0 or (havecl and not knownrev(lr, linkrevs)):
             if lr < 0 or lr >= len(cl):
                 msg = _("rev %d points to nonexistent changeset %d")
             else:



More information about the Mercurial-devel mailing list