[PATCH stable] dirstate: don't rename branch file if writing it failed
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sat Dec 15 06:27:16 CST 2012
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.
How did you spotted this? This patch is clearly a welcome fix, but what did
broke without it?
More information about the Mercurial-devel
mailing list