##// END OF EJS Templates
verify: add a config option to skip certain flag processors...
Jun Wu -
r32288:a2ab9ebc default
parent child Browse files
Show More
@@ -49,6 +49,8 b' class verifier(object):'
49 self.lrugetctx = util.lrucachefunc(repo.changectx)
49 self.lrugetctx = util.lrucachefunc(repo.changectx)
50 self.refersmf = False
50 self.refersmf = False
51 self.fncachewarned = False
51 self.fncachewarned = False
52 # developer config: verify.skipflags
53 self.skipflags = repo.ui.configint('verify', 'skipflags')
52
54
53 def warn(self, msg):
55 def warn(self, msg):
54 self.ui.warn(msg + "\n")
56 self.ui.warn(msg + "\n")
@@ -427,8 +429,12 b' class verifier(object):'
427 # 2. hash check: depending on flag processor, we may need to
429 # 2. hash check: depending on flag processor, we may need to
428 # use either "text" (external), or "rawtext" (in revlog).
430 # use either "text" (external), or "rawtext" (in revlog).
429 try:
431 try:
430 fl.read(n) # side effect: read content and do checkhash
432 skipflags = self.skipflags
431 rp = fl.renamed(n)
433 if skipflags:
434 skipflags &= fl.flags(i)
435 if not skipflags:
436 fl.read(n) # side effect: read content and do checkhash
437 rp = fl.renamed(n)
432 # the "L1 == L2" check
438 # the "L1 == L2" check
433 l1 = fl.rawsize(i)
439 l1 = fl.rawsize(i)
434 l2 = len(fl.revision(n, raw=True))
440 l2 = len(fl.revision(n, raw=True))
@@ -317,3 +317,47 b' test revlog format 0'
317 checking files
317 checking files
318 1 files, 1 changesets, 1 total revisions
318 1 files, 1 changesets, 1 total revisions
319 $ cd ..
319 $ cd ..
320
321 test flag processor and skipflags
322
323 $ hg init skipflags
324 $ cd skipflags
325 $ cat >> .hg/hgrc <<EOF
326 > [extensions]
327 > flagprocesor=$RUNTESTDIR/flagprocessorext.py
328 > EOF
329 $ echo '[BASE64]content' > base64
330 $ hg commit -Aqm 'flag processor content' base64
331 $ hg verify
332 checking changesets
333 checking manifests
334 crosschecking files in changesets and manifests
335 checking files
336 1 files, 1 changesets, 1 total revisions
337
338 $ cat >> $TESTTMP/break-base64.py <<EOF
339 > from __future__ import absolute_import
340 > import base64
341 > base64.b64decode=lambda x: x
342 > EOF
343 $ cat >> .hg/hgrc <<EOF
344 > breakbase64=$TESTTMP/break-base64.py
345 > EOF
346
347 $ hg verify
348 checking changesets
349 checking manifests
350 crosschecking files in changesets and manifests
351 checking files
352 base64@0: unpacking 794cee7777cb: integrity check failed on data/base64.i:0
353 1 files, 1 changesets, 1 total revisions
354 1 integrity errors encountered!
355 (first damaged changeset appears to be 0)
356 [1]
357 $ hg verify --config verify.skipflags=2147483647
358 checking changesets
359 checking manifests
360 crosschecking files in changesets and manifests
361 checking files
362 1 files, 1 changesets, 1 total revisions
363
General Comments 0
You need to be logged in to leave comments. Login now