1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 22:51:35 +00:00

support repo version 1 also, fixes #6811

v2 is the default repo version for borg 2.0.
v1 repos must only be used in a read-only way, e.g. for
--other-repo=V1_REPO with borg init and borg transfer!
This commit is contained in:
Thomas Waldmann 2022-06-29 17:31:50 +02:00
parent a44dbc1dc8
commit 8ebdb0b024

View file

@ -198,6 +198,10 @@ def __init__(self, path, create=False, exclusive=False, lock_wait=None, lock=Tru
self.transaction_doomed = None
self.check_segment_magic = check_segment_magic
self.make_parent_dirs = make_parent_dirs
# v2 is the default repo version for borg 2.0
# v1 repos must only be used in a read-only way, e.g. for
# --other-repo=V1_REPO with borg init and borg transfer!
self.acceptable_repo_versions = (1, 2, )
def __del__(self):
if self.lock:
@ -460,7 +464,7 @@ def open(self, path, exclusive, lock_wait=None, lock=True):
self.close()
raise self.InvalidRepositoryConfig(path, 'no repository section found')
self.version = self.config.getint('repository', 'version')
if self.version not in (2, ): # for now, only work on new repos
if self.version not in self.acceptable_repo_versions:
self.close()
raise self.InvalidRepositoryConfig(
path,