[PATCH 2 of 2] verify: fix length check

Jun Wu quark at fb.com
Wed Mar 29 17:52:00 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490824154 25200
#      Wed Mar 29 14:49:14 2017 -0700
# Node ID ab735d6798fb133efdc2be8a441b51e7ba4d547b
# Parent  1f7890370b5437466534cbd0a313d21671dade03
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r ab735d6798fb
verify: fix length check

According to the document added above, we should check L1 == L2, and the
only way to get L1 in all cases is to call "rawsize()", and the only way to
get L2 is to call "revision(raw=True)". Therefore the fix.

Meanwhile there are still a lot of things about flagprocessor broken in
revlog.py. Tests will be added after revlog.py gets fixed.

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -425,5 +425,6 @@ class verifier(object):
                     rp = fl.renamed(n)
                     if l != fl.size(i):
-                        if len(fl.revision(n)) != fl.size(i):
+                        # the "L1 == L2" check
+                        if len(fl.revision(n, raw=True)) != fl.rawsize(i):
                             self.err(lr, _("unpacked size is %s, %s expected") %
                                      (l, fl.size(i)), f)


More information about the Mercurial-devel mailing list