Patchwork [stable] changelog: ensure changelog._delaybuf is initialized

login
register
mail settings
Submitter Pierre-Yves David
Date May 20, 2014, 9 p.m.
Message ID <33b18d495eaf872bcd8b.1400619631@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4846/
State Accepted
Headers show

Comments

Pierre-Yves David - May 20, 2014, 9 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1400619308 25200
#      Tue May 20 13:55:08 2014 -0700
# Branch stable
# Node ID 33b18d495eaf872bcd8b4feab704b4b6e147fa6a
# Parent  235ed8ca9a16f6231fc5c3bf1346cc1a25430c8c
changelog: ensure changelog._delaybuf is initialized

The ``localrepo.writepending`` method is using the ``changelog._delaybuff``
attribute to know if it has anything to do. However the ``changelog._delaybuff``
is never initialised at ``__init__`` time. This can lead to crash when using
bundle2 for part that never touch the changelog.

We simply initialize it to its base value. This is scheduled for stable as it
both trivial and blocking for experimenting with bundle2.
Augie Fackler - May 26, 2014, 4:19 p.m.
On Tue, May 20, 2014 at 02:00:31PM -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1400619308 25200
> #      Tue May 20 13:55:08 2014 -0700
> # Branch stable
> # Node ID 33b18d495eaf872bcd8b4feab704b4b6e147fa6a
> # Parent  235ed8ca9a16f6231fc5c3bf1346cc1a25430c8c
> changelog: ensure changelog._delaybuf is initialized
>

Queued for stable, thanks

>
> The ``localrepo.writepending`` method is using the ``changelog._delaybuff``
> attribute to know if it has anything to do. However the ``changelog._delaybuff``
> is never initialised at ``__init__`` time. This can lead to crash when using
> bundle2 for part that never touch the changelog.
>
> We simply initialize it to its base value. This is scheduled for stable as it
> both trivial and blocking for experimenting with bundle2.
>
> diff --git a/mercurial/changelog.py b/mercurial/changelog.py
> --- a/mercurial/changelog.py
> +++ b/mercurial/changelog.py
> @@ -125,10 +125,11 @@ class changelog(revlog.revlog):
>              # changelogs don't benefit from generaldelta
>              self.version &= ~revlog.REVLOGGENERALDELTA
>              self._generaldelta = False
>          self._realopener = opener
>          self._delayed = False
> +        self._delaybuf = []
>          self._divert = False
>          self.filteredrevs = frozenset()
>
>      def tip(self):
>          """filtered version of revlog.tip"""
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -125,10 +125,11 @@  class changelog(revlog.revlog):
             # changelogs don't benefit from generaldelta
             self.version &= ~revlog.REVLOGGENERALDELTA
             self._generaldelta = False
         self._realopener = opener
         self._delayed = False
+        self._delaybuf = []
         self._divert = False
         self.filteredrevs = frozenset()
 
     def tip(self):
         """filtered version of revlog.tip"""