changegroupsubset: avoid setdefault in inner loop
authorMatt Mackall <mpm@selenic.com>
Fri, 13 Apr 2012 22:55:46 -0500
changeset 16422 c0b5bab3fb11
parent 16421 859ef739339e
child 16423 a150923b49ba
changegroupsubset: avoid setdefault in inner loop
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Apr 13 22:55:40 2012 -0500
+++ b/mercurial/localrepo.py	Fri Apr 13 22:55:46 2012 -0500
@@ -1854,13 +1854,13 @@
             elif revlog == mf:
                 clnode = mfs[x]
                 mdata = mf.readfast(x)
-                for f in mdata:
+                for f, n in mdata.iteritems():
                     if f in changedfiles:
-                        fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
+                        fnodes[f].setdefault(n, clnode)
                 count[0] += 1
                 progress(_bundling, count[0],
                          unit=_manifests, total=count[1])
-                return mfs[x]
+                return clnode
             else:
                 progress(_bundling, count[0], item=fstate[0],
                          unit=_files, total=count[1])
@@ -1883,6 +1883,8 @@
 
             # Create a generator for the manifestnodes that calls our lookup
             # and data collection functions back.
+            for f in changedfiles:
+                fnodes[f] = {}
             count[:] = [0, len(mfs)]
             for chunk in mf.group(prune(mf, mfs), bundler, reorder=reorder):
                 yield chunk