mirror of https://github.com/borgbackup/borg.git
Merge branch 'minor' of https://github.com/sourcejedi/attic
This commit is contained in:
commit
02ccf37766
|
@ -334,7 +334,6 @@ class Repository:
|
|||
report_error('Adding commit tag to segment {}'.format(transaction_id))
|
||||
self.io.segment = transaction_id + 1
|
||||
self.io.write_commit()
|
||||
self.io.close_segment()
|
||||
if current_index and not repair:
|
||||
if len(current_index) != len(self.index):
|
||||
report_error('Index object count mismatch. {} != {}'.format(len(current_index), len(self.index)))
|
||||
|
@ -517,6 +516,9 @@ class LoggedIO:
|
|||
return fd
|
||||
|
||||
def delete_segment(self, segment):
|
||||
fd = self.fds.pop(segment)
|
||||
if fd is not None:
|
||||
fd.close()
|
||||
try:
|
||||
os.unlink(self.segment_filename(segment))
|
||||
except OSError:
|
||||
|
@ -559,7 +561,9 @@ class LoggedIO:
|
|||
header = fd.read(self.header_fmt.size)
|
||||
|
||||
def recover_segment(self, segment, filename):
|
||||
self.fds.pop(segment).close()
|
||||
fd = self.fds.pop(segment)
|
||||
if fd is not None:
|
||||
fd.close()
|
||||
# FIXME: save a copy of the original file
|
||||
with open(filename, 'rb') as fd:
|
||||
data = memoryview(fd.read())
|
||||
|
|
Loading…
Reference in New Issue