[PATCH 2 of 6 V2] scmutil.addremove: pull repo.dirstate fetch out of the loop
Siddharth Agarwal
sid0 at fb.com
Tue Apr 2 16:52:54 CDT 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1364939215 25200
# Tue Apr 02 14:46:55 2013 -0700
# Node ID 4535ebeae4e69079ed7e0eb1f61ecffe372671be
# Parent d723353c8a0ab2ced8606014abee43aa0b1e3fa4
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.
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -676,10 +676,11 @@ def addremove(repo, pats=[], opts={}, dr
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):
More information about the Mercurial-devel
mailing list