diff tests/test-verify.t @ 32288:a2ab9ebcd85b

verify: add a config option to skip certain flag processors Previously, "hg verify" verifies everything, which could be undesirable when there are expensive flag processor contents. This patch adds a "verify.skipflags" developer config. A flag processor will be skipped if (flag & verify.skipflags) == 0. In the LFS usecase, that means "hg verify --config verify.skipflags=8192" will not download all LFS blobs, which could be too large to be stored locally. Note: "renamed" is also skipped since its default implementation may call filelog.data() which will trigger the flag processor.
author Jun Wu <quark@fb.com>
date Sun, 14 May 2017 09:38:06 -0700
parents c059286a0f9c
children b6612d8579e4
line wrap: on
line diff
--- a/tests/test-verify.t	Mon May 15 09:35:27 2017 -0700
+++ b/tests/test-verify.t	Sun May 14 09:38:06 2017 -0700
@@ -317,3 +317,47 @@
   checking files
   1 files, 1 changesets, 1 total revisions
   $ cd ..
+
+test flag processor and skipflags
+
+  $ hg init skipflags
+  $ cd skipflags
+  $ cat >> .hg/hgrc <<EOF
+  > [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 <<EOF
+  > from __future__ import absolute_import
+  > import base64
+  > base64.b64decode=lambda x: x
+  > EOF
+  $ cat >> .hg/hgrc <<EOF
+  > 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
+