changeset 16422:c0b5bab3fb11

changegroupsubset: avoid setdefault in inner loop
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Apr 2012 22:55:46 -0500
parents 859ef739339e
children a150923b49ba
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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