Patchwork [07,of,10] deltas: accept and skip None return for delta info

login
register
mail settings
Submitter Pierre-Yves David
Date June 13, 2019, 1:23 p.m.
Message ID <e8b1d87ef22cbfbdcb82.1560432182@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40481/
State Accepted
Headers show

Comments

Pierre-Yves David - June 13, 2019, 1:23 p.m.
# HG changeset patch
# User Valentin Gatien-Baron <vgatien-baron@janestreet.com>
# Date 1548106650 -3600
#      Mon Jan 21 22:37:30 2019 +0100
# Node ID e8b1d87ef22cbfbdcb825d3539b9889cbb8a1245
# Parent  ea4affeead3ac4635ef23d351791c483bc9b462d
# EXP-Topic delta-extra
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e8b1d87ef22c
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.

Patch

diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -1025,8 +1025,9 @@  class deltacomputer(object):
                 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: