scmutil.addremove: pull repo.dirstate fetch out of the loop
authorSiddharth Agarwal <sid0@fb.com>
Tue, 02 Apr 2013 14:46:55 -0700
changeset 18861 ec91b66e8965
parent 18860 ce83afefa980
child 18862 6de8cd5c719a
scmutil.addremove: pull repo.dirstate fetch out of the loop On a large repository with 170,000 files, this speeds up perfaddremove from 2.78 seconds to 2.40.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Mon Apr 01 20:38:37 2013 -0700
+++ b/mercurial/scmutil.py	Tue Apr 02 14:46:55 2013 -0700
@@ -676,10 +676,11 @@
     m.bad = lambda x, y: rejected.append(x)
 
     ctx = repo[None]
-    walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False)
+    dirstate = repo.dirstate
+    walkresults = dirstate.walk(m, sorted(ctx.substate), True, False)
     for abs in sorted(walkresults):
         st = walkresults[abs]
-        dstate = repo.dirstate[abs]
+        dstate = dirstate[abs]
         if dstate == '?' and audit_path.check(abs):
             unknown.append(abs)
             if repo.ui.verbose or not m.exact(abs):