diff mercurial/match.py @ 32500:369c2d5eeea3

match: remove support for exact matching from main matcher class Exact matching is now handled by the exactmatcher class. We can safely remove _files from the __repr__() implementation, because even though the field is set, the patternspat field is enough for the representation to be unambiguous (which was not the case when the matcher could handle exact matches).
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 18 May 2017 23:39:39 -0700
parents a3583852861a
children 7095dbc266e3
line wrap: on
line diff
--- a/mercurial/match.py	Wed May 17 09:26:15 2017 -0700
+++ b/mercurial/match.py	Thu May 18 23:39:39 2017 -0700
@@ -146,17 +146,17 @@
         m = exactmatcher(root, cwd, patterns, badfn)
     else:
         m = matcher(root, cwd, normalize, patterns, include=None,
-                    default=default, exact=exact, auditor=auditor, ctx=ctx,
+                    default=default, auditor=auditor, ctx=ctx,
                     listsubrepos=listsubrepos, warn=warn, badfn=badfn)
     if include:
         im = matcher(root, cwd, normalize, [], include=include, default=default,
-                     exact=False, auditor=auditor, ctx=ctx,
-                     listsubrepos=listsubrepos, warn=warn, badfn=None)
+                     auditor=auditor, ctx=ctx, listsubrepos=listsubrepos,
+                     warn=warn, badfn=None)
         m = intersectmatchers(m, im)
     if exclude:
         em = matcher(root, cwd, normalize, [], include=exclude, default=default,
-                     exact=False, auditor=auditor, ctx=ctx,
-                     listsubrepos=listsubrepos, warn=warn, badfn=None)
+                     auditor=auditor, ctx=ctx, listsubrepos=listsubrepos,
+                     warn=warn, badfn=None)
         m = differencematcher(m, em)
     return m
 
@@ -314,7 +314,7 @@
 class matcher(basematcher):
 
     def __init__(self, root, cwd, normalize, patterns, include=None,
-                 default='glob', exact=False, auditor=None, ctx=None,
+                 default='glob', auditor=None, ctx=None,
                  listsubrepos=False, warn=None, badfn=None):
         super(matcher, self).__init__(root, cwd, badfn,
                                       relativeuipath=bool(include or patterns))
@@ -342,13 +342,7 @@
             self._includeroots.update(roots)
             self._includedirs.update(dirs)
             matchfns.append(im)
-        if exact:
-            if isinstance(patterns, list):
-                self._files = patterns
-            else:
-                self._files = list(patterns)
-            matchfns.append(self.exact)
-        elif patterns:
+        if patterns:
             kindpats = normalize(patterns, default, root, cwd, auditor, warn)
             if not _kindpatsalwaysmatch(kindpats):
                 self._files = _explicitfiles(kindpats)
@@ -402,12 +396,9 @@
     def always(self):
         return self._always
 
-    def isexact(self):
-        return self.matchfn == self.exact
-
     def __repr__(self):
-        return ('<matcher files=%r, patterns=%r, includes=%r>' %
-                (self._files, self.patternspat, self.includepat))
+        return ('<matcher patterns=%r, includes=%r>' %
+                (self.patternspat, self.includepat))
 
 class exactmatcher(basematcher):
     '''Matches the input files exactly. They are interpreted as paths, not