Mercurial > public > mercurial-scm > hg
comparison mercurial/verify.py @ 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 | 8a137ef6e5da |
children | 0407a51b9d8c |
comparison
equal
deleted
inserted
replaced
32287:df3cf9422e1b | 32288:a2ab9ebcd85b |
---|---|
47 self.havemf = len(repo.manifestlog._revlog) > 0 | 47 self.havemf = len(repo.manifestlog._revlog) > 0 |
48 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0 | 48 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0 |
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") |
55 self.warnings += 1 | 57 self.warnings += 1 |
56 | 58 |
425 # Checks needed to be done: | 427 # Checks needed to be done: |
426 # 1. length check: L1 == L2, in all cases. | 428 # 1. length check: L1 == L2, in all cases. |
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)) |
435 if l1 != l2: | 441 if l1 != l2: |
436 self.err(lr, _("unpacked size is %s, %s expected") % | 442 self.err(lr, _("unpacked size is %s, %s expected") % |