Patchwork ["] revlog: preserve `_lazydelta` attribute in `revlog.clone`

login
register
mail settings
Submitter Pierre-Yves David
Date March 4, 2019, 2:55 p.m.
Message ID <bbe72376f2a91b383370.1551711342@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39045/
State Superseded
Headers show

Comments

Pierre-Yves David - March 4, 2019, 2:55 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1551710814 -3600
#      Mon Mar 04 15:46:54 2019 +0100
# Node ID bbe72376f2a91b383370619b3a0f66cf4a5d8178
# Parent  82d9728ace9535057d77df6c920385861ec00072
# EXP-Topic lazydelta
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r bbe72376f2a9
revlog: preserve `_lazydelta` attribute in `revlog.clone`

The attribute was introduce in 688fc33e105d, Yuya Nishihara pointed out that
this preservation was missing. This should be fixed by this changesets.
Yuya Nishihara - March 5, 2019, 1:40 p.m.
On Mon, 04 Mar 2019 15:55:42 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1551710814 -3600
> #      Mon Mar 04 15:46:54 2019 +0100
> # Node ID bbe72376f2a91b383370619b3a0f66cf4a5d8178
> # Parent  82d9728ace9535057d77df6c920385861ec00072
> # EXP-Topic lazydelta
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r bbe72376f2a9
> revlog: preserve `_lazydelta` attribute in `revlog.clone`
> 
> The attribute was introduce in 688fc33e105d, Yuya Nishihara pointed out that
> this preservation was missing. This should be fixed by this changesets.
> 
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -2396,7 +2396,9 @@ class revlog(object):
>          if getattr(destrevlog, 'filteredrevs', None):
>              raise ValueError(_('destination revlog has filtered revisions'))
>  
> -        # lazydeltabase controls whether to reuse a cached delta, if possible.
> +        # lazydelta and lazydeltabase controls whether to reuse a cached delta,
> +        # if possible.
> +        oldlazydelta = destrevlog._lazydelta
>          oldlazydeltabase = destrevlog._lazydeltabase
>          oldamd = destrevlog._deltabothparents

IIUC, we need to override destrevlog._lazydelta flag depending on deltareuse
option.

> @@ -2460,6 +2462,7 @@ class revlog(object):
>                  if addrevisioncb:
>                      addrevisioncb(self, rev, node)
>          finally:
> +            destrevlog._lazydelta = oldlazydelta
>              destrevlog._lazydeltabase = oldlazydeltabase
>              destrevlog._deltabothparents = oldamd

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2396,7 +2396,9 @@  class revlog(object):
         if getattr(destrevlog, 'filteredrevs', None):
             raise ValueError(_('destination revlog has filtered revisions'))
 
-        # lazydeltabase controls whether to reuse a cached delta, if possible.
+        # lazydelta and lazydeltabase controls whether to reuse a cached delta,
+        # if possible.
+        oldlazydelta = destrevlog._lazydelta
         oldlazydeltabase = destrevlog._lazydeltabase
         oldamd = destrevlog._deltabothparents
 
@@ -2460,6 +2462,7 @@  class revlog(object):
                 if addrevisioncb:
                     addrevisioncb(self, rev, node)
         finally:
+            destrevlog._lazydelta = oldlazydelta
             destrevlog._lazydeltabase = oldlazydeltabase
             destrevlog._deltabothparents = oldamd