narrow: move support for `hg verify` into core
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 28 Sep 2018 12:05:48 -0700
changeset 39938 fec944719324
parent 39937 84092edd5c88
child 39943 a6f8ab537908
narrow: move support for `hg verify` into core Differential Revision: https://phab.mercurial-scm.org/D4824
hgext/narrow/__init__.py
mercurial/verify.py
--- a/hgext/narrow/__init__.py	Fri Sep 28 13:55:17 2018 -0700
+++ b/hgext/narrow/__init__.py	Fri Sep 28 12:05:48 2018 -0700
@@ -15,11 +15,9 @@
 testedwith = 'ships-with-hg-core'
 
 from mercurial import (
-    extensions,
     localrepo,
     registrar,
     repository,
-    verify as verifymod,
 )
 
 from . import (
@@ -70,15 +68,5 @@
         narrowpatch.setup(repo)
         narrowwirepeer.reposetup(repo)
 
-def _verifierinit(orig, self, repo, matcher=None):
-    # The verifier's matcher argument was desgined for narrowhg, so it should
-    # be None from core. If another extension passes a matcher (unlikely),
-    # we'll have to fail until matchers can be composed more easily.
-    assert matcher is None
-    orig(self, repo, repo.narrowmatch())
-
-def extsetup(ui):
-    extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit)
-
 templatekeyword = narrowtemplates.templatekeyword
 revsetpredicate = narrowtemplates.revsetpredicate
--- a/mercurial/verify.py	Fri Sep 28 13:55:17 2018 -0700
+++ b/mercurial/verify.py	Fri Sep 28 12:05:48 2018 -0700
@@ -19,7 +19,6 @@
     error,
     pycompat,
     revlog,
-    scmutil,
     util,
 )
 
@@ -35,12 +34,10 @@
     return f
 
 class verifier(object):
-    # The match argument is always None in hg core, but e.g. the narrowhg
-    # extension will pass in a matcher here.
-    def __init__(self, repo, match=None):
+    def __init__(self, repo):
         self.repo = repo.unfiltered()
         self.ui = repo.ui
-        self.match = match or scmutil.matchall(repo)
+        self.match = repo.narrowmatch()
         self.badrevs = set()
         self.errors = 0
         self.warnings = 0