[PATCH 09 of 15 RFC] verify: treat parent node existing in revlog as valid at partial verification

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Oct 3 11:39:06 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349281445 -32400
# Node ID 6998d864458102fef37e9c247e728f023738fcd7
# Parent  2575408c7af16acad6df1827bfa460263ace8998
verify: treat parent node existing in revlog as valid at partial verification

At whole verification, each revlogs (changelog, manifest and filelogs)
are scanned from head to tail sequentially, and nodes of scanned
entries are stored into "seen". So, parent nodes of scan target should
be contained in "seen".

In the other hand, at partial verification, parents of target entry
may not be scanned before, because only specified revisions are
verified.

This patch treats parent nodes of target entries as valid, if node
exists in revlog at partial verification.

diff -r 2575408c7af1 -r 6998d8644581 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
@@ -79,8 +79,10 @@
 
     if partially:
         knownrev = lambda lr, lrs: lr < len(repo)
+        knownnode = lambda l, n, s: n in s or l.hasnode(n)
     else:
         knownrev = lambda lr, lrs: lr in lrs
+        knownnode = lambda l, n, s: n in s
 
     def checkentry(obj, i, node, seen, linkrevs, f):
         lr = obj.linkrev(obj.rev(node))
@@ -103,10 +105,10 @@
 
         try:
             p1, p2 = obj.parents(node)
-            if p1 not in seen and p1 != nullid:
+            if not knownnode(obj, p1, seen) and p1 != nullid:
                 err(lr, _("unknown parent 1 %s of %s") %
                     (short(p1), short(node)), f)
-            if p2 not in seen and p2 != nullid:
+            if not knownnode(obj, p2, seen) and p2 != nullid:
                 err(lr, _("unknown parent 2 %s of %s") %
                     (short(p2), short(node)), f)
         except Exception, inst:


More information about the Mercurial-devel mailing list