1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-30 11:11:28 +00:00

Repository: Read v2 hints files

Fixes #1235
This commit is contained in:
Marian Beermann 2016-07-04 00:44:25 +02:00
parent 59077e5bf5
commit e7740458cd
No known key found for this signature in database
GPG key ID: 9B8450B91D1362C1

View file

@ -219,10 +219,14 @@ def prepare_txn(self, transaction_id, do_cleanup=True):
self.io.cleanup(transaction_id)
with open(os.path.join(self.path, 'hints.%d' % transaction_id), 'rb') as fd:
hints = msgpack.unpack(fd)
if hints[b'version'] != 1:
hints_version = hints[b'version']
if hints_version not in (1, 2):
raise ValueError('Unknown hints file version: %d' % hints['version'])
self.segments = hints[b'segments']
self.compact = set(hints[b'compact'])
if hints_version == 1:
self.compact = set(hints[b'compact'])
elif hints_version == 2:
self.compact = set(hints[b'compact'].keys())
def write_index(self):
hints = {b'version': 1,