Show More
@@ -10,7 +10,8 b' for fp in (sys.stdin, sys.stdout, sys.st' | |||||
10 | util.setbinary(fp) |
|
10 | util.setbinary(fp) | |
11 |
|
11 | |||
12 | opener = scmutil.opener('.', False) |
|
12 | opener = scmutil.opener('.', False) | |
13 |
tr = transaction.transaction(sys.stderr.write, opener, |
|
13 | tr = transaction.transaction(sys.stderr.write, opener, {'store': opener}, | |
|
14 | "undump.journal") | |||
14 | while True: |
|
15 | while True: | |
15 | l = sys.stdin.readline() |
|
16 | l = sys.stdin.readline() | |
16 | if not l: |
|
17 | if not l: |
@@ -882,7 +882,8 b' class localrepository(object):' | |||||
882 | self._writejournal(desc) |
|
882 | self._writejournal(desc) | |
883 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |
|
883 | renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | |
884 | rp = report and report or self.ui.warn |
|
884 | rp = report and report or self.ui.warn | |
885 | tr = transaction.transaction(rp, self.sopener, |
|
885 | vfsmap = {'plain': self.opener} # root of .hg/ | |
|
886 | tr = transaction.transaction(rp, self.sopener, vfsmap, | |||
886 | "journal", |
|
887 | "journal", | |
887 | aftertrans(renames), |
|
888 | aftertrans(renames), | |
888 | self.store.createmode, |
|
889 | self.store.createmode, |
@@ -70,8 +70,8 b' def _playback(journal, report, opener, e' | |||||
70 | opener.unlink(f) |
|
70 | opener.unlink(f) | |
71 |
|
71 | |||
72 | class transaction(object): |
|
72 | class transaction(object): | |
73 |
def __init__(self, report, opener, journal, after=None, |
|
73 | def __init__(self, report, opener, vfsmap, journal, after=None, | |
74 | onclose=None, onabort=None): |
|
74 | createmode=None, onclose=None, onabort=None): | |
75 | """Begin a new transaction |
|
75 | """Begin a new transaction | |
76 |
|
76 | |||
77 | Begins a new transaction that allows rolling back writes in the event of |
|
77 | Begins a new transaction that allows rolling back writes in the event of | |
@@ -87,7 +87,12 b' class transaction(object):' | |||||
87 | self.count = 1 |
|
87 | self.count = 1 | |
88 | self.usages = 1 |
|
88 | self.usages = 1 | |
89 | self.report = report |
|
89 | self.report = report | |
|
90 | # a vfs to the store content | |||
90 | self.opener = opener |
|
91 | self.opener = opener | |
|
92 | # a map to access file in various {location -> vfs} | |||
|
93 | vfsmap = vfsmap.copy() | |||
|
94 | vfsmap[''] = opener # set default value | |||
|
95 | self._vfsmap = vfsmap | |||
91 | self.after = after |
|
96 | self.after = after | |
92 | self.onclose = onclose |
|
97 | self.onclose = onclose | |
93 | self.onabort = onabort |
|
98 | self.onabort = onabort |
General Comments 0
You need to be logged in to leave comments.
Login now