From 2724c6060153c5494b030e5fece6f6d7d18d84a7 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Thu, 25 May 2017 09:52:56 -0700 Subject: [PATCH] match: override matchfn() the usual way in subdirmatcher --- mercurial/match.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mercurial/match.py b/mercurial/match.py index 381fb963fd..d55fabc0ac 100644 --- a/mercurial/match.py +++ b/mercurial/match.py @@ -462,12 +462,6 @@ class subdirmatcher(basematcher): 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 @@ class subdirmatcher(basematcher): 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