diff mercurial/match.py @ 33447:6f4e5e5940a5

match: write forceincludematcher using unionmatcher The forceincludematcher is simply a unionmatcher of a includematcher (matching paths recursively) with the given matcher. Since the forceincludematcher is only used by sparse, move it there. I don't have a good sparse repo setup to test performance impact on. Differential Revision: https://phab.mercurial-scm.org/D57
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 07 Jul 2017 14:39:59 -0700
parents 6aa643762641
children 04be8aec44a8
line wrap: on
line diff
--- a/mercurial/match.py	Wed Jul 12 13:57:03 2017 -0700
+++ b/mercurial/match.py	Fri Jul 07 14:39:59 2017 -0700
@@ -647,20 +647,6 @@
         return ('<subdirmatcher path=%r, matcher=%r>' %
                 (self._path, self._matcher))
 
-class forceincludematcher(basematcher):
-    """A matcher that returns true for any of the forced includes before testing
-    against the actual matcher."""
-    def __init__(self, matcher, includes):
-        self._matcher = matcher
-        self._includes = includes
-
-    def matchfn(self, f):
-        return f in self._includes or self._matcher(f)
-
-    def __repr__(self):
-        return ('<forceincludematcher matcher=%r, includes=%r>' %
-                (self._matcher, sorted(self._includes)))
-
 class unionmatcher(basematcher):
     """A matcher that is the union of several matchers."""
     def __init__(self, matchers):