Mercurial > hg
changeset 33380:892d255ec2a1
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.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 07 Jul 2017 08:55:12 -0700 |
parents | 7ddb2aa2b7af |
children | 3bdbbadddecc |
files | mercurial/match.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/match.py Sun Jul 09 17:02:09 2017 -0700 +++ b/mercurial/match.py Fri Jul 07 08:55:12 2017 -0700 @@ -655,8 +655,8 @@ 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 @@ 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 @@ 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)