##// END OF EJS Templates
transaction: handle missing file in backupentries (instead of using entries)...
Pierre-Yves David -
r23278:aa194327 default
parent child Browse files
Show More
@@ -44,14 +44,21 b' def _playback(journal, report, opener, e'
44 44
45 45 backupfiles = []
46 46 for f, b in backupentries:
47 filepath = opener.join(f)
48 backuppath = opener.join(b)
49 try:
50 util.copyfile(backuppath, filepath)
51 backupfiles.append(b)
52 except IOError:
53 report(_("failed to recover %s\n") % f)
54 raise
47 if b:
48 filepath = opener.join(f)
49 backuppath = opener.join(b)
50 try:
51 util.copyfile(backuppath, filepath)
52 backupfiles.append(b)
53 except IOError:
54 report(_("failed to recover %s\n") % f)
55 raise
56 else:
57 try:
58 opener.unlink(f)
59 except (IOError, OSError), inst:
60 if inst.errno != errno.ENOENT:
61 raise
55 62
56 63 opener.unlink(journal)
57 64 backuppath = "%s.backupfiles" % journal
@@ -85,6 +92,7 b' class transaction(object):'
85 92 self.entries = []
86 93 self.map = {}
87 94 # a list of ('path', 'backuppath') entries.
95 # if 'backuppath' is empty, no file existed at backup time
88 96 self._backupentries = []
89 97 self._backupmap = {}
90 98 self.journal = journal
@@ -179,8 +187,7 b' class transaction(object):'
179 187 backuppath = self.opener.join(backupfile)
180 188 util.copyfiles(filepath, backuppath, hardlink=hardlink)
181 189 else:
182 self.add(file, 0)
183 return
190 backupfile = ''
184 191
185 192 self._backupentries.append((file, backupfile))
186 193 self._backupmap[file] = len(self._backupentries) - 1
@@ -331,7 +338,8 b' class transaction(object):'
331 338 if self.opener.isfile(self._backupjournal):
332 339 self.opener.unlink(self._backupjournal)
333 340 for _f, b in self._backupentries:
334 self.opener.unlink(b)
341 if b:
342 self.opener.unlink(b)
335 343 self._backupentries = []
336 344 self.journal = None
337 345 # run post close action
General Comments 0
You need to be logged in to leave comments. Login now