comparison mercurial/transaction.py @ 13:eb87b7dc4236

Fix empty transaction destruction
author mpm@selenic.com
date Wed, 04 May 2005 09:32:39 -0800
parents 8b64243ee17b
children 91f1fa847158
comparison
equal deleted inserted replaced
12:8b64243ee17b 13:eb87b7dc4236
24 raise "Journal already exists!" 24 raise "Journal already exists!"
25 self.file = open(self.journal, "w") 25 self.file = open(self.journal, "w")
26 26
27 def __del__(self): 27 def __del__(self):
28 if self.entries: self.abort() 28 if self.entries: self.abort()
29 self.close() 29 try: os.unlink(self.journal)
30 except: pass
30 31
31 def add(self, file, offset): 32 def add(self, file, offset):
32 self.entries.append((file, offset)) 33 self.entries.append((file, offset))
33 # add enough data to the journal to do the truncate 34 # add enough data to the journal to do the truncate
34 self.file.write("%s\0%d\n" % (file, offset)) 35 self.file.write("%s\0%d\n" % (file, offset))