transaction: reset transaction on abort
authorHenrik Stuart <hg@hstuart.dk>
Sun, 19 Apr 2009 20:02:32 +0200
changeset 8290 560af1bbfd6e
parent 8289 fe8a3e56039f
child 8291 f5c1a9094e41
transaction: reset transaction on abort Prevent the use of the transaction after it has been aborted. Co-contributor: Sune Foldager <cryo@cyanite.org>
mercurial/transaction.py
--- a/mercurial/transaction.py	Fri Apr 24 09:56:53 2009 +0200
+++ b/mercurial/transaction.py	Sun Apr 19 20:02:32 2009 +0200
@@ -94,6 +94,9 @@
         self._abort()
 
     def _abort(self):
+        self.count = 0
+        self.file.close()
+
         if not self.entries: return
 
         self.report(_("transaction abort!\n"))
@@ -109,13 +112,14 @@
         self.entries = []
 
         if not failed:
-            self.file.close()
             os.unlink(self.journal)
-            self.journal = None
             self.report(_("rollback completed\n"))
         else:
             self.report(_("rollback failed - please run hg recover\n"))
 
+        self.journal = None
+
+
 def rollback(opener, file):
     files = {}
     for l in open(file).readlines():