diff mercurial/verify.py @ 42197:57539e5ea2e0

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Apr 2019 01:12:21 +0200
parents 9c5a6af74afa
children 496ac8a02380
line wrap: on
line diff
--- a/mercurial/verify.py	Sat Apr 13 23:18:56 2019 -0700
+++ b/mercurial/verify.py	Wed Apr 17 01:12:21 2019 +0200
@@ -22,9 +22,12 @@
     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 @@
     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