changeset 6971:b3bc518a73c3

performance: do not stat() things when not required Ignore unknown files if we don't need them (eg in hg diff). It slows things down a little bit for big trees (kernel repo), since _join() is called for each file instead of for each directory. fix issue567
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 02 Sep 2008 15:08:26 +0200
parents f7f0388f7bce
children 63d1d3e489f8
files mercurial/dirstate.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Sep 02 09:47:40 2008 +0200
+++ b/mercurial/dirstate.py	Tue Sep 02 15:08:26 2008 +0200
@@ -434,12 +434,15 @@
             self._ui.warn(_('%s: unsupported file type (type is %s)\n')
                           % (self.pathto(f), kind))
 
-        # TODO: don't walk unknown directories if unknown and ignored are False
         ignore = self._ignore
         dirignore = self._dirignore
         if ignored:
             ignore = util.never
             dirignore = util.never
+        elif not unknown:
+            # if unknown and ignored are False, skip step 2
+            ignore = util.always
+            dirignore = util.always
 
         matchfn = match.matchfn
         dmap = self._map