changeset 39086:64ddad2f26bb

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.
author Boris Feld <boris.feld@octobus.net>
date Tue, 14 Aug 2018 13:47:07 -0700
parents dbb3e9e44fce
children f90b333e79cb
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jul 27 14:37:31 2018 +0200
+++ b/mercurial/revlog.py	Tue Aug 14 13:47:07 2018 -0700
@@ -809,6 +809,9 @@
             return (0, 0, 0, -1, -1, -1, -1, nullid)
         return list.__getitem__(self, i)
 
+# maximum <delta-chain-data>/<revision-text-length> ratio
+LIMIT_DELTA2TEXT = 2
+
 class revlogoldio(object):
     def __init__(self):
         self.size = indexformatv0.size
@@ -2493,7 +2496,7 @@
         # 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: