changeset 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 8a0c47982ade
files mercurial/verify.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/verify.py	Wed Mar 29 14:45:01 2017 -0700
+++ b/mercurial/verify.py	Wed Mar 29 14:49:14 2017 -0700
@@ -430,7 +430,8 @@
                     l = len(fl.read(n))
                     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)
                 except error.CensoredNodeError: