diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -558,12 +558,19 @@ def expandpats(pats): 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))