[PATCH 12 of 15 RFC] verify: treat every files as known at partial verification

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

# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349281445 -32400
# Node ID 11804c09c00c27806145bace9f0506c6a2f03e90
# Parent  b54e1c7827847f115d0291daeec8a16f3a6bb170
verify: treat every files as known at partial verification

At whole repository verification, changelog/files crosschecking
consists of steps below:

    1. put files changed in verification target chanagelog entries
       into "filelinkrevs"
    2. put files contained in verification target manifest entries
       into "filenodes"
    3. treat files existing in "filelinkrevs" but not in "filenodes"
       as "in changeset but not in manifest"

Changelog entries removing files put also removed files into
 "filelinkrevs", because such entries treat removed files as "files
 changed in themselves".

In the other hand, manifest entries don't put removed files into
"filenodes", because such entries don't contains removed files.

So, in such case at partial verification, files removed in
verification target changelog entries are still left in step (3), even
though they are valid.

This patch treats all files as known ones for crosschecking at partial
verification for performance reason: it is also supposed that validity
of each (removed) files is not responsibility of partial verification.

diff -r b54e1c782784 -r 11804c09c00c 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
@@ -194,8 +194,10 @@
     if partially:
         knownmfn = lambda mfn: mf.hasnode(mfn)
+        knownfile = lambda f: True
         knownmfn = lambda mfn: False
+        knownfile = lambda f: f in filenodes
     total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes)
     count = 0
@@ -212,7 +214,7 @@
         for f in sorted(filelinkrevs):
             count += 1
             ui.progress(_('crosschecking'), count, total=total)
-            if f not in filenodes:
+            if not knownfile(f):
                 lr = filelinkrevs[f][0]
                 err(lr, _("in changeset but not in manifest"), f)

More information about the Mercurial-devel mailing list