Patchwork [02,of,17] match: override matchfn() the usual way in subdirmatcher

login
register
mail settings
Submitter via Mercurial-devel
Date May 25, 2017, 6:24 p.m.
Message ID <8446a121f00de0575739.1495736683@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20904/
State Accepted
Headers show

Comments

via Mercurial-devel - May 25, 2017, 6:24 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1495731176 25200
#      Thu May 25 09:52:56 2017 -0700
# Node ID 8446a121f00de0575739e5285af58d564119a052
# Parent  e9e0159ca48dd1771b53c3091c7def2f6f77d5bd
match: override matchfn() the usual way in subdirmatcher

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -462,12 +462,6 @@ 
         if matcher.prefix():
             self._always = any(f == path for f in matcher._files)
 
-        # Some information is lost in the superclass's constructor, so we
-        # can not accurately create the matching function for the subdirectory
-        # from the inputs. Instead, we override matchfn() and visitdir() to
-        # call the original matcher with the subdirectory path prepended.
-        self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn)
-
     def bad(self, f, msg):
         self._matcher.bad(self._path + "/" + f, msg)
 
@@ -480,6 +474,13 @@ 
     def uipath(self, f):
         return self._matcher.uipath(self._path + "/" + f)
 
+    def matchfn(self, f):
+        # Some information is lost in the superclass's constructor, so we
+        # can not accurately create the matching function for the subdirectory
+        # from the inputs. Instead, we override matchfn() and visitdir() to
+        # call the original matcher with the subdirectory path prepended.
+        return self._matcher.matchfn(self._path + "/" + f)
+
     def visitdir(self, dir):
         if dir == '.':
             dir = self._path