Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 14671:35c2cc322ba8
scmutil: switch match users to supplying contexts
The most appropriate context is not always clearly defined. The obvious cases:
For working directory commands, we use None
For commands (eg annotate) with single revs, we use that revision
The less obvious cases:
For commands (eg status, diff) with a pair of revs, we use the second revision
For commands that take a range (like log), we use None
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | b98063487a6f |
children | e9ed3506f066 |
line wrap: on
line diff
--- a/hgext/mq.py Sat Jun 18 16:52:51 2011 -0500 +++ b/hgext/mq.py Sat Jun 18 16:52:51 2011 -0500 @@ -519,7 +519,7 @@ 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 @@ 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 @@ 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 @@ # 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]