Add support for Borg 2's "rclone://" repository URLs.
All checks were successful
build / test (push) Successful in 6m5s
build / docs (push) Successful in 1m38s

This commit is contained in:
Dan Helfman 2024-10-23 11:10:40 -07:00
parent e391fd196d
commit ad21eb41ae
3 changed files with 11 additions and 2 deletions

2
NEWS
View File

@ -19,6 +19,8 @@
* #911: Add a "key change-passphrase" action to change the passphrase protecting a repository key.
* #921: BREAKING: Change soft failure command hooks to skip only the current repository rather than
all repositories in the configuration file.
* Add support for Borg 2's "rclone://" repository URLs, so you can backup to 70+ cloud storage
services whether or not they support Borg explicitly.
1.8.14
* #896: Fix an error in borgmatic rcreate/init on an empty repository directory with Borg 1.4.

View File

@ -233,7 +233,9 @@ def normalize(config_filename, config):
path=updated_repository_path,
)
)
elif repository_path.startswith('ssh://'):
elif repository_path.startswith('ssh://') or repository_path.startswith(
'rclone://'
):
config['repositories'].append(repository_dict)
else:
rewritten_repository_path = f"ssh://{repository_path.replace(':~', '/~').replace(':/', '/').replace(':', '/./')}"
@ -242,7 +244,7 @@ def normalize(config_filename, config):
dict(
levelno=logging.WARNING,
levelname='WARNING',
msg=f'{config_filename}: Remote repository paths without ssh:// syntax are deprecated and support will be removed from a future release. Interpreting "{repository_path}" as "{rewritten_repository_path}"',
msg=f'{config_filename}: Remote repository paths without ssh:// or rclone:// syntax are deprecated and support will be removed from a future release. Interpreting "{repository_path}" as "{rewritten_repository_path}"',
)
)
)

View File

@ -211,6 +211,11 @@ def test_normalize_sections_with_only_scalar_raises():
{'repositories': [{'path': 'ssh://foo@bar:1234/repo'}]},
True,
),
(
{'repositories': ['rclone://host:/repo']},
{'repositories': [{'path': 'rclone://host:/repo'}]},
True,
),
(
{'repositories': ['file:///repo']},
{'repositories': [{'path': '/repo'}]},