[PATCH 1 of 3 stable] changegroup: don't define lookupmf() until it is needed

Gregory Szorc gregory.szorc at gmail.com
Fri Nov 7 02:12:09 CST 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1415336232 28800
#      Thu Nov 06 20:57:12 2014 -0800
# Node ID b6b91dd825e07fcfe67403f5716fc23e2e30f8c3
# Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
changegroup: don't define lookupmf() until it is needed

lookupmf() is currently defined earlier than when it is needed. Future
patches further refactoring this code will be easier to read when
lookupmf() is in its new home.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -338,8 +338,16 @@ class cg1packer(object):
             # record the first changeset introducing this manifest version
             mfs.setdefault(c[0], x)
             return x
 
+        for chunk in self.group(clnodes, cl, lookupcl, units=_('changesets'),
+                                reorder=reorder):
+            yield chunk
+        progress(msgbundling, None)
+
+        for f in changedfiles:
+            fnodes[f] = {}
+
         # Callback for the manifest, used to collect linkrevs for filelog
         # revisions.
         # Returns the linkrev node (collected in lookupcl).
         def lookupmf(x):
@@ -352,15 +360,8 @@ class cg1packer(object):
                         # version
                         fnodes[f].setdefault(n, clnode)
             return clnode
 
-        for chunk in self.group(clnodes, cl, lookupcl, units=_('changesets'),
-                                reorder=reorder):
-            yield chunk
-        progress(msgbundling, None)
-
-        for f in changedfiles:
-            fnodes[f] = {}
         mfnodes = self.prune(mf, mfs, commonrevs, source)
         for chunk in self.group(mfnodes, mf, lookupmf, units=_('manifests'),
                                 reorder=reorder):
             yield chunk


More information about the Mercurial-devel mailing list