mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
match: override matchfn() the usual way in subdirmatcher
This commit is contained in:
parent
cb783946fc
commit
2724c60601
@ -462,12 +462,6 @@ class subdirmatcher(basematcher):
|
|||||||
if matcher.prefix():
|
if matcher.prefix():
|
||||||
self._always = any(f == path for f in matcher._files)
|
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):
|
def bad(self, f, msg):
|
||||||
self._matcher.bad(self._path + "/" + f, msg)
|
self._matcher.bad(self._path + "/" + f, msg)
|
||||||
|
|
||||||
@ -480,6 +474,13 @@ class subdirmatcher(basematcher):
|
|||||||
def uipath(self, f):
|
def uipath(self, f):
|
||||||
return self._matcher.uipath(self._path + "/" + 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):
|
def visitdir(self, dir):
|
||||||
if dir == '.':
|
if dir == '.':
|
||||||
dir = self._path
|
dir = self._path
|
||||||
|
Loading…
Reference in New Issue
Block a user