mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 02:08:54 +00:00
commit
005c5a25cb
1 changed files with 20 additions and 12 deletions
|
@ -45,7 +45,7 @@
|
|||
from .crypto.keymanager import KeyManager
|
||||
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
||||
from .helpers import Error, NoManifestError, set_ec
|
||||
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams
|
||||
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams, Location
|
||||
from .helpers import PrefixSpec, SortBySpec, HUMAN_SORT_KEYS, FilesCacheMode
|
||||
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
||||
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
||||
|
@ -1755,9 +1755,11 @@ def repo_validate(section, name, value=None, check_value=True):
|
|||
def cache_validate(section, name, value=None, check_value=True):
|
||||
if section not in ['cache', ]:
|
||||
raise ValueError('Invalid section')
|
||||
# I looked at the cache config and did not see anything a user would want to edit,
|
||||
# so, for now, raise for any key name
|
||||
raise ValueError('Invalid name')
|
||||
if name in ['previous_location', ]:
|
||||
if check_value:
|
||||
Location(value)
|
||||
else:
|
||||
raise ValueError('Invalid name')
|
||||
|
||||
try:
|
||||
section, name = args.name.split('.')
|
||||
|
@ -2562,7 +2564,9 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
|
|||
|
||||
parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups',
|
||||
add_help=False)
|
||||
parser.set_defaults(fallback2_func=functools.partial(self.do_maincommand_help, parser))
|
||||
# paths and patterns must have an empty list as default everywhere
|
||||
parser.set_defaults(fallback2_func=functools.partial(self.do_maincommand_help, parser),
|
||||
paths=[], patterns=[])
|
||||
parser.common_options = self.CommonOptions(define_common_options,
|
||||
suffix_precedence=('_maincommand', '_midcommand', '_subcommand'))
|
||||
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,
|
||||
|
@ -2570,7 +2574,6 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
|
|||
parser.common_options.add_common_group(parser, '_maincommand', provide_defaults=True)
|
||||
|
||||
common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog)
|
||||
# some empty defaults for all subparsers
|
||||
common_parser.set_defaults(paths=[], patterns=[])
|
||||
parser.common_options.add_common_group(common_parser, '_subcommand')
|
||||
|
||||
|
@ -3754,12 +3757,17 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
|
|||
type=CompressionSpec, default=CompressionSpec('lz4'),
|
||||
help='select compression algorithm, see the output of the '
|
||||
'"borg help compression" command for details.')
|
||||
archive_group.add_argument('--recompress', dest='recompress', nargs='?', default='never', const='if-different',
|
||||
choices=('never', 'if-different', 'always'),
|
||||
help='recompress data chunks according to ``--compression`` if `if-different`. '
|
||||
'When `always`, chunks that are already compressed that way are not skipped, '
|
||||
'but compressed again. Only the algorithm is considered for `if-different`, '
|
||||
'not the compression level (if any).')
|
||||
archive_group.add_argument('--recompress', metavar='MODE', dest='recompress', nargs='?',
|
||||
default='never', const='if-different', choices=('never', 'if-different', 'always'),
|
||||
help='recompress data chunks according to ``--compression``. '
|
||||
'MODE `if-different`: '
|
||||
'recompress if current compression is with a different compression algorithm '
|
||||
'(the level is not considered). '
|
||||
'MODE `always`: '
|
||||
'recompress even if current compression is with the same compression algorithm '
|
||||
'(use this to change the compression level). '
|
||||
'MODE `never` (default): '
|
||||
'do not recompress.')
|
||||
archive_group.add_argument('--chunker-params', metavar='PARAMS', dest='chunker_params',
|
||||
type=ChunkerParams, default=CHUNKER_PARAMS,
|
||||
help='specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, '
|
||||
|
|
Loading…
Reference in a new issue