mercurial/dirstate.py
branchstable
changeset 18076 3bc21f6daac4
parent 17984 b74361cf7c0a
child 18077 777084ac8416
--- a/mercurial/dirstate.py	Mon Dec 10 14:58:42 2012 +0100
+++ b/mercurial/dirstate.py	Sat Dec 15 20:19:07 2012 +0200
@@ -265,8 +265,10 @@
         f = self._opener('branch', 'w', atomictemp=True)
         try:
             f.write(self._branch + '\n')
-        finally:
             f.close()
+        except: # re-raises
+            f.discard()
+            raise
 
     def _read(self):
         self._map = {}