changegroup: extract condition for linkrev fastpath
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 29 Apr 2015 10:34:28 -0700
changeset 24976 147d8892fc4b
parent 24975 89c2bf63a83b
child 24977 4289383cb9d2
changegroup: extract condition for linkrev fastpath The condition for taking the fastpath (or not) is used in two places. By extracting it, we also provide a place to document what it's about.
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Sun Apr 12 07:14:53 2015 -0700
+++ b/mercurial/changegroup.py	Wed Apr 29 10:34:28 2015 -0700
@@ -361,7 +361,6 @@
         repo = self._repo
         cl = self._changelog
         ml = self._manifest
-        reorder = self._reorder
 
         clrevorder = {}
         mfs = {} # needed manifests
@@ -386,12 +385,13 @@
             yield chunk
         self._verbosenote(_('%8.i (changelog)\n') % size)
 
+        fastpathlinkrev = fastpathlinkrev and not self._reorder
         # Callback for the manifest, used to collect linkrevs for filelog
         # revisions.
         # Returns the linkrev node (collected in lookupcl).
         def lookupmf(x):
             clnode = mfs[x]
-            if not fastpathlinkrev or reorder:
+            if not fastpathlinkrev:
                 mdata = ml.readfast(x)
                 for f, n in mdata.iteritems():
                     if f in changedfiles:
@@ -414,7 +414,7 @@
         clrevs = set(cl.rev(x) for x in clnodes)
 
         def linknodes(filerevlog, fname):
-            if fastpathlinkrev and not reorder:
+            if fastpathlinkrev:
                 llr = filerevlog.linkrev
                 def genfilenodes():
                     for r in filerevlog: