This commit is contained in:
Thomas Waldmann 2015-08-12 15:16:44 +02:00
commit 02ccf37766
1 changed files with 6 additions and 2 deletions

8
borg/repository.py Normal file → Executable file
View File

@ -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())