[PATCH 1 of 3] changegroup: extract condition for linkrev fastpath

Martin von Zweigbergk martinvonz at google.com
Fri May 8 11:49:27 CDT 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1430328868 25200
#      Wed Apr 29 10:34:28 2015 -0700
# Node ID 538c527d7cb7c929a107ffebf5d05bc413d4526a
# Parent  8179af513aebf96c4902ba3e5e3cf710d49501e4
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.

diff -r 8179af513aeb -r 538c527d7cb7 mercurial/changegroup.py
--- a/mercurial/changegroup.py	Thu May 07 16:43:58 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:


More information about the Mercurial-devel mailing list