deltas: accept and skip None return for delta info
authorValentin Gatien-Baron <vgatien-baron@janestreet.com>
Mon, 21 Jan 2019 22:37:30 +0100
changeset 42466 465f2d0df9ae
parent 42465 6e9ba867a946
child 42467 c1c1872d25d1
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.
mercurial/revlogutils/deltas.py
--- 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: