walk: kill util.cmdmatcher and _matcher
authorMatt Mackall <mpm@selenic.com>
Mon, 12 May 2008 11:37:07 -0500
changeset 6575 e08e0367ba15
parent 6574 76af1dff402a
child 6576 69f3e9ac7c56
walk: kill util.cmdmatcher and _matcher
mercurial/cmdutil.py
mercurial/util.py
--- 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: