# HG changeset patch # User Matt Mackall # Date 2011-06-18 21:52:51 # Node ID 1c151b963254a41f7775180ac50cf999666841eb # Parent b0566467c4929f3c68dcd609d6293cfe6dea5681 match: allow passing a context object to match core diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -212,7 +212,8 @@ class changectx(object): 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""" diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -11,7 +11,7 @@ from i18n import _ 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 @@ class match(object): self._cwd = cwd self._files = [] self._anypats = bool(include or exclude) + self._ctx = ctx if include: pats = _normalize(include, 'glob', root, cwd, auditor)