changeset 27239:65c47779bcb5

changegroup: remove one special case from lookupmflinknode In the fastpathlinkrev case, lookupmflinknode was a very complicated way of saying mfs.__getitem__, so let's just get that case out of our way so it's easier to understand what's going on.
author Augie Fackler <augie@google.com>
date Fri, 04 Dec 2015 10:55:46 -0500
parents c3dc03109401
children 94a3d6fdc315
files mercurial/changegroup.py
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Fri Dec 04 10:35:45 2015 -0500
+++ b/mercurial/changegroup.py	Fri Dec 04 10:55:46 2015 -0500
@@ -656,21 +656,23 @@
         # Callback for the manifest, used to collect linkrevs for filelog
         # revisions.
         # Returns the linkrev node (collected in lookupcl).
-        def lookupmflinknode(x):
-            """Callback for looking up the linknode for manifests.
+        if fastpathlinkrev:
+            lookupmflinknode = mfs.__getitem__
+        else:
+            def lookupmflinknode(x):
+                """Callback for looking up the linknode for manifests.
 
-            Returns the linkrev node for the specified manifest.
-
-            SIDE EFFECT:
+                Returns the linkrev node for the specified manifest.
 
-              fclnodes gets populated with the list of relevant
-              file nodes if we're not using fastpathlinkrev.
+                SIDE EFFECT:
+
+                  fclnodes gets populated with the list of relevant
+                  file nodes.
 
-            Note that this means you can't trust fclnodes until
-            after manifests have been sent to the client.
-            """
-            clnode = mfs[x]
-            if not fastpathlinkrev:
+                Note that this means you can't trust fclnodes until
+                after manifests have been sent to the client.
+                """
+                clnode = mfs[x]
                 mdata = ml.readfast(x)
                 for f in mfchangedfiles[x]:
                     try:
@@ -683,7 +685,7 @@
                     fclnode = fclnodes.setdefault(n, clnode)
                     if clrevorder[clnode] < clrevorder[fclnode]:
                         fclnodes[n] = clnode
-            return clnode
+                return clnode
 
         mfnodes = self.prune(ml, mfs, commonrevs)
         for x in self._packmanifests(mfnodes, lookupmflinknode):