Mercurial > hg-stable
changeset 14674:1c151b963254
match: allow passing a context object to match core
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | b0566467c492 |
children | cfc89398f710 |
files | mercurial/context.py mercurial/match.py |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Sat Jun 18 16:52:51 2011 -0500 +++ b/mercurial/context.py Sat Jun 18 16:52:51 2011 -0500 @@ -212,7 +212,8 @@ def match(self, pats=[], include=None, exclude=None, default='glob'): r = self._repo return matchmod.match(r.root, r.getcwd(), pats, - include, exclude, default, auditor=r.auditor) + include, exclude, default, + auditor=r.auditor, ctx=self) def diff(self, ctx2=None, match=None, **opts): """Returns a diff generator for the given contexts and matcher"""
--- a/mercurial/match.py Sat Jun 18 16:52:51 2011 -0500 +++ b/mercurial/match.py Sat Jun 18 16:52:51 2011 -0500 @@ -11,7 +11,7 @@ class match(object): def __init__(self, root, cwd, patterns, include=[], exclude=[], - default='glob', exact=False, auditor=None): + default='glob', exact=False, auditor=None, ctx=None): """build an object to match a set of file patterns arguments: @@ -37,6 +37,7 @@ self._cwd = cwd self._files = [] self._anypats = bool(include or exclude) + self._ctx = ctx if include: pats = _normalize(include, 'glob', root, cwd, auditor)