# HG changeset patch # User Siddharth Agarwal # Date 2013-04-02 21:46:55 # Node ID ec91b66e8965e4b4655e1ec49c41301de297a8e1 # Parent ce83afefa980a25f40060e4ccbf3ec2ae8187f56 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):