Mercurial > hg-stable
diff mercurial/cmdutil.py @ 6597:371415a2b959
match: use helpers for cmdutil
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 May 2008 11:37:08 -0500 |
parents | d3463007d368 |
children | b822a379860b |
line wrap: on
line diff
--- 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))