Show More
@@ -105,6 +105,19 b' def _playback(' | |||
|
105 | 105 | unlink=True, |
|
106 | 106 | checkambigfiles=None, |
|
107 | 107 | ): |
|
108 | backupfiles = [] | |
|
109 | ||
|
110 | def restore_one_backup(vfs, f, b, checkambig): | |
|
111 | filepath = vfs.join(f) | |
|
112 | backuppath = vfs.join(b) | |
|
113 | try: | |
|
114 | util.copyfile(backuppath, filepath, checkambig=checkambig) | |
|
115 | backupfiles.append((vfs, b)) | |
|
116 | except IOError as exc: | |
|
117 | e_msg = stringutil.forcebytestr(exc) | |
|
118 | report(_(b"failed to recover %s (%s)\n") % (f, e_msg)) | |
|
119 | raise | |
|
120 | ||
|
108 | 121 | for f, o in sorted(dict(entries).items()): |
|
109 | 122 | if o or not unlink: |
|
110 | 123 | checkambig = checkambigfiles and (f, b'') in checkambigfiles |
@@ -129,23 +142,14 b' def _playback(' | |||
|
129 | 142 | except FileNotFoundError: |
|
130 | 143 | pass |
|
131 | 144 | |
|
132 | backupfiles = [] | |
|
133 | 145 | for l, f, b, c in backupentries: |
|
134 | 146 | if l not in vfsmap and c: |
|
135 | 147 | report(b"couldn't handle %s: unknown cache location %s\n" % (b, l)) |
|
136 | 148 | vfs = vfsmap[l] |
|
137 | 149 | try: |
|
150 | checkambig = checkambigfiles and (f, l) in checkambigfiles | |
|
138 | 151 | if f and b: |
|
139 | filepath = vfs.join(f) | |
|
140 | backuppath = vfs.join(b) | |
|
141 | checkambig = checkambigfiles and (f, l) in checkambigfiles | |
|
142 | try: | |
|
143 | util.copyfile(backuppath, filepath, checkambig=checkambig) | |
|
144 | backupfiles.append((vfs, b)) | |
|
145 | except IOError as exc: | |
|
146 | e_msg = stringutil.forcebytestr(exc) | |
|
147 | report(_(b"failed to recover %s (%s)\n") % (f, e_msg)) | |
|
148 | raise | |
|
152 | restore_one_backup(vfs, f, b, checkambig) | |
|
149 | 153 | else: |
|
150 | 154 | target = f or b |
|
151 | 155 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now