changeset 18626:b114e41c4df3

addremove: don't audit the path for paths already in the dirstate Now that dirstate.walk returns None for paths under symlink directories, addremove doesn't need to validate each path it sees to look for files under symlinks. On a large repository this brings addremove from 6.3 seconds down to 3.65 (42%) since addremove no longer has to stat every directory of every file to determine if the file is inside a symlink directory. I put it through our benchmark and see no perf hit to any other commands.
author Durham Goode <durham@fb.com>
date Tue, 05 Feb 2013 14:36:19 -0800
parents 2cbd27f4f3c4
children 4e949b8e0930
files mercurial/scmutil.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Mon Feb 04 14:27:15 2013 -0800
+++ b/mercurial/scmutil.py	Tue Feb 05 14:36:19 2013 -0800
@@ -752,17 +752,14 @@
     ctx = repo[None]
     walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False)
     for abs in sorted(walkresults):
-        good = audit_path.check(abs)
-
         st = walkresults[abs]
         dstate = repo.dirstate[abs]
-        if good and dstate == '?':
+        if dstate == '?' and audit_path.check(abs):
             unknown.append(abs)
             if repo.ui.verbose or not m.exact(abs):
                 rel = m.rel(abs)
                 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
-        elif (dstate != 'r' and
-              (not good or not st or
+        elif (dstate != 'r' and (not st or
                (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))):
             deleted.append(abs)
             if repo.ui.verbose or not m.exact(abs):