# HG changeset patch # User Matt Mackall # Date 2008-05-12 16:37:07 # Node ID e08e0367ba1512b9e0fb13540149e5a3392d1019 # Parent 76af1dff402aebe1af9a7b864bd5d964e5f3d9f5 walk: kill util.cmdmatcher and _matcher diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -223,14 +223,15 @@ def make_file(repo, pat, node=None, 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) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -412,17 +412,7 @@ def canonpath(root, cwd, myname): 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: