Show More
@@ -1233,6 +1233,25 b' class revlog(object):' | |||
|
1233 | 1233 | return ('u', text) |
|
1234 | 1234 | return ("", bin) |
|
1235 | 1235 | |
|
1236 | def _isgooddelta(self, d, textlen): | |
|
1237 | """Returns True if the given delta is good. Good means that it is within | |
|
1238 | the disk span, disk size, and chain length bounds that we know to be | |
|
1239 | performant.""" | |
|
1240 | if d is None: | |
|
1241 | return False | |
|
1242 | ||
|
1243 | # - 'dist' is the distance from the base revision -- bounding it limits | |
|
1244 | # the amount of I/O we need to do. | |
|
1245 | # - 'compresseddeltalen' is the sum of the total size of deltas we need | |
|
1246 | # to apply -- bounding it limits the amount of CPU we consume. | |
|
1247 | dist, l, data, base, chainbase, chainlen, compresseddeltalen = d | |
|
1248 | if (dist > textlen * 4 or l > textlen or | |
|
1249 | compresseddeltalen > textlen * 2 or | |
|
1250 | (self._maxchainlen and chainlen > self._maxchainlen)): | |
|
1251 | return False | |
|
1252 | ||
|
1253 | return True | |
|
1254 | ||
|
1236 | 1255 | def _addrevision(self, node, text, transaction, link, p1, p2, flags, |
|
1237 | 1256 | cachedelta, ifh, dfh): |
|
1238 | 1257 | """internal function to add revisions to the log |
@@ -1334,13 +1353,7 b' class revlog(object):' | |||
|
1334 | 1353 | else: |
|
1335 | 1354 | textlen = len(text) |
|
1336 | 1355 | |
|
1337 | # - 'dist' is the distance from the base revision -- bounding it limits | |
|
1338 | # the amount of I/O we need to do. | |
|
1339 | # - 'compresseddeltalen' is the sum of the total size of deltas we need | |
|
1340 | # to apply -- bounding it limits the amount of CPU we consume. | |
|
1341 | if (d is None or dist > textlen * 4 or l > textlen or | |
|
1342 | compresseddeltalen > textlen * 2 or | |
|
1343 | (self._maxchainlen and chainlen > self._maxchainlen)): | |
|
1356 | if not self._isgooddelta(d, textlen): | |
|
1344 | 1357 | text = buildtext() |
|
1345 | 1358 | data = self.compress(text) |
|
1346 | 1359 | l = len(data[1]) + len(data[0]) |
General Comments 0
You need to be logged in to leave comments.
Login now