Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 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 |
comparison
equal
deleted
inserted
replaced
39085:dbb3e9e44fce | 39086:64ddad2f26bb |
---|---|
806 class revlogoldindex(list): | 806 class revlogoldindex(list): |
807 def __getitem__(self, i): | 807 def __getitem__(self, i): |
808 if i == -1: | 808 if i == -1: |
809 return (0, 0, 0, -1, -1, -1, -1, nullid) | 809 return (0, 0, 0, -1, -1, -1, -1, nullid) |
810 return list.__getitem__(self, i) | 810 return list.__getitem__(self, i) |
811 | |
812 # maximum <delta-chain-data>/<revision-text-length> ratio | |
813 LIMIT_DELTA2TEXT = 2 | |
811 | 814 |
812 class revlogoldio(object): | 815 class revlogoldio(object): |
813 def __init__(self): | 816 def __init__(self): |
814 self.size = indexformatv0.size | 817 self.size = indexformatv0.size |
815 | 818 |
2491 return False | 2494 return False |
2492 | 2495 |
2493 # Bad delta from cumulated payload size: | 2496 # Bad delta from cumulated payload size: |
2494 # | 2497 # |
2495 # If the sum of delta get larger than K * target text length. | 2498 # If the sum of delta get larger than K * target text length. |
2496 if textlen * 2 < deltainfo.compresseddeltalen: | 2499 if textlen * LIMIT_DELTA2TEXT < deltainfo.compresseddeltalen: |
2497 return False | 2500 return False |
2498 | 2501 |
2499 # Bad delta from chain length: | 2502 # Bad delta from chain length: |
2500 # | 2503 # |
2501 # If the number of delta in the chain gets too high. | 2504 # If the number of delta in the chain gets too high. |