Show More
@@ -294,7 +294,8 b' class localrepository:' | |||||
294 | return filelog(self.opener, f) |
|
294 | return filelog(self.opener, f) | |
295 |
|
295 | |||
296 | def transaction(self): |
|
296 | def transaction(self): | |
297 |
return transaction(self.opener, self.join("journal") |
|
297 | return transaction(self.opener, self.join("journal"), | |
|
298 | self.join("undo")) | |||
298 |
|
299 | |||
299 | def commit(self, parent, update = None, text = ""): |
|
300 | def commit(self, parent, update = None, text = ""): | |
300 | tr = self.transaction() |
|
301 | tr = self.transaction() |
@@ -14,16 +14,16 b'' | |||||
14 | import os |
|
14 | import os | |
15 |
|
15 | |||
16 | class transaction: |
|
16 | class transaction: | |
17 | def __init__(self, opener, journal): |
|
17 | def __init__(self, opener, journal, after = None): | |
18 | self.opener = opener |
|
18 | self.opener = opener | |
|
19 | self.after = after | |||
19 | self.entries = [] |
|
20 | self.entries = [] | |
20 | self.map = {} |
|
21 | self.map = {} | |
21 | self.journal = journal |
|
22 | self.journal = journal | |
22 |
|
23 | |||
23 | # abort here if the journal already exists |
|
24 | # abort here if the journal already exists | |
24 | if os.path.exists(self.journal): |
|
25 | if os.path.exists(self.journal): | |
25 |
|
|
26 | raise "journal already exists!" | |
26 | self.recover() |
|
|||
27 |
|
27 | |||
28 | self.file = open(self.journal, "w") |
|
28 | self.file = open(self.journal, "w") | |
29 |
|
29 | |||
@@ -43,7 +43,10 b' class transaction:' | |||||
43 | def close(self): |
|
43 | def close(self): | |
44 | self.file.close() |
|
44 | self.file.close() | |
45 | self.entries = [] |
|
45 | self.entries = [] | |
46 | os.unlink(self.journal) |
|
46 | if self.after: | |
|
47 | os.rename(self.journal, self.after) | |||
|
48 | else: | |||
|
49 | os.unlink(self.journal) | |||
47 |
|
50 | |||
48 | def abort(self): |
|
51 | def abort(self): | |
49 | if not self.entries: return |
|
52 | if not self.entries: return |
General Comments 0
You need to be logged in to leave comments.
Login now