Show More
@@ -45,7 +45,11 b' def _playback(journal, report, opener, v' | |||||
45 |
|
45 | |||
46 | backupfiles = [] |
|
46 | backupfiles = [] | |
47 | for l, f, b, c in backupentries: |
|
47 | for l, f, b, c in backupentries: | |
|
48 | if l not in vfsmap and c: | |||
|
49 | report("couldn't handle %s: unknown cache location %s\n" | |||
|
50 | % (b, l)) | |||
48 | vfs = vfsmap[l] |
|
51 | vfs = vfsmap[l] | |
|
52 | try: | |||
49 | if f and b: |
|
53 | if f and b: | |
50 | filepath = vfs.join(f) |
|
54 | filepath = vfs.join(f) | |
51 | backuppath = vfs.join(b) |
|
55 | backuppath = vfs.join(b) | |
@@ -54,7 +58,6 b' def _playback(journal, report, opener, v' | |||||
54 | backupfiles.append(b) |
|
58 | backupfiles.append(b) | |
55 | except IOError: |
|
59 | except IOError: | |
56 | report(_("failed to recover %s\n") % f) |
|
60 | report(_("failed to recover %s\n") % f) | |
57 | raise |
|
|||
58 | else: |
|
61 | else: | |
59 | target = f or b |
|
62 | target = f or b | |
60 | try: |
|
63 | try: | |
@@ -62,14 +65,21 b' def _playback(journal, report, opener, v' | |||||
62 | except (IOError, OSError), inst: |
|
65 | except (IOError, OSError), inst: | |
63 | if inst.errno != errno.ENOENT: |
|
66 | if inst.errno != errno.ENOENT: | |
64 | raise |
|
67 | raise | |
|
68 | except (IOError, OSError, util.Abort), inst: | |||
|
69 | if not c: | |||
|
70 | raise | |||
65 |
|
71 | |||
66 | opener.unlink(journal) |
|
72 | opener.unlink(journal) | |
67 | backuppath = "%s.backupfiles" % journal |
|
73 | backuppath = "%s.backupfiles" % journal | |
68 | if opener.exists(backuppath): |
|
74 | if opener.exists(backuppath): | |
69 | opener.unlink(backuppath) |
|
75 | opener.unlink(backuppath) | |
|
76 | try: | |||
70 | for f in backupfiles: |
|
77 | for f in backupfiles: | |
71 | if opener.exists(f): |
|
78 | if opener.exists(f): | |
72 | opener.unlink(f) |
|
79 | opener.unlink(f) | |
|
80 | except (IOError, OSError, util.Abort), inst: | |||
|
81 | # only pure backup file remains, it is sage to ignore any error | |||
|
82 | pass | |||
73 |
|
83 | |||
74 | class transaction(object): |
|
84 | class transaction(object): | |
75 | def __init__(self, report, opener, vfsmap, journal, after=None, |
|
85 | def __init__(self, report, opener, vfsmap, journal, after=None, | |
@@ -365,10 +375,21 b' class transaction(object):' | |||||
365 | self.file.close() |
|
375 | self.file.close() | |
366 | self._backupsfile.close() |
|
376 | self._backupsfile.close() | |
367 | # cleanup temporary files |
|
377 | # cleanup temporary files | |
368 |
for l, f, b, |
|
378 | for l, f, b, c in self._backupentries: | |
|
379 | if l not in self._vfsmap and c: | |||
|
380 | self.report("couldn't remote %s: unknown cache location %s\n" | |||
|
381 | % (b, l)) | |||
|
382 | continue | |||
369 | vfs = self._vfsmap[l] |
|
383 | vfs = self._vfsmap[l] | |
370 | if not f and b and vfs.exists(b): |
|
384 | if not f and b and vfs.exists(b): | |
|
385 | try: | |||
371 | vfs.unlink(b) |
|
386 | vfs.unlink(b) | |
|
387 | except (IOError, OSError, util.Abort), inst: | |||
|
388 | if not c: | |||
|
389 | raise | |||
|
390 | # Abort may be raise by read only opener | |||
|
391 | self.report("couldn't remote %s: %s\n" | |||
|
392 | % (vfs.join(b), inst)) | |||
372 | self.entries = [] |
|
393 | self.entries = [] | |
373 | if self.after: |
|
394 | if self.after: | |
374 | self.after() |
|
395 | self.after() | |
@@ -376,10 +397,21 b' class transaction(object):' | |||||
376 | self.opener.unlink(self.journal) |
|
397 | self.opener.unlink(self.journal) | |
377 | if self.opener.isfile(self._backupjournal): |
|
398 | if self.opener.isfile(self._backupjournal): | |
378 | self.opener.unlink(self._backupjournal) |
|
399 | self.opener.unlink(self._backupjournal) | |
379 |
for _l, _f, b, |
|
400 | for _l, _f, b, c in self._backupentries: | |
|
401 | if l not in self._vfsmap and c: | |||
|
402 | self.report("couldn't remote %s: unknown cache location" | |||
|
403 | "%s\n" % (b, l)) | |||
|
404 | continue | |||
380 | vfs = self._vfsmap[l] |
|
405 | vfs = self._vfsmap[l] | |
381 | if b and vfs.exists(b): |
|
406 | if b and vfs.exists(b): | |
|
407 | try: | |||
382 | vfs.unlink(b) |
|
408 | vfs.unlink(b) | |
|
409 | except (IOError, OSError, util.Abort), inst: | |||
|
410 | if not c: | |||
|
411 | raise | |||
|
412 | # Abort may be raise by read only opener | |||
|
413 | self.report("couldn't remote %s: %s\n" | |||
|
414 | % (vfs.join(b), inst)) | |||
383 | self._backupentries = [] |
|
415 | self._backupentries = [] | |
384 | self.journal = None |
|
416 | self.journal = None | |
385 | # run post close action |
|
417 | # run post close action |
General Comments 0
You need to be logged in to leave comments.
Login now