Show More
@@ -2093,26 +2093,27 b' class revlog(object):' | |||
|
2093 | 2093 | |
|
2094 | 2094 | return compressor.decompress(data) |
|
2095 | 2095 | |
|
2096 | def _isgooddeltainfo(self, d, textlen): | |
|
2096 | def _isgooddeltainfo(self, deltainfo, textlen): | |
|
2097 | 2097 | """Returns True if the given delta is good. Good means that it is within |
|
2098 | 2098 | the disk span, disk size, and chain length bounds that we know to be |
|
2099 | 2099 | performant.""" |
|
2100 | if d is None: | |
|
2100 | if deltainfo is None: | |
|
2101 | 2101 | return False |
|
2102 | 2102 | |
|
2103 |
# - 'd.distance' is the distance from the base revision -- |
|
|
2104 | # limits the amount of I/O we need to do. | |
|
2105 |
# - 'd.compresseddeltalen' is the sum of the total size of |
|
|
2106 |
# need to apply -- bounding it limits the amount of CPU |
|
|
2103 | # - 'deltainfo.distance' is the distance from the base revision -- | |
|
2104 | # bounding it limits the amount of I/O we need to do. | |
|
2105 | # - 'deltainfo.compresseddeltalen' is the sum of the total size of | |
|
2106 | # deltas we need to apply -- bounding it limits the amount of CPU | |
|
2107 | # we consume. | |
|
2107 | 2108 | |
|
2108 | 2109 | defaultmax = textlen * 4 |
|
2109 | 2110 | maxdist = self._maxdeltachainspan |
|
2110 | 2111 | if not maxdist: |
|
2111 | maxdist = d.distance # ensure the conditional pass | |
|
2112 | maxdist = deltainfo.distance # ensure the conditional pass | |
|
2112 | 2113 | maxdist = max(maxdist, defaultmax) |
|
2113 | if (d.distance > maxdist or d.deltalen > textlen or | |
|
2114 | d.compresseddeltalen > textlen * 2 or | |
|
2115 | (self._maxchainlen and d.chainlen > self._maxchainlen)): | |
|
2114 | if (deltainfo.distance > maxdist or deltainfo.deltalen > textlen or | |
|
2115 | deltainfo.compresseddeltalen > textlen * 2 or | |
|
2116 | (self._maxchainlen and deltainfo.chainlen > self._maxchainlen)): | |
|
2116 | 2117 | return False |
|
2117 | 2118 | |
|
2118 | 2119 | return True |
General Comments 0
You need to be logged in to leave comments.
Login now