mercurial/transaction.py
changeset 8071 9f14b66830a8
parent 7335 866d2715aff5
child 8225 46293a0c7e9f
--- a/mercurial/transaction.py	Tue Apr 14 18:16:04 2009 +0200
+++ b/mercurial/transaction.py	Thu Apr 16 15:41:25 2009 +0200
@@ -34,8 +34,6 @@
         if self.journal:
             if self.entries: self.abort()
             self.file.close()
-            try: os.unlink(self.journal)
-            except: pass
 
     def add(self, file, offset, data=None):
         if file in self.map: return
@@ -82,15 +80,23 @@
 
         self.report(_("transaction abort!\n"))
 
+        failed = False
         for f, o, ignore in self.entries:
             try:
                 self.opener(f, "a").truncate(o)
             except:
+                failed = True
                 self.report(_("failed to truncate %s\n") % f)
 
         self.entries = []
 
-        self.report(_("rollback completed\n"))
+        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"))
 
 def rollback(opener, file):
     files = {}