mercurial/match.py
changeset 32605 e6ff007e107e
parent 32557 3fdcc34c0aba
child 32650 783394c0c978
--- a/mercurial/match.py	Wed May 31 11:41:54 2017 -0700
+++ b/mercurial/match.py	Thu Jun 01 00:40:52 2017 -0700
@@ -175,6 +175,9 @@
 def always(root, cwd):
     return alwaysmatcher(root, cwd)
 
+def never(root, cwd):
+    return nevermatcher(root, cwd)
+
 def badmatch(match, badfn):
     """Make a copy of the given matcher, replacing its bad method with the given
     one.
@@ -339,6 +342,25 @@
     def __repr__(self):
         return '<alwaysmatcher>'
 
+class nevermatcher(basematcher):
+    '''Matches nothing.'''
+
+    def __init__(self, root, cwd, badfn=None, relativeuipath=False):
+        super(nevermatcher, self).__init__(root, cwd, badfn,
+                                           relativeuipath=relativeuipath)
+
+    def always(self):
+        return False
+
+    def matchfn(self, f):
+        return False
+
+    def visitdir(self, dir):
+        return False
+
+    def __repr__(self):
+        return '<nevermatcher>'
+
 class patternmatcher(basematcher):
 
     def __init__(self, root, cwd, kindpats, ctx=None, listsubrepos=False,