Comments
Patch
@@ -43,17 +43,24 @@ def _playback(journal, report, opener, v
backupfiles = []
for l, f, b, _ignore in backupentries:
vfs = vfsmap[l]
filepath = vfs.join(f)
- backuppath = vfs.join(b)
- try:
- util.copyfile(backuppath, filepath)
- backupfiles.append(b)
- except IOError:
- report(_("failed to recover %s\n") % f)
- raise
+ if b:
+ backuppath = vfs.join(b)
+ try:
+ util.copyfile(backuppath, filepath)
+ backupfiles.append(b)
+ except IOError:
+ report(_("failed to recover %s\n") % f)
+ raise
+ else:
+ try:
+ vfs.unlink(f)
+ except (IOError, OSError), inst:
+ if inst.errno != errno.ENOENT:
+ raise
opener.unlink(journal)
backuppath = "%s.backupfiles2" % journal
if opener.exists(backuppath):
opener.unlink(backuppath)
@@ -167,12 +174,11 @@ class transaction(object):
if vfs.exists(file):
filepath = vfs.join(file)
backuppath = self.opener.join(backupfile)
util.copyfiles(filepath, backuppath, hardlink=hardlink)
else:
- self.add(file, 0)
- return
+ backupfile = ''
if self._queue:
self._queue[-1][1].append((file, backupfile))
return
@@ -280,12 +286,13 @@ class transaction(object):
if self.opener.isfile(self.journal):
self.opener.unlink(self.journal)
if self.opener.isfile(self.backupjournal):
self.opener.unlink(self.backupjournal)
for l, _f, b, _ignore in self.backupentries:
- vfs = self._vfsmap[l]
- vfs.unlink(b)
+ if b:
+ vfs = self._vfsmap[l]
+ vfs.unlink(b)
self.backupentries = []
self.journal = None
@active
def abort(self):