comparison mercurial/localrepo.py @ 18714:7790d69af6d6

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.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 22 Feb 2013 10:05:22 -0800
parents 4f485bd68f1d
children 70e2a22fd66e
comparison
equal deleted inserted replaced
18713:8728579f6bdc 18714:7790d69af6d6
1530 deleted, unknown, ignored = [], [], [] 1530 deleted, unknown, ignored = [], [], []
1531 mf2 = mfmatches(ctx2) 1531 mf2 = mfmatches(ctx2)
1532 1532
1533 modified, added, clean = [], [], [] 1533 modified, added, clean = [], [], []
1534 withflags = mf1.withflags() | mf2.withflags() 1534 withflags = mf1.withflags() | mf2.withflags()
1535 for fn in mf2: 1535 for fn, mf2node in mf2.iteritems():
1536 if fn in mf1: 1536 if fn in mf1:
1537 if (fn not in deleted and 1537 if (fn not in deleted and
1538 ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or 1538 ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
1539 (mf1[fn] != mf2[fn] and 1539 (mf1[fn] != mf2node and
1540 (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))): 1540 (mf2node or ctx1[fn].cmp(ctx2[fn]))))):
1541 modified.append(fn) 1541 modified.append(fn)
1542 elif listclean: 1542 elif listclean:
1543 clean.append(fn) 1543 clean.append(fn)
1544 del mf1[fn] 1544 del mf1[fn]
1545 elif fn not in deleted: 1545 elif fn not in deleted: