verify: fix length check
authorJun Wu <quark@fb.com>
Wed, 29 Mar 2017 14:49:14 -0700
changeset 31762 dff03f68ef11
parent 31761 b044c339c06d
child 31763 8a0c47982ade
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.
mercurial/verify.py
--- 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: