diff mercurial/cmdutil.py @ 6578:f242d3684f83

walk: begin refactoring badmatch handling
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:07 -0500
parents 569761919450
children 0159b7a36184
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
@@ -228,12 +228,18 @@
         pats = util.expand_glob(pats or [])
     m = match.match(repo.root, repo.getcwd(), pats, opts.get('include'),
                     opts.get('exclude'), default)
+    def badfn(f, msg):
+        repo.ui.warn("%s: %s\n" % (m.rel(f), msg))
+        return False
+    m.bad = badfn
     return m.files(), m, m.anypats()
 
 def walk(repo, pats=[], opts={}, node=None, badmatch=None, globbed=False,
          default='relpath'):
     dummy, m, dummy = matchpats(repo, pats, opts, globbed, default)
-    for src, fn in repo.walk(node, m, badmatch):
+    if badmatch:
+        m.bad = badmatch
+    for src, fn in repo.walk(node, m):
         yield src, fn, m.rel(fn), m.exact(fn)
 
 def findrenames(repo, added=None, removed=None, threshold=0.5):