[PATCH 2 of 2 V2] verify: fix length check

Jun Wu quark at fb.com
Sun Apr 2 20:24:56 EDT 2017


Excerpts from Yuya Nishihara's message of 2017-04-02 16:33:38 +0900:
> On Thu, 30 Mar 2017 14:51:15 -0700, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1490824154 25200
> > #      Wed Mar 29 14:49:14 2017 -0700
> > # Node ID 35902a0e3f38c766666a66d0dfbf76ec72091832
> > # Parent  17b41390f4912a4c18538d778837bc2cf4a1be92
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 35902a0e3f38
> > verify: fix length check
> 
> Looks good. I'll queue it.
> 
> > diff --git a/mercurial/verify.py b/mercurial/verify.py
> > --- a/mercurial/verify.py
> > +++ b/mercurial/verify.py
> > @@ -431,5 +431,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)
> 
> Perhaps we can get rid of 'l != fl.size(i)', which just checks API-level
> inconsistency. This was introduced at e79a8f36c2a5, which said "check
> unpacked size field." And IIUC, rawsize() is the unpacked size field.

I was aware of the condition is wrong. I'm thinking about a new "raw" flag
to control whether to verify non-raw contents. So people can choose a full
verify which requires downloading all large files, or just a shallow verify
skipping them.

I limited flag processor patches to a minimal to get the most critical bugs
fixed first. Now I can send nice-to-have follow-ups. Thanks!


More information about the Mercurial-devel mailing list