walk: simplify logic for badfn clause
authorMatt Mackall <mpm@selenic.com>
Sun, 31 May 2009 17:54:18 -0500
changeset 8677 34df078b8b1b
parent 8676 acd69fc201a5
child 8678 43598055bae8
walk: simplify logic for badfn clause - matchfn redundant - call badfn always rather than fwarn - use for/else rather than keep var
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Sun May 31 17:54:18 2009 -0500
+++ b/mercurial/dirstate.py	Sun May 31 17:54:18 2009 -0500
@@ -506,22 +506,16 @@
                     if nf in dmap:
                         results[nf] = None
             except OSError, inst:
-                keep = False
                 if nf in dmap: # does it exactly match a file?
                     results[nf] = None
-                    keep = True
                 else: # does it match a directory?
                     prefix = nf + "/"
                     for fn in dmap:
                         if fn.startswith(prefix):
                             dostep3 = True
-                            keep = True
                             break
-                if not keep:
-                    if inst.errno != errno.ENOENT:
-                        fwarn(ff, inst.strerror)
-                    elif badfn(ff, inst.strerror):
-                        if nf not in results and not ignore(nf) and matchfn(nf):
+                    else:
+                        if badfn(ff, inst.strerror) and not ignore(nf):
                             results[nf] = None
 
         # step 2: visit subdirectories