Commit 28e14b4d authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

cleanup: rename "matchfn" to "match" where obviously a matcher

We usually call matchers either "match" or "m" and reserve "matchfn"
for functions.

Differential Revision: https://phab.mercurial-scm.org/D641
parent ba6e14f9a2d8
......@@ -422,14 +422,13 @@ def cachelfiles(ui, repo, node, filelist=None):
return ([], [])
def downloadlfiles(ui, repo, rev=None):
matchfn = scmutil.match(repo[None],
[repo.wjoin(lfutil.shortname)], {})
match = scmutil.match(repo[None], [repo.wjoin(lfutil.shortname)], {})
def prepare(ctx, fns):
pass
totalsuccess = 0
totalmissing = 0
if rev != []: # walkchangerevs on empty list would return all revs
for ctx in cmdutil.walkchangerevs(repo, matchfn, {'rev' : rev},
for ctx in cmdutil.walkchangerevs(repo, match, {'rev' : rev},
prepare):
success, missing = cachelfiles(ui, repo, ctx.node())
totalsuccess += len(success)
......
......@@ -1664,15 +1664,15 @@ class queue(object):
changes = repo.changelog.read(top)
man = repo.manifestlog[changes[0]].read()
aaa = aa[:]
matchfn = scmutil.match(repo[None], pats, opts)
match1 = 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'):
# if amending a patch, we start with existing
# files plus specified files - unfiltered
match = scmutil.matchfiles(repo, mm + aa + dd + matchfn.files())
match = scmutil.matchfiles(repo, mm + aa + dd + match1.files())
# filter with include/exclude options
matchfn = scmutil.match(repo[None], opts=opts)
match1 = scmutil.match(repo[None], opts=opts)
else:
match = scmutil.matchall(repo)
m, a, r, d = repo.status(match=match)[:4]
......@@ -1713,8 +1713,8 @@ class queue(object):
a = list(aa)
# create 'match' that includes the files to be recommitted.
# apply matchfn via repo.status to ensure correct case handling.
cm, ca, cr, cd = repo.status(patchparent, match=matchfn)[:4]
# apply match1 via repo.status to ensure correct case handling.
cm, ca, cr, cd = repo.status(patchparent, match=match1)[:4]
allmatches = set(cm + ca + cr + cd)
refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)]
......@@ -1764,7 +1764,7 @@ class queue(object):
# file with mtime=0 so status can see it.
mm = []
for i in xrange(len(m) - 1, -1, -1):
if not matchfn(m[i]):
if not match1(m[i]):
mm.append(m[i])
del m[i]
for f in m:
......
......@@ -2001,19 +2001,19 @@ def show_changeset(ui, repo, opts, buffered=False):
regular display via changeset_printer() is done.
"""
# options
matchfn = None
match = None
if opts.get('patch') or opts.get('stat'):
matchfn = scmutil.matchall(repo)
match = scmutil.matchall(repo)
if opts.get('template') == 'json':
return jsonchangeset(ui, repo, matchfn, opts, buffered)
return jsonchangeset(ui, repo, match, opts, buffered)
spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style'))
if not spec.ref and not spec.tmpl and not spec.mapfile:
return changeset_printer(ui, repo, matchfn, opts, buffered)
return changeset_printer(ui, repo, match, opts, buffered)
return changeset_templater(ui, repo, spec, matchfn, opts, buffered)
return changeset_templater(ui, repo, spec, match, opts, buffered)
def showmarker(fm, marker, index=None):
"""utility function to display obsolescence marker in a readable way
......
......@@ -477,9 +477,9 @@ def archive(ui, repo, dest, **opts):
prefix = os.path.basename(repo.root) + '-%h'
prefix = cmdutil.makefilename(repo, prefix, node)
matchfn = scmutil.match(ctx, [], opts)
match = scmutil.match(ctx, [], opts)
archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
matchfn, prefix, subrepos=opts.get('subrepos'))
match, prefix, subrepos=opts.get('subrepos'))
@command('backout',
[('', 'merge', None, _('merge with old dirstate parent after backout')),
......@@ -2489,7 +2489,7 @@ def grep(ui, repo, pattern, *pats, **opts):
skip = {}
revfiles = {}
matchfn = scmutil.match(repo[None], pats, opts)
match = scmutil.match(repo[None], pats, opts)
found = False
follow = opts.get('follow')
......@@ -2530,7 +2530,7 @@ def grep(ui, repo, pattern, *pats, **opts):
ui.pager('grep')
fm = ui.formatter('grep', opts)
for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
for ctx in cmdutil.walkchangerevs(repo, match, opts, prep):
rev = ctx.rev()
parent = ctx.p1().rev()
for fn in sorted(revfiles.get(rev, [])):
......
......@@ -1111,13 +1111,13 @@ def archive(web, req, tmpl):
ctx = webutil.changectx(web.repo, req)
pats = []
matchfn = scmutil.match(ctx, [])
match = scmutil.match(ctx, [])
file = req.form.get('file', None)
if file:
pats = ['path:' + file[0]]
matchfn = scmutil.match(ctx, pats, default='path')
match = scmutil.match(ctx, pats, default='path')
if pats:
files = [f for f in ctx.manifest().keys() if matchfn(f)]
files = [f for f in ctx.manifest().keys() if match(f)]
if not files:
raise ErrorResponse(HTTP_NOT_FOUND,
'file(s) not found: %s' % file[0])
......@@ -1132,7 +1132,7 @@ def archive(web, req, tmpl):
req.respond(HTTP_OK, mimetype)
archival.archive(web.repo, req, cnode, artype, prefix=name,
matchfn=matchfn,
matchfn=match,
subrepos=web.configbool("web", "archivesubrepos"))
return []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment