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

2017-09-07 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG08346a8fa65f: cleanup: rename "matchfn" to "match" where 
obviously a matcher (authored by martinvonz).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D641?vs=1638=1663

REVISION DETAIL
  https://phab.mercurial-scm.org/D641

AFFECTED FILES
  hgext/largefiles/lfcommands.py
  hgext/mq.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/hgweb/webcommands.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -,13 +,13 @@
 
 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 @@
 req.respond(HTTP_OK, mimetype)
 
 archival.archive(web.repo, req, cnode, artype, prefix=name,
- matchfn=matchfn,
+ matchfn=match,
  subrepos=web.configbool("web", "archivesubrepos"))
 return []
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -477,9 +477,9 @@
 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 @@
 
 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 @@
 
 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, [])):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2001,19 +2001,19 @@
 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_templater(ui, repo, spec, matchfn, opts, buffered)
+return changeset_printer(ui, repo, match, 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
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1664,15 +1664,15 @@
 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]
@@ 

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

2017-09-06 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

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

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D641

AFFECTED FILES
  hgext/largefiles/lfcommands.py
  hgext/mq.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/hgweb/webcommands.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -,13 +,13 @@
 
 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 @@
 req.respond(HTTP_OK, mimetype)
 
 archival.archive(web.repo, req, cnode, artype, prefix=name,
- matchfn=matchfn,
+ matchfn=match,
  subrepos=web.configbool("web", "archivesubrepos"))
 return []
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -477,9 +477,9 @@
 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 @@
 
 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 @@
 
 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, [])):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2002,19 +2002,19 @@
 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_templater(ui, repo, spec, matchfn, opts, buffered)
+return changeset_printer(ui, repo, match, 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
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1664,15 +1664,15 @@
 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 @@
 a = list(aa)