1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 09:19:31 +00:00
This commit is contained in:
Thomas Waldmann 2015-08-12 15:16:44 +02:00
commit 02ccf37766

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

@ -334,7 +334,6 @@ def report_error(msg):
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 @@ def get_fd(self, segment):
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 @@ def iter_objects(self, segment, include_data=False):
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())