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