mercurial/bookmarks.py
changeset 27188 6a1301e22bd7
parent 27187 d9dcc5c09d77
child 27276 38024b75241a
--- a/mercurial/bookmarks.py	Wed Nov 11 21:01:23 2015 -0500
+++ b/mercurial/bookmarks.py	Wed Nov 11 21:03:48 2015 -0500
@@ -132,9 +132,14 @@
         wlock = repo.wlock()
         try:
 
-            file = repo.vfs('bookmarks', 'w', atomictemp=True)
-            self._write(file)
-            file.close()
+            file_ = repo.vfs('bookmarks', 'w', atomictemp=True)
+            try:
+                self._write(file_)
+            except: # re-raises
+                file_.discard()
+                raise
+            finally:
+                file_.close()
 
         finally:
             wlock.release()