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

login
register
mail settings
Submitter Boris Feld
Date July 16, 2018, 6:50 p.m.
Message ID <5ae60e5a705ef273d316.1531767022@FB-lair>
Download mbox | patch
Permalink /patch/32869/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2018, 6:50 p.m.
# HG changeset patch
# User Paul Morelle <paul.morelle@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.

Patch

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