[PATCH stable] dirstate: don't rename branch file if writing it failed

Idan Kamara idankk86 at gmail.com
Sat Dec 15 07:03:06 CST 2012


On Sat, Dec 15, 2012 at 2:27 PM, Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:
>
> On Fri, Dec 14, 2012 at 04:15:00PM +0200, Idan Kamara wrote:
> > # HG changeset patch
> > # User Idan Kamara <idankk86 at gmail.com>
> > # Date 1355493250 -7200
> > # Branch stable
> > # Node ID ee7a3e1aff9ca0436f10447b594b6e307e2afad6
> > # Parent  ebc0fa067c07808b77f060e285d0c9d8d25c6750
> > dirstate: don't rename branch file if writing it failed
> >
> > diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> > --- a/mercurial/dirstate.py
> > +++ b/mercurial/dirstate.py
> > @@ -265,8 +265,9 @@
> >          f = self._opener('branch', 'w', atomictemp=True)
> >          try:
> >              f.write(self._branch + '\n')
> > -        finally:
> >              f.close()
> > +        except:
> > +            f.discard()
>
> It looks like you forget to reraise the exception. Otherwise we have a
> silent
> bare except. Those are one of the most annoying things in the
> universes.

Oops, will resend.

>
> How did you spotted this? This patch is clearly a welcome fix, but what
> did
> broke without it?

I was changing something close by and saw this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121215/dc44a4c0/attachment.html>


More information about the Mercurial-devel mailing list