[PATCH 1 of 8] upgrade: always use full text if "full-add" mode is enable

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Aug 5 12:36:29 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1560345769 -3600
#      Wed Jun 12 14:22:49 2019 +0100
# Node ID 8d019de36e616e8d71ba19c713a6f85cdc8beb60
# Parent  f95b59ffc307c4549d9640a81d750a99bd75f423
# EXP-Topic upgrade-select
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8d019de36e61
upgrade: always use full text if "full-add" mode is enable

We should not be using a delta since the goal is to perform a full addition from
scratch in all cases.

Without this patch, `hg debugupgraderepo --optimize re-delta-fulladd --run` can
crash.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2461,7 +2461,8 @@ class revlog(object):
                 # the revlog chunk is a delta.
                 cachedelta = None
                 rawtext = None
-                if destrevlog._lazydelta:
+                if (deltareuse != self.DELTAREUSEFULLADD
+                        and destrevlog._lazydelta):
                     dp = self.deltaparent(rev)
                     if dp != nullrev:
                         cachedelta = (dp, bytes(self._chunk(rev)))


More information about the Mercurial-devel mailing list