##// END OF EJS Templates
transaction: use posixfile and unlink from util...
Adrian Buehlmann -
r13408:19ad316e default
parent child Browse files
Show More
@@ -13,7 +13,7 b''
13 13
14 14 from i18n import _
15 15 import os, errno
16 import error
16 import error, util
17 17
18 18 def active(func):
19 19 def _active(self, *args, **kwds):
@@ -38,11 +38,11 b' def _playback(journal, report, opener, e'
38 38 fp = opener(f)
39 39 fn = fp.name
40 40 fp.close()
41 os.unlink(fn)
41 util.unlink(fn)
42 42 except (IOError, OSError), inst:
43 43 if inst.errno != errno.ENOENT:
44 44 raise
45 os.unlink(journal)
45 util.unlink(journal)
46 46
47 47 class transaction(object):
48 48 def __init__(self, report, opener, journal, after=None, createmode=None):
@@ -56,7 +56,7 b' class transaction(object):'
56 56 self.journal = journal
57 57 self._queue = []
58 58
59 self.file = open(self.journal, "w")
59 self.file = util.posixfile(self.journal, "w")
60 60 if createmode is not None:
61 61 os.chmod(self.journal, createmode & 0666)
62 62
@@ -137,7 +137,7 b' class transaction(object):'
137 137 if self.after:
138 138 self.after()
139 139 if os.path.isfile(self.journal):
140 os.unlink(self.journal)
140 util.unlink(self.journal)
141 141 self.journal = None
142 142
143 143 @active
@@ -155,7 +155,7 b' class transaction(object):'
155 155 try:
156 156 if not self.entries:
157 157 if self.journal:
158 os.unlink(self.journal)
158 util.unlink(self.journal)
159 159 return
160 160
161 161 self.report(_("transaction abort!\n"))
@@ -173,7 +173,7 b' class transaction(object):'
173 173 def rollback(opener, file, report):
174 174 entries = []
175 175
176 fp = open(file)
176 fp = util.posixfile(file)
177 177 lines = fp.readlines()
178 178 fp.close()
179 179 for l in lines:
General Comments 0
You need to be logged in to leave comments. Login now