[PATCH] localrepo: iterate over manifest key/value pairs in status
Bryan O'Sullivan
bos at serpentine.com
Thu Feb 21 15:45:54 CST 2013
# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1361483151 28800
# Node ID 8fa59ad66baa06631baf4b6c3eb2ec8c5d85786d
# Parent 95cb8d7754a7a28f52f82a332bf1163eb6dea202
localrepo: iterate over manifest key/value pairs in status
This saves us a couple of dict lookups in the common case, and improves
the performance of the status method by 5% (measured with util.timed)
in a repo with a large manifest.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1532,12 +1532,12 @@ class localrepository(object):
modified, added, clean = [], [], []
withflags = mf1.withflags() | mf2.withflags()
- for fn in mf2:
+ for fn, mf2node in mf2.iteritems():
if fn in mf1:
if (fn not in deleted and
((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
- (mf1[fn] != mf2[fn] and
- (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))):
+ (mf1[fn] != mf2node and
+ (mf2node or ctx1[fn].cmp(ctx2[fn]))))):
modified.append(fn)
elif listclean:
clean.append(fn)
More information about the Mercurial-devel
mailing list