diff mercurial/localrepo.py @ 16646:a1dcd842ce17

localrepo: optimize internode status calls using withflags Introduce manifestdict.withflags() to get a set of all files which have any flags set, since these are likely to be a minority. Otherwise checking .flags() for every file is a lot of dictionary lookups and is quite slow.
author Jesse Glick <jesse.glick@oracle.com>
date Fri, 04 May 2012 15:56:45 -0400
parents 9a21fc2c7d32
children b6081c2c4647
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri May 04 15:54:55 2012 -0400
+++ b/mercurial/localrepo.py	Fri May 04 15:56:45 2012 -0400
@@ -1420,10 +1420,11 @@
                 mf2 = mfmatches(ctx2)
 
             modified, added, clean = [], [], []
+            withflags = mf1.withflags() | mf2.withflags()
             for fn in mf2:
                 if fn in mf1:
                     if (fn not in deleted and
-                        (mf1.flags(fn) != mf2.flags(fn) or
+                        ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
                          (mf1[fn] != mf2[fn] and
                           (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))):
                         modified.append(fn)