revlog: use a symbolic constant for the deltas/text ration
authorBoris Feld <boris.feld@octobus.net>
Tue, 14 Aug 2018 13:47:07 -0700
changeset 39086 64ddad2f26bb
parent 39085 dbb3e9e44fce
child 39087 f90b333e79cb
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.
mercurial/revlog.py
--- 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: