Patchwork workingctx: duplicate status list received at _poststatus hook

login
register
mail settings
Submitter Yuya Nishihara
Date May 31, 2014, 12:55 p.m.
Message ID <8f3fb97246fe7378aa9b.1401540959@mimosa>
Download mbox | patch
Permalink /patch/4903/
State Accepted
Headers show

Comments

Yuya Nishihara - May 31, 2014, 12:55 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1401538866 -32400
#      Sat May 31 21:21:06 2014 +0900
# Node ID 8f3fb97246fe7378aa9b06d93575c68f9e5d95ea
# Parent  9c35f3a8cac48b9404ee8dbbda18467f6123b82f
workingctx: duplicate status list received at _poststatus hook

basectx.status may reorder the list after workingctx._poststatus is called,
so workingctx must copy it.  Otherwise, wctx.deleted() would return "unknown"
files, for example.
Sean Farley - May 31, 2014, 4:58 p.m.
Yuya Nishihara writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1401538866 -32400
> #      Sat May 31 21:21:06 2014 +0900
> # Node ID 8f3fb97246fe7378aa9b06d93575c68f9e5d95ea
> # Parent  9c35f3a8cac48b9404ee8dbbda18467f6123b82f
> workingctx: duplicate status list received at _poststatus hook
>
> basectx.status may reorder the list after workingctx._poststatus is called,
> so workingctx must copy it.  Otherwise, wctx.deleted() would return "unknown"
> files, for example.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1375,7 +1375,7 @@ class workingctx(committablectx):
>          susposed to be linking to.
>          """
>          s[0] = self._filtersuspectsymlink(s[0])
> -        self._status = s
> +        self._status = s[:]
>          return s
>  
>      def _dirstatestatus(self, match=None, ignored=False, clean=False,

Ah, that's a good point. I assume you found this in TortoiseHg?
Yuya Nishihara - June 1, 2014, 2:16 a.m.
On Sat, 31 May 2014 11:58:38 -0500, Sean Farley wrote:
> Yuya Nishihara writes:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1401538866 -32400
> > #      Sat May 31 21:21:06 2014 +0900
> > # Node ID 8f3fb97246fe7378aa9b06d93575c68f9e5d95ea
> > # Parent  9c35f3a8cac48b9404ee8dbbda18467f6123b82f
> > workingctx: duplicate status list received at _poststatus hook
> >
> > basectx.status may reorder the list after workingctx._poststatus is called,
> > so workingctx must copy it.  Otherwise, wctx.deleted() would return "unknown"
> > files, for example.
> >
> > diff --git a/mercurial/context.py b/mercurial/context.py
> > --- a/mercurial/context.py
> > +++ b/mercurial/context.py
> > @@ -1375,7 +1375,7 @@ class workingctx(committablectx):
> >          susposed to be linking to.
> >          """
> >          s[0] = self._filtersuspectsymlink(s[0])
> > -        self._status = s
> > +        self._status = s[:]
> >          return s
> >  
> >      def _dirstatestatus(self, match=None, ignored=False, clean=False,
> 
> Ah, that's a good point. I assume you found this in TortoiseHg?

Yes,
https://groups.google.com/d/msg/thg-dev/Kkwxl-RtFrw/tjVmQd6B8S4J
Pierre-Yves David - June 6, 2014, 12:12 a.m.
On 05/31/2014 05:55 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1401538866 -32400
> #      Sat May 31 21:21:06 2014 +0900
> # Node ID 8f3fb97246fe7378aa9b06d93575c68f9e5d95ea
> # Parent  9c35f3a8cac48b9404ee8dbbda18467f6123b82f
> workingctx: duplicate status list received at _poststatus hook


That one have been pushed to the clowncopter, thanks !

Additional thanks goes to Sean Farley for the review.

(queued)

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1375,7 +1375,7 @@  class workingctx(committablectx):
         susposed to be linking to.
         """
         s[0] = self._filtersuspectsymlink(s[0])
-        self._status = s
+        self._status = s[:]
         return s
 
     def _dirstatestatus(self, match=None, ignored=False, clean=False,