##// 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 backupfiles = []
45 backupfiles = []
46 for f, b in backupentries:
46 for f, b in backupentries:
47 filepath = opener.join(f)
47 if b:
48 backuppath = opener.join(b)
48 filepath = opener.join(f)
49 try:
49 backuppath = opener.join(b)
50 util.copyfile(backuppath, filepath)
50 try:
51 backupfiles.append(b)
51 util.copyfile(backuppath, filepath)
52 except IOError:
52 backupfiles.append(b)
53 report(_("failed to recover %s\n") % f)
53 except IOError:
54 raise
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 opener.unlink(journal)
63 opener.unlink(journal)
57 backuppath = "%s.backupfiles" % journal
64 backuppath = "%s.backupfiles" % journal
@@ -85,6 +92,7 b' class transaction(object):'
85 self.entries = []
92 self.entries = []
86 self.map = {}
93 self.map = {}
87 # a list of ('path', 'backuppath') entries.
94 # a list of ('path', 'backuppath') entries.
95 # if 'backuppath' is empty, no file existed at backup time
88 self._backupentries = []
96 self._backupentries = []
89 self._backupmap = {}
97 self._backupmap = {}
90 self.journal = journal
98 self.journal = journal
@@ -179,8 +187,7 b' class transaction(object):'
179 backuppath = self.opener.join(backupfile)
187 backuppath = self.opener.join(backupfile)
180 util.copyfiles(filepath, backuppath, hardlink=hardlink)
188 util.copyfiles(filepath, backuppath, hardlink=hardlink)
181 else:
189 else:
182 self.add(file, 0)
190 backupfile = ''
183 return
184
191
185 self._backupentries.append((file, backupfile))
192 self._backupentries.append((file, backupfile))
186 self._backupmap[file] = len(self._backupentries) - 1
193 self._backupmap[file] = len(self._backupentries) - 1
@@ -331,7 +338,8 b' class transaction(object):'
331 if self.opener.isfile(self._backupjournal):
338 if self.opener.isfile(self._backupjournal):
332 self.opener.unlink(self._backupjournal)
339 self.opener.unlink(self._backupjournal)
333 for _f, b in self._backupentries:
340 for _f, b in self._backupentries:
334 self.opener.unlink(b)
341 if b:
342 self.opener.unlink(b)
335 self._backupentries = []
343 self._backupentries = []
336 self.journal = None
344 self.journal = None
337 # run post close action
345 # run post close action
General Comments 0
You need to be logged in to leave comments. Login now