[PATCH] match: simplify nevermatcher

Martin von Zweigbergk martinvonz at google.com
Thu Jun 1 15:38:17 UTC 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1496331081 25200
#      Thu Jun 01 08:31:21 2017 -0700
# Node ID 48de4aeae6788ae9a7f0c55e8c8e834ddc98b047
# Parent  899dae771ddc4f993005485050545cd85599974a
match: simplify nevermatcher

Most of it does the same as its superclass, so it can simply be
removed. It also seems to make more sense for it to use relative
paths, as we do for everything except alwaysmatcher, although
nevermatcher.uipath() will probably never get called anyway, so it
won't matter.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -153,8 +153,7 @@
                                listsubrepos=listsubrepos, badfn=badfn)
     else:
         # It's a little strange that no patterns means to match everything.
-        # Consider changing this to match nothing (probably adding a
-        # "nevermatcher").
+        # Consider changing this to match nothing (probably using nevermatcher).
         m = alwaysmatcher(root, cwd, badfn)
 
     if include:
@@ -345,18 +344,8 @@
 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 __init__(self, root, cwd, badfn=None):
+        super(nevermatcher, self).__init__(root, cwd, badfn)
 
     def __repr__(self):
         return '<nevermatcher>'


More information about the Mercurial-devel mailing list