diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -31,11 +31,11 @@ def timer(func, title=None): def perfwalk(ui, repo, *pats): try: - m = scmutil.match(repo, pats, {}) + m = scmutil.match(repo[None], pats, {}) timer(lambda: len(list(repo.dirstate.walk(m, [], True, False)))) except: try: - m = scmutil.match(repo, pats, {}) + m = scmutil.match(repo[None], pats, {}) timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)])) except: timer(lambda: len(list(cmdutil.walk(repo, pats, {})))) diff --git a/hgext/churn.py b/hgext/churn.py --- a/hgext/churn.py +++ b/hgext/churn.py @@ -54,7 +54,7 @@ def countrate(ui, repo, amap, *pats, **o if opts.get('date'): df = util.matchdate(opts['date']) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) def prep(ctx, fns): rev = ctx.rev() if df and not df(ctx.date()[0]): # doesn't match date format diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -137,7 +137,7 @@ def dodiff(ui, repo, diffcmd, diffopts, if node1b == nullid: do3way = False - matcher = scmutil.match(repo, pats, opts) + matcher = scmutil.match(repo[node2], pats, opts) mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher)[:3]) if do3way: mod_b, add_b, rem_b = map(set, repo.status(node1b, node2, matcher)[:3]) diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -45,7 +45,7 @@ def difftree(ui, repo, node1=None, node2 assert node2 is not None mmap = repo[node1].manifest() mmap2 = repo[node2].manifest() - m = scmutil.match(repo, files) + m = scmutil.match(repo[node1], files) modified, added, removed = repo.status(node1, node2, m)[:3] empty = short(nullid) @@ -81,7 +81,7 @@ def difftree(ui, repo, node1=None, node2 if opts['patch']: if opts['pretty']: catcommit(ui, repo, node2, "") - m = scmutil.match(repo, files) + m = scmutil.match(repo[node1], files) chunks = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, {'git': True})) for chunk in chunks: diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -326,7 +326,7 @@ def _status(ui, repo, kwt, *pats, **opts '''Bails out if [keyword] configuration is not active. Returns status of working directory.''' if kwt: - return repo.status(match=scmutil.match(repo, pats, opts), clean=True, + return repo.status(match=scmutil.match(repo[None], pats, opts), clean=True, unknown=opts.get('unknown') or opts.get('all')) if ui.configitems('keyword'): raise util.Abort(_('[keyword] patterns cannot match')) diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -519,7 +519,7 @@ class queue(object): def printdiff(self, repo, diffopts, node1, node2=None, files=None, fp=None, changes=None, opts={}): stat = opts.get('stat') - m = scmutil.match(repo, files, opts) + m = scmutil.match(repo[node1], files, opts) cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m, changes, stat, fp) @@ -899,7 +899,7 @@ class queue(object): if opts.get('include') or opts.get('exclude') or pats: if inclsubs: pats = list(pats or []) + inclsubs - match = scmutil.match(repo, pats, opts) + match = scmutil.match(repo[None], pats, opts) # detect missing files in pats def badfn(f, msg): if f != '.hgsubstate': # .hgsubstate is auto-created @@ -1380,7 +1380,7 @@ class queue(object): changes = repo.changelog.read(top) man = repo.manifest.read(changes[0]) aaa = aa[:] - matchfn = scmutil.match(repo, pats, opts) + matchfn = scmutil.match(repo[None], pats, opts) # in short mode, we only diff the files included in the # patch already plus specified files if opts.get('short'): @@ -1388,7 +1388,7 @@ class queue(object): # files plus specified files - unfiltered match = scmutil.matchfiles(repo, mm + aa + dd + matchfn.files()) # filter with inc/exl options - matchfn = scmutil.match(repo, opts=opts) + matchfn = scmutil.match(repo[None], opts=opts) else: match = scmutil.matchall(repo) m, a, r, d = repo.status(match=match)[:4] diff --git a/hgext/purge.py b/hgext/purge.py --- a/hgext/purge.py +++ b/hgext/purge.py @@ -96,7 +96,7 @@ def purge(ui, repo, *dirs, **opts): os.remove(path) directories = [] - match = scmutil.match(repo, dirs, opts) + match = scmutil.match(repo[None], dirs, opts) match.dir = directories.append status = repo.status(match=match, ignored=opts['all'], unknown=True) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -234,7 +234,7 @@ def copy(ui, repo, pats, opts, rename=Fa def walkpat(pat): srcs = [] badstates = after and '?' or '?r' - m = scmutil.match(repo, [pat], opts, globbed=True) + m = scmutil.match(repo[None], [pat], opts, globbed=True) for abs in repo.walk(m): state = repo.dirstate[abs] rel = m.rel(abs) @@ -1185,7 +1185,8 @@ def commit(ui, repo, commitfunc, pats, o if opts.get('addremove'): scmutil.addremove(repo, pats, opts) - return commitfunc(ui, repo, message, scmutil.match(repo, pats, opts), opts) + return commitfunc(ui, repo, message, + scmutil.match(repo[None], pats, opts), opts) def commiteditor(repo, ctx, subs): if ctx.description(): diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -162,7 +162,7 @@ def add(ui, repo, *pats, **opts): Returns 0 if all files are successfully added. """ - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), opts.get('subrepos'), prefix="") return rejected and 1 or 0 @@ -262,7 +262,7 @@ def annotate(ui, repo, *pats, **opts): raise util.Abort("%s: %s" % (x, y)) ctx = scmutil.revsingle(repo, opts.get('rev')) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(ctx, pats, opts) m.bad = bad follow = not opts.get('no_follow') for abs in ctx.walk(m): @@ -342,7 +342,7 @@ def archive(ui, repo, dest, **opts): prefix = os.path.basename(repo.root) + '-%h' prefix = cmdutil.makefilename(repo, prefix, node) - matchfn = scmutil.match(repo, [], opts) + matchfn = scmutil.match(ctx, [], opts) archival.archive(repo, dest, node, kind, not opts.get('no_decode'), matchfn, prefix, subrepos=opts.get('subrepos')) @@ -944,7 +944,7 @@ def cat(ui, repo, file1, *pats, **opts): """ ctx = scmutil.revsingle(repo, opts.get('rev')) err = 1 - m = scmutil.match(repo, (file1,) + pats, opts) + m = scmutil.match(ctx, (file1,) + pats, opts) for abs in ctx.walk(m): fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(), pathname=abs) @@ -1091,7 +1091,7 @@ def commit(ui, repo, *pats, **opts): node = cmdutil.commit(ui, repo, commitfunc, pats, opts) if not node: - stat = repo.status(match=scmutil.match(repo, pats, opts)) + stat = repo.status(match=scmutil.match(repo[None], pats, opts)) if stat[3]: ui.status(_("nothing changed (%d missing files, see 'hg status')\n") % len(stat[3])) @@ -1610,7 +1610,7 @@ def debugfileset(ui, repo, expr): if ui.verbose: tree = fileset.parse(expr)[0] ui.note(tree, "\n") - matcher = lambda x: scmutil.match(repo, x, default='glob') + matcher = lambda x: scmutil.match(repo[None], x, default='glob') for f in fileset.getfileset(repo[None], matcher, expr): ui.write("%s\n" % f) @@ -1857,7 +1857,7 @@ def debugrename(ui, repo, file1, *pats, """dump rename information""" ctx = scmutil.revsingle(repo, opts.get('rev')) - m = scmutil.match(repo, (file1,) + pats, opts) + m = scmutil.match(ctx, (file1,) + pats, opts) for abs in ctx.walk(m): fctx = ctx[abs] o = fctx.filelog().renamed(fctx.filenode()) @@ -2106,7 +2106,7 @@ def debugsub(ui, repo, rev=None): @command('debugwalk', walkopts, _('[OPTION]... [FILE]...')) def debugwalk(ui, repo, *pats, **opts): """show how files match on given patterns""" - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) items = list(repo.walk(m)) if not items: return @@ -2192,7 +2192,7 @@ def diff(ui, repo, *pats, **opts): node1, node2 = node2, node1 diffopts = patch.diffopts(ui, opts) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[node2], pats, opts) cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, listsubrepos=opts.get('subrepos')) @@ -2272,7 +2272,7 @@ def forget(ui, repo, *pats, **opts): if not pats: raise util.Abort(_('no files specified')) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) s = repo.status(match=m, clean=True) forget = sorted(s[0] + s[1] + s[3] + s[6]) errs = 0 @@ -2438,7 +2438,7 @@ def grep(ui, repo, pattern, *pats, **opt skip = {} revfiles = {} - matchfn = scmutil.match(repo, pats, opts) + matchfn = scmutil.match(repo[None], pats, opts) found = False follow = opts.get('follow') @@ -3313,7 +3313,7 @@ def locate(ui, repo, *pats, **opts): rev = scmutil.revsingle(repo, opts.get('rev'), None).node() ret = 1 - m = scmutil.match(repo, pats, opts, default='relglob') + m = scmutil.match(repo[rev], pats, opts, default='relglob') m.bad = lambda x, y: False for abs in repo[rev].walk(m): if not rev and abs not in repo.dirstate: @@ -3382,7 +3382,7 @@ def log(ui, repo, *pats, **opts): Returns 0 on success. """ - matchfn = scmutil.match(repo, pats, opts) + matchfn = scmutil.match(repo[None], pats, opts) limit = cmdutil.loglimit(opts) count = 0 @@ -3437,7 +3437,7 @@ def log(ui, repo, *pats, **opts): if opts.get('patch') or opts.get('stat'): if opts.get('follow') or opts.get('follow_first'): # note: this might be wrong when following through merges - revmatchfn = scmutil.match(repo, fns, default='path') + revmatchfn = scmutil.match(repo[None], fns, default='path') else: revmatchfn = matchfn @@ -3650,7 +3650,7 @@ def parents(ui, repo, file_=None, **opts ctx = scmutil.revsingle(repo, opts.get('rev'), None) if file_: - m = scmutil.match(repo, (file_,), opts) + m = scmutil.match(ctx, (file_,), opts) if m.anypats() or len(m.files()) != 1: raise util.Abort(_('can only specify an explicit filename')) file_ = m.files()[0] @@ -3968,7 +3968,7 @@ def remove(ui, repo, *pats, **opts): if not pats and not after: raise util.Abort(_('no files specified')) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] @@ -4102,7 +4102,7 @@ def resolve(ui, repo, *pats, **opts): 'use --all to remerge all files')) ms = mergemod.mergestate(repo) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) ret = 0 for f in ms: @@ -4203,7 +4203,7 @@ def revert(ui, repo, *pats, **opts): try: # walk dirstate. - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[None], pats, opts) m.bad = lambda x, y: False for abs in repo.walk(m): names[abs] = m.rel(abs), m.exact(abs) @@ -4219,7 +4219,7 @@ def revert(ui, repo, *pats, **opts): return ui.warn("%s: %s\n" % (m.rel(path), msg)) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[node], pats, opts) m.bad = badfn for abs in repo[node].walk(m): if abs not in names: @@ -4654,7 +4654,7 @@ def status(ui, repo, *pats, **opts): if not show: show = ui.quiet and states[:4] or states[:5] - stat = repo.status(node1, node2, scmutil.match(repo, pats, opts), + stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), 'ignored' in show, 'clean' in show, 'unknown' in show, opts.get('subrepos')) changestates = zip(states, 'MAR!?IC', stat) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -573,7 +573,7 @@ def match(ctxorrepo, pats=[], opts={}, g 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)) + ctx._repo.ui.warn("%s: %s\n" % (m.rel(f), msg)) m.bad = badfn return m @@ -591,7 +591,7 @@ def addremove(repo, pats=[], opts={}, dr # we'd use status here, except handling of symlinks and ignore is tricky added, unknown, deleted, removed = [], [], [], [] audit_path = pathauditor(repo.root) - m = match(repo, pats, opts) + m = match(repo[None], pats, opts) for abs in repo.walk(m): target = repo.wjoin(abs) good = True diff --git a/tests/autodiff.py b/tests/autodiff.py --- a/tests/autodiff.py +++ b/tests/autodiff.py @@ -29,7 +29,7 @@ def autodiff(ui, repo, *pats, **opts): raise util.Abort('--git must be yes, no or auto') node1, node2 = scmutil.revpair(repo, []) - m = scmutil.match(repo, pats, opts) + m = scmutil.match(repo[node2], pats, opts) it = patch.diff(repo, node1, node2, match=m, opts=diffopts, losedatafn=losedatafn) for chunk in it: