[PATCH] verify: check raw revision size

Jun Wu quark at fb.com
Tue Mar 28 21:27:38 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490736238 25200
#      Tue Mar 28 14:23:58 2017 -0700
# Node ID ce672245b46749351a71701d2fa6c786d9b2eebb
# Parent  331cc4433efe0d897bb16ad4ff08a3fbe850869b
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r ce672245b467
verify: check raw revision size

The code is assuming revlog.size(rev) == len(revlog.revision(rev)). Since
revlog.size(rev) returns the raw size, before running any flag processor,
the code should be updated to fetch the revision with raw=True.

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


More information about the Mercurial-devel mailing list