[PATCH 14 of 15 RFC] verification: treat manifest linked to existing changelog as valid at partial verification

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


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349281445 -32400
# Node ID bd4beabe19aa68a70c545c7a3b77e42457df10e4
# Parent  a5079a83d663cb28a7fea8328abe155152a75044
verification: treat manifest linked to existing changelog as valid at partial verification

In some (not usual) cases at partial verification, there may be some
target manifest entries not linked to any of target changelog entries.

For example, in the case tested in test-strip-cross.t, "linkrev" of
each changelog(cl) and manifest(mf) entries changes as below through
stripping revision 3: "(N)" means "verification target".

  [initial]    =>  [intermediate] =>    [final]

  #  cl  mf          #  cl  mf          #  cl  mf
  ---------          ---------          ---------
  0   0   0          0   0   0          0   0   0
  1   1   3          1   1 ....         1   1  (1)
  2   2   1          2   2 : 3          2   2  (2)
  3   3   2         .......: 1          3  (4) (4)
  4   4   4          -   3   2
                     -   4   4

Manifest entries linked to revision 1 and 2 are also stripped
temporarily to strip changelog entry #3, and are restored by
"addchangegroup()".

In this case, revision 1 and 2 are not partial verification target,
because they are not newly added by "addchangegroup()", so
"mflinkrevs" doesn't contain nodes of such manifest entries.

This causes "(manifest) not in changesets" for 1 and 2 of manifest.

This patch treats manifest nodes as valid ones, if the manifest entry
is referred from existing changelog entry correctly at partial
verification.

diff -r a5079a83d663 -r bd4beabe19aa 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
@@ -168,6 +168,12 @@
         # Do not check manifest if there are only changelog entries with
         # null manifests.
         checklog(mf, "manifest", 0)
+
+    if partially:
+        referredmfn = lambda n, lr: cl.read(lr)[0] == n
+    else:
+        referredmfn = lambda n, lr: False
+
     total = len(mfrevs)
     count = 0
     for i in mfrevs:
@@ -177,7 +183,7 @@
         lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")
         if n in mflinkrevs:
             del mflinkrevs[n]
-        else:
+        elif not referredmfn(n, lr):
             err(lr, _("%s not in changesets") % short(n), "manifest")
 
         try:


More information about the Mercurial-devel mailing list