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
--- 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