Mercurial > public > mercurial-scm > hg
comparison mercurial/verify.py @ 31762:dff03f68ef11
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 29 Mar 2017 14:49:14 -0700 |
parents | b044c339c06d |
children | 8a137ef6e5da |
comparison
equal
deleted
inserted
replaced
31761:b044c339c06d | 31762:dff03f68ef11 |
---|---|
428 # use either "text" (external), or "rawtext" (in revlog). | 428 # use either "text" (external), or "rawtext" (in revlog). |
429 try: | 429 try: |
430 l = len(fl.read(n)) | 430 l = len(fl.read(n)) |
431 rp = fl.renamed(n) | 431 rp = fl.renamed(n) |
432 if l != fl.size(i): | 432 if l != fl.size(i): |
433 if len(fl.revision(n)) != fl.size(i): | 433 # the "L1 == L2" check |
434 if len(fl.revision(n, raw=True)) != fl.rawsize(i): | |
434 self.err(lr, _("unpacked size is %s, %s expected") % | 435 self.err(lr, _("unpacked size is %s, %s expected") % |
435 (l, fl.size(i)), f) | 436 (l, fl.size(i)), f) |
436 except error.CensoredNodeError: | 437 except error.CensoredNodeError: |
437 # experimental config: censor.policy | 438 # experimental config: censor.policy |
438 if ui.config("censor", "policy", "abort") == "abort": | 439 if ui.config("censor", "policy", "abort") == "abort": |