##// END OF EJS Templates
match: allow passing a context object to match core
Matt Mackall -
r14674:1c151b96 default
parent child Browse files
Show More
@@ -212,7 +212,8 b' class changectx(object):'
212 def match(self, pats=[], include=None, exclude=None, default='glob'):
212 def match(self, pats=[], include=None, exclude=None, default='glob'):
213 r = self._repo
213 r = self._repo
214 return matchmod.match(r.root, r.getcwd(), pats,
214 return matchmod.match(r.root, r.getcwd(), pats,
215 include, exclude, default, auditor=r.auditor)
215 include, exclude, default,
216 auditor=r.auditor, ctx=self)
216
217
217 def diff(self, ctx2=None, match=None, **opts):
218 def diff(self, ctx2=None, match=None, **opts):
218 """Returns a diff generator for the given contexts and matcher"""
219 """Returns a diff generator for the given contexts and matcher"""
@@ -11,7 +11,7 b' from i18n import _'
11
11
12 class match(object):
12 class match(object):
13 def __init__(self, root, cwd, patterns, include=[], exclude=[],
13 def __init__(self, root, cwd, patterns, include=[], exclude=[],
14 default='glob', exact=False, auditor=None):
14 default='glob', exact=False, auditor=None, ctx=None):
15 """build an object to match a set of file patterns
15 """build an object to match a set of file patterns
16
16
17 arguments:
17 arguments:
@@ -37,6 +37,7 b' class match(object):'
37 self._cwd = cwd
37 self._cwd = cwd
38 self._files = []
38 self._files = []
39 self._anypats = bool(include or exclude)
39 self._anypats = bool(include or exclude)
40 self._ctx = ctx
40
41
41 if include:
42 if include:
42 pats = _normalize(include, 'glob', root, cwd, auditor)
43 pats = _normalize(include, 'glob', root, cwd, auditor)
General Comments 0
You need to be logged in to leave comments. Login now