revlog: isgooddeltainfo takes the whole revinfo object
Future changes will need other information about te revision.
--- a/mercurial/revlog.py Wed Mar 07 12:00:07 2018 +0100
+++ b/mercurial/revlog.py Wed Mar 07 12:00:58 2018 +0100
@@ -449,7 +449,7 @@
if revlog.flags(candidaterev) & REVIDX_RAWTEXT_CHANGING_FLAGS:
continue
candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
- if revlog._isgooddeltainfo(candidatedelta, revinfo.textlen):
+ if revlog._isgooddeltainfo(candidatedelta, revinfo):
nominateddeltas.append(candidatedelta)
if nominateddeltas:
deltainfo = min(nominateddeltas, key=lambda x: x.deltalen)
@@ -2093,7 +2093,7 @@
return compressor.decompress(data)
- def _isgooddeltainfo(self, deltainfo, textlen):
+ def _isgooddeltainfo(self, deltainfo, revinfo):
"""Returns True if the given delta is good. Good means that it is within
the disk span, disk size, and chain length bounds that we know to be
performant."""
@@ -2106,6 +2106,7 @@
# deltas we need to apply -- bounding it limits the amount of CPU
# we consume.
+ textlen = revinfo.textlen
defaultmax = textlen * 4
maxdist = self._maxdeltachainspan
if not maxdist: