diff hgext/sparse.py @ 49356:a87443d4aec0

sparse: directly inline the `walk` wrapping core is already aware of sparse, so lets move the handful of line of code that deal with it in `dirstate.walk` for the sake of simplicity.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 11 Jun 2022 00:58:41 +0200
parents 0540c1628fd4
children 5b7a10ddb42f
line wrap: on
line diff
--- a/hgext/sparse.py	Sat Jun 11 00:56:50 2022 +0200
+++ b/hgext/sparse.py	Sat Jun 11 00:58:41 2022 +0200
@@ -81,7 +81,6 @@
     error,
     extensions,
     logcmdutil,
-    match as matchmod,
     merge as mergemod,
     pycompat,
     registrar,
@@ -213,18 +212,6 @@
     and to prevent modifications to files outside the checkout.
     """
 
-    def walk(orig, self, match, subrepos, unknown, ignored, full=True):
-        # hack to not exclude explicitly-specified paths so that they can
-        # be warned later on e.g. dirstate.add()
-        sparse_matcher = self._sparsematcher
-        if sparse_matcher is not None:
-            em = matchmod.exact(match.files())
-            sm = matchmod.unionmatcher([self._sparsematcher, em])
-            match = matchmod.intersectmatchers(match, sm)
-        return orig(self, match, subrepos, unknown, ignored, full)
-
-    extensions.wrapfunction(dirstate.dirstate, b'walk', walk)
-
     # dirstate.rebuild should not add non-matching files
     def _rebuild(orig, self, parent, allfiles, changedfiles=None):
         matcher = self._sparsematcher