[PATCH 2 of 5] revlog: extract `deltainfo.distance` for future conditional redefinition

Boris Feld boris.feld at octobus.net
Mon Jul 16 14:50:22 EDT 2018


# HG changeset patch
# User Paul Morelle <paul.morelle at octobus.net>
# Date 1528107120 -7200
#      Mon Jun 04 12:12:00 2018 +0200
# Node ID 5ae60e5a705ef273d316e33df401e4c44a4c482a
# Parent  6ed641517622f53dd51193c3ae3930c66fc18078
# EXP-Topic write-for-sparse-read
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5ae60e5a705e
revlog: extract `deltainfo.distance` for future conditional redefinition

This commit exist to make the next one clearer.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2393,13 +2393,14 @@ class revlog(object):
         #   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


More information about the Mercurial-devel mailing list