comparison tests/simplestorerepo.py @ 37417:76d2115cb817

verify: allow suppressing warnings about extra files The verifier issues warnings when the set of files in .hg/store doesn't align with the set of files that are advertised via repo.file(f).files() for all files seen in ctx.files() changelog traversal. This logic is reasonable for a default implementation. But some stores may have extra files whose presence is harmless. Or those stores may not have the same transaction rollback semantics that unlink files as other stores. This commit adds support for disabling the warning for orphaned files. The simple store extension has been taught to set this flag. Differential Revision: https://phab.mercurial-scm.org/D3097
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 04 Apr 2018 14:11:43 -0700
parents c2c8962a9465
children 06674aab2b4c
comparison
equal deleted inserted replaced
37416:7542e97c7867 37417:76d2115cb817
33 localrepo, 33 localrepo,
34 mdiff, 34 mdiff,
35 pycompat, 35 pycompat,
36 revlog, 36 revlog,
37 store, 37 store,
38 verify,
38 ) 39 )
39 40
40 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for 41 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
41 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should 42 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
42 # be specifying the version(s) of Mercurial they are tested with, or 43 # be specifying the version(s) of Mercurial they are tested with, or
654 if REQUIREMENT not in requirements: 655 if REQUIREMENT not in requirements:
655 return orig(requirements, path, vfstype) 656 return orig(requirements, path, vfstype)
656 657
657 return simplestore(path, vfstype) 658 return simplestore(path, vfstype)
658 659
660 def verifierinit(orig, self, *args, **kwargs):
661 orig(self, *args, **kwargs)
662
663 # We don't care that files in the store don't align with what is
664 # advertised. So suppress these warnings.
665 self.warnorphanstorefiles = False
666
659 def extsetup(ui): 667 def extsetup(ui):
660 localrepo.featuresetupfuncs.add(featuresetup) 668 localrepo.featuresetupfuncs.add(featuresetup)
661 669
662 extensions.wrapfunction(localrepo, 'newreporequirements', 670 extensions.wrapfunction(localrepo, 'newreporequirements',
663 newreporequirements) 671 newreporequirements)
664 extensions.wrapfunction(store, 'store', makestore) 672 extensions.wrapfunction(store, 'store', makestore)
673 extensions.wrapfunction(verify.verifier, '__init__', verifierinit)