changeset 558:0ceea19182a9

transaction: __del__ should do nothing if the journal already exists -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 transaction: __del__ should do nothing if the journal already exists manifest hash: c85f747ca762b7c446d306cbd7a20f8e566557fb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxXbTywK+sNU5EO8RAvjsAKCcTSzN9OjtoAdaZgtjDs9380ia7ACfcXsx FcNESqr4nX9b97WTGszJs48= =C2sL -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 01 Jul 2005 09:01:07 -0800
parents b9fee419a1bd
children bf9d55ed67f6
files mercurial/transaction.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Fri Jul 01 08:54:52 2005 -0800
+++ b/mercurial/transaction.py	Fri Jul 01 09:01:07 2005 -0800
@@ -31,9 +31,11 @@
         self.file = open(self.journal, "w")
 
     def __del__(self):
-        if self.entries: self.abort()
-        try: os.unlink(self.journal)
-        except: pass
+        if self.journal:
+            if self.entries: self.abort()
+            self.file.close()
+            try: os.unlink(self.journal)
+            except: pass
 
     def add(self, file, offset):
         if file in self.map: return