##// END OF EJS Templates
transaction: only delete journal on successful abort/commit...
Henrik Stuart -
r8071:9f14b668 default
parent child Browse files
Show More
@@ -34,8 +34,6 b' class transaction(object):'
34 34 if self.journal:
35 35 if self.entries: self.abort()
36 36 self.file.close()
37 try: os.unlink(self.journal)
38 except: pass
39 37
40 38 def add(self, file, offset, data=None):
41 39 if file in self.map: return
@@ -82,15 +80,23 b' class transaction(object):'
82 80
83 81 self.report(_("transaction abort!\n"))
84 82
83 failed = False
85 84 for f, o, ignore in self.entries:
86 85 try:
87 86 self.opener(f, "a").truncate(o)
88 87 except:
88 failed = True
89 89 self.report(_("failed to truncate %s\n") % f)
90 90
91 91 self.entries = []
92 92
93 if not failed:
94 self.file.close()
95 os.unlink(self.journal)
96 self.journal = None
93 97 self.report(_("rollback completed\n"))
98 else:
99 self.report(_("rollback failed - please run hg recover\n"))
94 100
95 101 def rollback(opener, file):
96 102 files = {}
General Comments 0
You need to be logged in to leave comments. Login now