Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 38716:c67093e81a3e
revlog: extract `deltainfo.distance` for future conditional redefinition
This commit exist to make the next one clearer.
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Mon, 04 Jun 2018 12:12:00 +0200 |
parents | 4ac3c2078567 |
children | aa21a9ad46ea |
comparison
equal
deleted
inserted
replaced
38715:905b66681004 | 38716:c67093e81a3e |
---|---|
2396 # bounding it limits the amount of I/O we need to do. | 2396 # bounding it limits the amount of I/O we need to do. |
2397 # - 'deltainfo.compresseddeltalen' is the sum of the total size of | 2397 # - 'deltainfo.compresseddeltalen' is the sum of the total size of |
2398 # deltas we need to apply -- bounding it limits the amount of CPU | 2398 # deltas we need to apply -- bounding it limits the amount of CPU |
2399 # we consume. | 2399 # we consume. |
2400 | 2400 |
2401 distance = deltainfo.distance | |
2401 textlen = revinfo.textlen | 2402 textlen = revinfo.textlen |
2402 defaultmax = textlen * 4 | 2403 defaultmax = textlen * 4 |
2403 maxdist = self._maxdeltachainspan | 2404 maxdist = self._maxdeltachainspan |
2404 if not maxdist: | 2405 if not maxdist: |
2405 maxdist = deltainfo.distance # ensure the conditional pass | 2406 maxdist = distance # ensure the conditional pass |
2406 maxdist = max(maxdist, defaultmax) | 2407 maxdist = max(maxdist, defaultmax) |
2407 if (deltainfo.distance > maxdist or deltainfo.deltalen > textlen or | 2408 if (distance > maxdist or deltainfo.deltalen > textlen or |
2408 deltainfo.compresseddeltalen > textlen * 2 or | 2409 deltainfo.compresseddeltalen > textlen * 2 or |
2409 (self._maxchainlen and deltainfo.chainlen > self._maxchainlen)): | 2410 (self._maxchainlen and deltainfo.chainlen > self._maxchainlen)): |
2410 return False | 2411 return False |
2411 | 2412 |
2412 return True | 2413 return True |