changeset 8683:99eb4dcb37ce

walk: refactor walk plan - never is gone - reorder tests more cleanly - rename nomatches to exact for clearer semantics
author Matt Mackall <mpm@selenic.com>
date Sun, 31 May 2009 17:54:18 -0500
parents cc7da5aae4cd
children 5bb7780b57c7
files mercurial/dirstate.py
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Sun May 31 17:54:18 2009 -0500
+++ b/mercurial/dirstate.py	Sun May 31 17:54:18 2009 -0500
@@ -460,21 +460,20 @@
         work = []
         wadd = work.append
 
-        if match.anypats():
-            #match.match with patterns
+        if match.anypats(): # match.match or .exact with patterns
             dostep3 = True
-            nomatches = False
-        elif not match.files():
-            #match.always or match.never
-            dostep3 = matchfn('')
-            nomatches = not dostep3
-        else:
-            #match.exact or match.match without pattern
+            exact = False
+        elif matchfn == match.exact: # match.exact without patterns
+            dostep3 = False
+            exact = True
+        elif match.files(): # match.match without patterns
             dostep3 = False
-            nomatches = matchfn == match.exact
+            exact = False
+        else: # match.always
+            dostep3 = True
+            exact = False
 
-        if nomatches:
-            #skip step 2
+        if exact: # skip step 2
             dirignore = util.always
 
         files = set(match.files())
@@ -551,7 +550,7 @@
                         results[nf] = None
 
         # step 3: report unseen items in the dmap hash
-        if dostep3 and not nomatches:
+        if dostep3 and not exact:
             visit = sorted([f for f in dmap if f not in results and matchfn(f)])
             for nf, st in zip(visit, util.statfiles([join(i) for i in visit])):
                 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):