changeset 13812:2b70683888b9

changegroup: minor ordering and renaming changes for similarity This eliminates some needless differences between the two changegroup variants
author Matt Mackall <mpm@selenic.com>
date Thu, 31 Mar 2011 09:59:56 -0500
parents 65c1d309ab91
children 76593ef397ef
files mercurial/localrepo.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Mar 31 09:56:27 2011 -0500
+++ b/mercurial/localrepo.py	Thu Mar 31 09:59:56 2011 -0500
@@ -1478,6 +1478,7 @@
         mf = self.manifest
         mfs = {} # needed manifests
         fnodes = {} # needed file nodes
+        changedfiles = set()
 
         # can we go through the fast path ?
         heads.sort()
@@ -1498,7 +1499,6 @@
         # logically divide up the task, generate the group.
         def gengroup():
             # The set of changed files starts empty.
-            changedfiles = set()
 
             count = [0]
             def clookup(revlog, x):
@@ -1588,11 +1588,15 @@
 
         nodes is the set of nodes to send"""
 
-        self.hook('preoutgoing', throw=True, source=source)
+        cl = self.changelog
+        mf = self.manifest
+        mfs = {}
+        changedfiles = set()
 
-        cl = self.changelog
+        self.hook('preoutgoing', throw=True, source=source)
+        self.changegroupinfo(nodes, source)
+
         revset = set([cl.rev(n) for n in nodes])
-        self.changegroupinfo(nodes, source)
 
         def gennodelst(log):
             for r in log:
@@ -1602,14 +1606,12 @@
         def gengroup():
             '''yield a sequence of changegroup chunks (strings)'''
             # construct a list of all changed files
-            changedfiles = set()
-            mmfs = {}
 
             count = [0]
             def clookup(revlog, x):
                 c = cl.read(x)
                 changedfiles.update(c[3])
-                mmfs.setdefault(c[0], x)
+                mfs.setdefault(c[0], x)
                 count[0] += 1
                 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
                 return x
@@ -1620,7 +1622,6 @@
             changecount = count[0]
             self.ui.progress(_('bundling'), None)
 
-            mnfst = self.manifest
             count = [0]
             def mlookup(revlog, x):
                 count[0] += 1
@@ -1628,7 +1629,7 @@
                                  unit=_('manifests'), total=changecount)
                 return cl.node(revlog.linkrev(revlog.rev(x)))
 
-            for chunk in mnfst.group(gennodelst(mnfst), mlookup):
+            for chunk in mf.group(gennodelst(mf), mlookup):
                 yield chunk
             self.ui.progress(_('bundling'), None)
 
@@ -1651,10 +1652,9 @@
                         yield fname
                         first = False
                     yield chunk
+            yield changegroup.closechunk()
             self.ui.progress(_('bundling'), None)
 
-            yield changegroup.closechunk()
-
             if nodes:
                 self.hook('outgoing', node=hex(nodes[0]), source=source)