diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -49,6 +49,8 @@ class verifier(object): self.lrugetctx = util.lrucachefunc(repo.changectx) self.refersmf = False self.fncachewarned = False + # developer config: verify.skipflags + self.skipflags = repo.ui.configint('verify', 'skipflags') def warn(self, msg): self.ui.warn(msg + "\n") @@ -427,8 +429,12 @@ class verifier(object): # 2. hash check: depending on flag processor, we may need to # use either "text" (external), or "rawtext" (in revlog). try: - fl.read(n) # side effect: read content and do checkhash - rp = fl.renamed(n) + skipflags = self.skipflags + if skipflags: + skipflags &= fl.flags(i) + if not skipflags: + fl.read(n) # side effect: read content and do checkhash + rp = fl.renamed(n) # the "L1 == L2" check l1 = fl.rawsize(i) l2 = len(fl.revision(n, raw=True)) diff --git a/tests/test-verify.t b/tests/test-verify.t --- a/tests/test-verify.t +++ b/tests/test-verify.t @@ -317,3 +317,47 @@ test revlog format 0 checking files 1 files, 1 changesets, 1 total revisions $ cd .. + +test flag processor and skipflags + + $ hg init skipflags + $ cd skipflags + $ cat >> .hg/hgrc < [extensions] + > flagprocesor=$RUNTESTDIR/flagprocessorext.py + > EOF + $ echo '[BASE64]content' > base64 + $ hg commit -Aqm 'flag processor content' base64 + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 1 changesets, 1 total revisions + + $ cat >> $TESTTMP/break-base64.py < from __future__ import absolute_import + > import base64 + > base64.b64decode=lambda x: x + > EOF + $ cat >> .hg/hgrc < breakbase64=$TESTTMP/break-base64.py + > EOF + + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + base64@0: unpacking 794cee7777cb: integrity check failed on data/base64.i:0 + 1 files, 1 changesets, 1 total revisions + 1 integrity errors encountered! + (first damaged changeset appears to be 0) + [1] + $ hg verify --config verify.skipflags=2147483647 + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 1 changesets, 1 total revisions +