revlog: extract `deltainfo.distance` for future conditional redefinition
authorPaul Morelle <paul.morelle@octobus.net>
Mon, 04 Jun 2018 12:12:00 +0200
changeset 38716 c67093e81a3e
parent 38715 905b66681004
child 38717 aa21a9ad46ea
revlog: extract `deltainfo.distance` for future conditional redefinition This commit exist to make the next one clearer.
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon Jul 16 14:04:48 2018 -0700
+++ b/mercurial/revlog.py	Mon Jun 04 12:12:00 2018 +0200
@@ -2398,13 +2398,14 @@
         #   deltas we need to apply -- bounding it limits the amount of CPU
         #   we consume.
 
+        distance = deltainfo.distance
         textlen = revinfo.textlen
         defaultmax = textlen * 4
         maxdist = self._maxdeltachainspan
         if not maxdist:
-            maxdist = deltainfo.distance # ensure the conditional pass
+            maxdist = distance # ensure the conditional pass
         maxdist = max(maxdist, defaultmax)
-        if (deltainfo.distance > maxdist or deltainfo.deltalen > textlen or
+        if (distance > maxdist or deltainfo.deltalen > textlen or
             deltainfo.compresseddeltalen > textlen * 2 or
             (self._maxchainlen and deltainfo.chainlen > self._maxchainlen)):
             return False