mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
match: override matchfn instead of __call__ for consistency
The matchers that were recently moved into core from the sparse extension override __call__, while the previously existing matchers override matchfn. Let's switch to the latter for consistency.
This commit is contained in:
parent
57baaf4707
commit
0b6160ac83
@ -655,8 +655,8 @@ class forceincludematcher(basematcher):
|
||||
self._matcher = matcher
|
||||
self._includes = includes
|
||||
|
||||
def __call__(self, value):
|
||||
return value in self._includes or self._matcher(value)
|
||||
def matchfn(self, f):
|
||||
return f in self._includes or self._matcher(f)
|
||||
|
||||
def __repr__(self):
|
||||
return ('<forceincludematcher matcher=%r, includes=%r>' %
|
||||
@ -667,9 +667,9 @@ class unionmatcher(basematcher):
|
||||
def __init__(self, matchers):
|
||||
self._matchers = matchers
|
||||
|
||||
def __call__(self, value):
|
||||
def matchfn(self, f):
|
||||
for match in self._matchers:
|
||||
if match(value):
|
||||
if match(f):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -680,8 +680,8 @@ class negatematcher(basematcher):
|
||||
def __init__(self, matcher):
|
||||
self._matcher = matcher
|
||||
|
||||
def __call__(self, value):
|
||||
return not self._matcher(value)
|
||||
def matchfn(self, f):
|
||||
return not self._matcher(f)
|
||||
|
||||
def __repr__(self):
|
||||
return ('<negatematcher matcher=%r>' % self._matcher)
|
||||
|
Loading…
Reference in New Issue
Block a user