changeset 42466:465f2d0df9ae

deltas: accept and skip None return for delta info They are some extra computation that will shortcut the delta compression if the delta seems hopeless, returning None.
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Mon, 21 Jan 2019 22:37:30 +0100
parents 6e9ba867a946
children c1c1872d25d1
files mercurial/revlogutils/deltas.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/deltas.py	Mon Jan 21 22:36:16 2019 +0100
+++ b/mercurial/revlogutils/deltas.py	Mon Jan 21 22:37:30 2019 +0100
@@ -1025,8 +1025,9 @@
                 nominateddeltas.append(deltainfo)
             for candidaterev in candidaterevs:
                 candidatedelta = self._builddeltainfo(revinfo, candidaterev, fh)
-                if isgooddeltainfo(self.revlog, candidatedelta, revinfo):
-                    nominateddeltas.append(candidatedelta)
+                if candidatedelta is not None:
+                    if isgooddeltainfo(self.revlog, candidatedelta, revinfo):
+                        nominateddeltas.append(candidatedelta)
             if nominateddeltas:
                 deltainfo = min(nominateddeltas, key=lambda x: x.deltalen)
             if deltainfo is not None: