changeset 8290:560af1bbfd6e

transaction: reset transaction on abort Prevent the use of the transaction after it has been aborted. Co-contributor: Sune Foldager <cryo@cyanite.org>
author Henrik Stuart <hg@hstuart.dk>
date Sun, 19 Apr 2009 20:02:32 +0200
parents fe8a3e56039f
children f5c1a9094e41
files mercurial/transaction.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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():