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

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 5, 2019, 4:36 p.m.
Message ID <8d019de36e616e8d71ba.1565022989@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/41151/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 5, 2019, 4:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Gregory Szorc - Aug. 6, 2019, 2:39 a.m.
On Mon, Aug 5, 2019 at 9:49 AM Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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
>

Queued parts 1-5.


>
> 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)))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

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)))