Patchwork [2,of,3,fix-default] addrevision: handle code path not producing delta

mail settings
Submitter Pierre-Yves David
Date Dec. 2, 2015, 8:37 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/11740/
State Accepted
Headers show


Pierre-Yves David - Dec. 2, 2015, 8:37 a.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1449015769 28800
#      Tue Dec 01 16:22:49 2015 -0800
# Node ID 31aafeaa7ac49cbc98d3b526b6ae67f98cc803d2
# Parent  ebf8b06f9dbfe03e28776032f5dc3d64db18579b
# EXP-Topic generaldelta
# Available At
#              hg pull -r 31aafeaa7ac4
addrevision: handle code path not producing delta

We would like to be able to exit the delta generation block without a valid
delta (for a more flexible control flow). So we make sure we do not expand the
"delta" content unless we actually have a delta.

We can do it one level lower because 'delta' is initialised at None anyway. Not
adding a level to the assignment prevent a line length issue.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1457,10 +1457,11 @@  class revlog(object):
                     # give it one last try against prev.
                     if drev != prev and not self._isgooddelta(delta, textlen):
                         delta = builddelta(prev)
                 delta = builddelta(prev)
+        if delta is not None:
             dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
         if not self._isgooddelta(delta, textlen):
             text = buildtext()
             data = self.compress(text)