changeset 13788:307c72686eb0

changegroup: fold linkrev helper into lookup functions
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Mar 2011 11:18:56 -0500
parents 5333c87f6048
children 7e5031180c0f
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Mar 28 11:18:56 2011 -0500
+++ b/mercurial/localrepo.py	Mon Mar 28 11:18:56 2011 -0500
@@ -1610,11 +1610,6 @@
                 if log.linkrev(r) in revset:
                     yield log.node(r)
 
-        def lookuplinkrev_func(revlog):
-            def lookuplinkrev(n):
-                return cl.node(revlog.linkrev(revlog.rev(n)))
-            return lookuplinkrev
-
         def gengroup():
             '''yield a sequence of changegroup chunks (strings)'''
             # construct a list of all changed files
@@ -1638,13 +1633,12 @@
 
             mnfst = self.manifest
             nodeiter = gennodelst(mnfst)
-            mfunc = lookuplinkrev_func(mnfst)
             count = [0]
             def mlookup(revlog, x):
                 count[0] += 1
                 self.ui.progress(_('bundling'), count[0],
                                  unit=_('manifests'), total=changecount)
-                return mfunc(x)
+                return cl.node(revlog.linkrev(revlog.rev(x)))
 
             for chunk in mnfst.group(nodeiter, mlookup):
                 yield chunk
@@ -1659,12 +1653,11 @@
                 if nodeiter:
                     yield changegroup.chunkheader(len(fname))
                     yield fname
-                    ffunc = lookuplinkrev_func(filerevlog)
                     def flookup(revlog, x):
                         self.ui.progress(
                             _('bundling'), idx, item=fname,
                             total=efiles, unit=_('files'))
-                        return ffunc(x)
+                        return cl.node(revlog.linkrev(revlog.rev(x)))
 
                     for chunk in filerevlog.group(nodeiter, flookup):
                         yield chunk