# HG changeset patch # User Pierre-Yves David # Date 2019-04-16 23:12:21 # Node ID 57539e5ea2e0fd17462e80c6b897bd30c1b634ef # Parent f2fe7cf4ebb610969ed3a05370aaa1e291f06823 verify: introduce a notion of "level" Some checks are slower than others, to help the user to run the checks he needs, we are about to introduce new flag to select faster vs deeper runs. This put the scaffolding in place to do this. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1092,9 +1092,9 @@ def outgoing(ui, repo, dest, opts): recurse() return 0 # exit code is zero since we found outgoing changes -def verify(repo): +def verify(repo, level=None): """verify the consistency of a repository""" - ret = verifymod.verify(repo) + ret = verifymod.verify(repo, level=level) # Broken subrepo references in hidden csets don't seem worth worrying about, # since they can't be pushed/pulled, and --hidden can be used if they are a diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -22,9 +22,12 @@ from . import ( util, ) -def verify(repo): +VERIFY_DEFAULT = 0 + +def verify(repo, level=None): with repo.lock(): - return verifier(repo).verify() + v = verifier(repo, level) + return v.verify() def _normpath(f): # under hg < 2.4, convert didn't sanitize paths properly, so a @@ -34,10 +37,13 @@ def _normpath(f): return f class verifier(object): - def __init__(self, repo): + def __init__(self, repo, level=None): self.repo = repo.unfiltered() self.ui = repo.ui self.match = repo.narrowmatch() + if level is None: + level = VERIFY_DEFAULT + self._level = level self.badrevs = set() self.errors = 0 self.warnings = 0