match: use helpers for cmdutil
authorMatt Mackall <mpm@selenic.com>
Mon, 12 May 2008 11:37:08 -0500
changeset 6597 371415a2b959
parent 6596 7fe4610cf920
child 6598 7fc87fa485e5
match: use helpers for cmdutil
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/cmdutil.py	Mon May 12 11:37:08 2008 -0500
@@ -235,6 +235,12 @@
     m.bad = badfn
     return m
 
+def matchall(repo):
+    return _match.always(repo.root, repo.getcwd())
+
+def matchfiles(repo, files):
+    return _match.exact(repo.root, repo.getcwd(), files)
+
 def findrenames(repo, added=None, removed=None, threshold=0.5):
     '''find renamed files -- yields (before, after, score) tuples'''
     if added is None or removed is None:
@@ -885,7 +891,7 @@
     # options
     patch = False
     if opts.get('patch'):
-        patch = matchfn or util.always
+        patch = matchfn or matchall(repo)
 
     tmpl = opts.get('template')
     mapfile = None
@@ -1175,9 +1181,8 @@
                                        "unsupported file type!") % rel)
                 elif f not in repo.dirstate:
                     raise util.Abort(_("file %s not tracked!") % rel)
-    else:
-        files = []
+        m = matchfiles(repo, files)
     try:
-        return commitfunc(ui, repo, files, message, m, opts)
+        return commitfunc(ui, repo, m.files(), message, m, opts)
     except ValueError, inst:
         raise util.Abort(str(inst))