changeset 10228:056c366fea8c stable

transaction: initialize self.journal to None after deletion This avoid a warning when having an empty transaction, where hg would try to delete the journal twice.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 11 Jan 2010 21:40:19 +0100
parents 500d09be7ace
children 9df52218810d
files mercurial/transaction.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Fri Jan 08 23:15:24 2010 +0100
+++ b/mercurial/transaction.py	Mon Jan 11 21:40:19 2010 +0100
@@ -42,8 +42,6 @@
 
 class transaction(object):
     def __init__(self, report, opener, journal, after=None, createmode=None):
-        self.journal = None
-
         self.count = 1
         self.report = report
         self.opener = opener
@@ -140,14 +138,14 @@
         self.count = 0
         self.file.close()
 
-        if not self.entries:
-            if self.journal:
-                os.unlink(self.journal)
-            return
+        try:
+            if not self.entries:
+                if self.journal:
+                    os.unlink(self.journal)
+                return
 
-        self.report(_("transaction abort!\n"))
+            self.report(_("transaction abort!\n"))
 
-        try:
             try:
                 _playback(self.journal, self.report, self.opener, self.entries, False)
                 self.report(_("rollback completed\n"))