Mercurial > hg
changeset 14670:19197fa4c41c
scmutil: match now accepts a context or a repo
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | 2d2604adfdd6 |
children | 35c2cc322ba8 |
files | mercurial/scmutil.py |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmutil.py Sat Jun 18 16:52:51 2011 -0500 +++ b/mercurial/scmutil.py Sat Jun 18 16:52:51 2011 -0500 @@ -558,12 +558,19 @@ ret.append(p) return ret -def match(repo, pats=[], opts={}, globbed=False, default='relpath'): +def match(ctxorrepo, pats=[], opts={}, globbed=False, default='relpath'): if pats == ("",): pats = [] if not globbed and default == 'relpath': pats = expandpats(pats or []) - m = repo[None].match(pats, opts.get('include'), opts.get('exclude'), + + if hasattr(ctxorrepo, 'match'): + ctx = ctxorrepo + else: + # will eventually abort here + ctx = ctxorrepo[None] + + m = ctx.match(pats, opts.get('include'), opts.get('exclude'), default) def badfn(f, msg): repo.ui.warn("%s: %s\n" % (m.rel(f), msg))