borg init -> borg rcreate

this is to complement borg rdelete, see also borg create / delete.
This commit is contained in:
Thomas Waldmann 2022-06-23 09:16:29 +02:00
parent 34b6248d75
commit d00d650d88
4 changed files with 216 additions and 216 deletions

View File

@ -280,7 +280,7 @@ class build_man(Command):
'recreate': ('patterns', 'placeholders', 'compression'), 'recreate': ('patterns', 'placeholders', 'compression'),
'list': ('info', 'diff', 'prune', 'patterns'), 'list': ('info', 'diff', 'prune', 'patterns'),
'info': ('list', 'diff'), 'info': ('list', 'diff'),
'init': ('create', 'delete', 'check', 'list', 'key-import', 'key-export', 'key-change-passphrase'), 'rcreate': ('rdelete', 'rlist', 'check', 'key-import', 'key-export', 'key-change-passphrase'),
'key-import': ('key-export', ), 'key-import': ('key-export', ),
'key-export': ('key-import', ), 'key-export': ('key-import', ),
'mount': ('umount', 'extract'), # Would be cooler if these two were on the same page 'mount': ('umount', 'extract'), # Would be cooler if these two were on the same page

View File

@ -472,8 +472,8 @@ class Archiver:
@with_repository(create=True, exclusive=True, manifest=False) @with_repository(create=True, exclusive=True, manifest=False)
@with_other_repository(key=True, compatibility=(Manifest.Operation.READ, )) @with_other_repository(key=True, compatibility=(Manifest.Operation.READ, ))
def do_init(self, args, repository, *, other_repository=None, other_key=None): def do_rcreate(self, args, repository, *, other_repository=None, other_key=None):
"""Initialize an empty repository""" """Create a new, empty repository"""
path = args.location.canonical_path() path = args.location.canonical_path()
logger.info('Initializing repository at "%s"' % path) logger.info('Initializing repository at "%s"' % path)
try: try:
@ -4383,9 +4383,9 @@ class Archiver:
help='format output as JSON') help='format output as JSON')
define_archive_filters_group(subparser) define_archive_filters_group(subparser)
# borg init # borg rcreate
init_epilog = process_epilog(""" rcreate_epilog = process_epilog("""
This command initializes an empty repository. A repository is a filesystem This command creates a new, empty repository. A repository is a filesystem
directory containing the deduplicated data from zero or more archives. directory containing the deduplicated data from zero or more archives.
Encryption mode TLDR Encryption mode TLDR
@ -4398,7 +4398,7 @@ class Archiver:
:: ::
borg init --encryption repokey /path/to/repo borg rcreate --encryption repokey /path/to/repo
Borg will: Borg will:
@ -4507,11 +4507,11 @@ class Archiver:
Neither is inherently linked to the key derivation function, but since we were going Neither is inherently linked to the key derivation function, but since we were going
to break backwards compatibility anyway we took the opportunity to fix all 3 issues at once. to break backwards compatibility anyway we took the opportunity to fix all 3 issues at once.
""") """)
subparser = subparsers.add_parser('init', parents=[common_parser], add_help=False, subparser = subparsers.add_parser('rcreate', parents=[common_parser], add_help=False,
description=self.do_init.__doc__, epilog=init_epilog, description=self.do_rcreate.__doc__, epilog=rcreate_epilog,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
help='initialize empty repository') help='create a new, empty repository')
subparser.set_defaults(func=self.do_init) subparser.set_defaults(func=self.do_rcreate)
subparser.add_argument('--other-repo', metavar='SRC_REPOSITORY', dest='other_location', subparser.add_argument('--other-repo', metavar='SRC_REPOSITORY', dest='other_location',
type=location_validator(other=True), default=Location(other=True), type=location_validator(other=True), default=Location(other=True),
help='reuse the key material from the other repository') help='reuse the key material from the other repository')

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ def repo_url(request, tmpdir, monkeypatch):
@pytest.fixture(params=["none", "repokey"]) @pytest.fixture(params=["none", "repokey"])
def repo(request, cmd, repo_url): def repo(request, cmd, repo_url):
cmd(f'--repo={repo_url}', 'init', '--encryption', request.param) cmd(f'--repo={repo_url}', 'rcreate', '--encryption', request.param)
return repo_url return repo_url