[PATCH] Trivial - transaction destructor fix
K Thananchayan
thananck at yahoo.com
Fri Jul 1 05:15:40 CDT 2005
The attached patch fixes the destructor of transaction
to behave sanely during 'journal already exists'
exception.
This also correctly removes the transaction file after
abort in the other OS.
Thanks,
-thanan
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
-------------- next part --------------
# HG changeset patch
# User thananck at yahoo.com
# Node ID 9eea3299bbbf0322f12d337f70b7831351d4bc0e
# Parent 877942ea8480485d25e60830f1e922e941ad2605
The destructor of tranaction no longer complain that attribute 'entries' does
not exists when journal already exists. Also, it closes the transaction file
before unlinking it to play safe for the other OS.
diff -r 877942ea8480 -r 9eea3299bbbf mercurial/transaction.py
--- a/mercurial/transaction.py Fri Jul 01 10:10:56 2005
+++ b/mercurial/transaction.py Fri Jul 01 10:16:13 2005
@@ -31,8 +31,11 @@
self.file = open(self.journal, "w")
def __del__(self):
- if self.entries: self.abort()
- try: os.unlink(self.journal)
+ try:
+ # if attr 'entries' does not exists, no cleanup is needed.
+ if self.entries: self.abort()
+ self.file.close()
+ os.unlink(self.journal)
except: pass
def add(self, file, offset):
More information about the Mercurial
mailing list