# HG changeset patch # User Matt Mackall # Date 1334375746 18000 # Node ID c0b5bab3fb11d9b886488c81d5077d2d28d5dcf9 # Parent 859ef739339e3c683fc197c8e2fdd793cc213e54 changegroupsubset: avoid setdefault in inner loop diff -r 859ef739339e -r c0b5bab3fb11 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