[PATCH 4 of 6] revlog: isgooddeltainfo takes the whole revinfo object

Paul Morelle paul.morelle at octobus.net
Mon May 21 17:47:56 EDT 2018


# HG changeset patch
# User Paul Morelle <paul.morelle at octobus.net>
# Date 1520420458 -3600
#      Wed Mar 07 12:00:58 2018 +0100
# Node ID 3270177368354d88aba86d5b00b96b7fecadd65b
# Parent  d9a8f10cfaa662c5dc6f64e2726da7d763e7e717
# EXP-Topic semi-snapshots
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 327017736835
revlog: isgooddeltainfo takes the whole revinfo object

Future changes will need other information about te revision.

diff -r d9a8f10cfaa6 -r 327017736835 mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Mar 07 12:00:07 2018 +0100
+++ b/mercurial/revlog.py	Wed Mar 07 12:00:58 2018 +0100
@@ -442,7 +442,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)
@@ -2086,7 +2086,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."""
@@ -2099,6 +2099,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:


More information about the Mercurial-devel mailing list