changeset 13786:4ed718f909e5

changegroup: roll changegroup.collector into lookup functions
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Mar 2011 11:18:56 -0500
parents 470ec600b525
children 5333c87f6048
files mercurial/changegroup.py mercurial/localrepo.py
diffstat 2 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Mar 28 11:18:56 2011 -0500
+++ b/mercurial/changegroup.py	Mon Mar 28 11:18:56 2011 -0500
@@ -49,15 +49,6 @@
     "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
 }
 
-def collector(cl, mmfs, files):
-    # Gather information about changeset nodes going out in a bundle.
-    # We want to gather manifests needed and filelogs affected.
-    def collect(node):
-        c = cl.read(node)
-        files.update(c[3])
-        mmfs.setdefault(c[0], node)
-    return collect
-
 # hgweb uses this list to communicate its preferred type
 bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
 
--- a/mercurial/localrepo.py	Mon Mar 28 11:18:56 2011 -0500
+++ b/mercurial/localrepo.py	Mon Mar 28 11:18:56 2011 -0500
@@ -1530,10 +1530,11 @@
             # The set of changed files starts empty.
             changedfiles = set()
 
-            collect = changegroup.collector(cl, mfs, changedfiles)
             count = [0]
             def clookup(revlog, x):
-                collect(x)
+                c = cl.read(x)
+                changedfiles.update(c[3])
+                mfs.setdefault(c[0], x)
                 count[0] += 1
                 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
                 return x
@@ -1637,12 +1638,13 @@
             changedfiles = set()
             mmfs = {}
 
-            collect = changegroup.collector(cl, mmfs, changedfiles)
             count = [0]
             def clookup(revlog, x):
+                c = cl.read(x)
+                changedfiles.update(c[3])
+                mmfs.setdefault(c[0], x)
                 count[0] += 1
                 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
-                collect(x)
                 return x
 
             for chunk in cl.group(nodes, clookup):