[PATCH 2 of 6] dirstate.walk: move dirignore filter out of explicit walk code

Siddharth Agarwal sid0 at fb.com
Tue May 7 16:32:09 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1367945230 25200
#      Tue May 07 09:47:10 2013 -0700
# Node ID 924523a3e1fbd533419ce22c8bd036576b1d274d
# Parent  869ee5ce0194c7b931d18754ff044f395a249984
dirstate.walk: move dirignore filter out of explicit walk code

This is a move towards factoring this code out into a separate function.

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -626,8 +626,7 @@
                         results[nf] = None
                     if matchedir:
                         matchedir(nf)
-                    if not dirignore(nf):
-                        wadd(nf)
+                    wadd(nf)
                 elif kind == regkind or kind == lnkkind:
                     results[nf] = st
                 else:
@@ -649,6 +648,9 @@
                     else:
                         badfn(ff, inst.strerror)
 
+        work = [d for d in work if not dirignore(d)]
+        wadd = work.append
+
         # step 2: visit subdirectories
         while work:
             nd = work.pop()


More information about the Mercurial-devel mailing list