[PATCH 2 of 4] dirstate: set more states in step 1 of walk

Simon Heimberg simohe at besonet.ch
Tue May 19 02:26:50 CDT 2009


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1242291045 -7200
# Node ID 4095d02302b74f9ce2c90fe283d84ad31ce2da83
# Parent  63713e57d10bdff50c59093459f434f2597ec3e7
dirstate: set more states in step 1 of walk

diff -r 63713e57d10b -r 4095d02302b7 mercurial/dirstate.py
--- a/mercurial/dirstate.py	Don Mai 14 19:47:52 2009 +0200
+++ b/mercurial/dirstate.py	Don Mai 14 10:50:45 2009 +0200
@@ -476,6 +476,9 @@
                 st = lstat(join(nf))
                 kind = getkind(st.st_mode)
                 if kind == dirkind:
+                    if nf in dmap:
+                        #file deleted on disc but still in dirstate
+                        results[nf] = None
                     if not dirignore(nf):
                         wadd(nf)
                 elif kind == regkind or kind == lnkkind:
@@ -488,14 +491,19 @@
                 keep = False
                 prefix = nf + "/"
                 for fn in dmap:
-                    if nf == fn or fn.startswith(prefix):
+                    if nf == fn:
+                        if matchfn(nf):
+                            results[nf] = None
+                        keep = True
+                        break
+                    elif fn.startswith(prefix):
                         keep = True
                         break
                 if not keep:
                     if inst.errno != errno.ENOENT:
                         fwarn(ff, inst.strerror)
                     elif badfn(ff, inst.strerror):
-                        if (nf in dmap or not ignore(nf)) and matchfn(nf):
+                        if nf not in results and not ignore(nf) and matchfn(nf):
                             results[nf] = None
 
         # step 2: visit subdirectories


More information about the Mercurial-devel mailing list