Mercurial > hg
changeset 6575:e08e0367ba15
walk: kill util.cmdmatcher and _matcher
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 May 2008 11:37:07 -0500 |
parents | 76af1dff402a |
children | 69f3e9ac7c56 |
files | mercurial/cmdutil.py mercurial/util.py |
diffstat | 2 files changed, 8 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon May 12 11:37:07 2008 -0500 +++ b/mercurial/cmdutil.py Mon May 12 11:37:07 2008 -0500 @@ -223,14 +223,15 @@ pathname), mode) -def matchpats(repo, pats=[], opts={}, globbed=False, default=None): - cwd = repo.getcwd() - return util.cmdmatcher(repo.root, cwd, pats or [], opts.get('include'), - opts.get('exclude'), globbed=globbed, - default=default) +def matchpats(repo, pats=[], opts={}, globbed=False, default='relpath'): + pats = pats or [] + if not globbed and default == 'relpath': + pats = util.expand_glob(pats or []) + return util.matcher(repo.root, repo.getcwd(), pats, opts.get('include'), + opts.get('exclude'), None, default) def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False, - default=None): + default='relpath'): files, matchfn, anypats = matchpats(repo, pats, opts, globbed=globbed, default=default) exact = dict.fromkeys(files)
--- a/mercurial/util.py Mon May 12 11:37:07 2008 -0500 +++ b/mercurial/util.py Mon May 12 11:37:07 2008 -0500 @@ -412,17 +412,7 @@ raise Abort('%s not under root' % myname) -def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None): - return _matcher(canonroot, cwd, names, inc, exc, 'glob', src) - -def cmdmatcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None, - globbed=False, default=None): - default = default or 'relpath' - if default == 'relpath' and not globbed: - names = expand_glob(names) - return _matcher(canonroot, cwd, names, inc, exc, default, src) - -def _matcher(canonroot, cwd, names, inc, exc, dflt_pat, src): +def matcher(canonroot, cwd='', names=[], inc=[], exc=[], src=None, dflt_pat='glob'): """build a function to match a set of file patterns arguments: