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