comparison mercurial/cmdutil.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 1bdbca0b6604
children 32302480b402
comparison
equal deleted inserted replaced
14670:19197fa4c41c 14671:35c2cc322ba8
232 wctx = repo[None] 232 wctx = repo[None]
233 233
234 def walkpat(pat): 234 def walkpat(pat):
235 srcs = [] 235 srcs = []
236 badstates = after and '?' or '?r' 236 badstates = after and '?' or '?r'
237 m = scmutil.match(repo, [pat], opts, globbed=True) 237 m = scmutil.match(repo[None], [pat], opts, globbed=True)
238 for abs in repo.walk(m): 238 for abs in repo.walk(m):
239 state = repo.dirstate[abs] 239 state = repo.dirstate[abs]
240 rel = m.rel(abs) 240 rel = m.rel(abs)
241 exact = m.exact(abs) 241 exact = m.exact(abs)
242 if state in badstates: 242 if state in badstates:
1183 # extract addremove carefully -- this function can be called from a command 1183 # extract addremove carefully -- this function can be called from a command
1184 # that doesn't support addremove 1184 # that doesn't support addremove
1185 if opts.get('addremove'): 1185 if opts.get('addremove'):
1186 scmutil.addremove(repo, pats, opts) 1186 scmutil.addremove(repo, pats, opts)
1187 1187
1188 return commitfunc(ui, repo, message, scmutil.match(repo, pats, opts), opts) 1188 return commitfunc(ui, repo, message,
1189 scmutil.match(repo[None], pats, opts), opts)
1189 1190
1190 def commiteditor(repo, ctx, subs): 1191 def commiteditor(repo, ctx, subs):
1191 if ctx.description(): 1192 if ctx.description():
1192 return ctx.description() 1193 return ctx.description()
1193 return commitforceeditor(repo, ctx, subs) 1194 return commitforceeditor(repo, ctx, subs)