[PATCH 7 of 8] revlog: use a symbolic constant for the deltas/text ration

Boris Feld boris.feld at octobus.net
Tue Aug 14 12:39:17 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1532780936 -7200
#      Sat Jul 28 14:28:56 2018 +0200
# Node ID 64d463474e20f07d434f7d47add49da27233aec4
# Parent  e7eddd3944f5a2dd8235f372c175b3688a17ef0c
# EXP-Topic sparse-snapshot
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 64d463474e20
revlog: use a symbolic constant for the deltas/text ration

We are about to use it somewhere else, we should as well make it easier to
access and change.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -809,6 +809,9 @@ class revlogoldindex(list):
             return (0, 0, 0, -1, -1, -1, -1, nullid)
         return list.__getitem__(self, i)
 
+# maximum <delta-chain-data>/<revision-text-length> ration
+LIMIT_DELTA2TEXT = 2
+
 class revlogoldio(object):
     def __init__(self):
         self.size = indexformatv0.size
@@ -2498,7 +2501,7 @@ class revlog(object):
         # Bad delta from cumulated payload size:
         #
         #   If the sum of delta get larger than K * target text length.
-        if (textlen * 2  < deltainfo.compresseddeltalen):
+        if (textlen * LIMIT_DELTA2TEXT  < deltainfo.compresseddeltalen):
             return False
 
         # Bad delta from chain length:


More information about the Mercurial-devel mailing list