mirror of https://github.com/borgbackup/borg.git
commit
005c5a25cb
|
@ -45,7 +45,7 @@ from .crypto.key import key_creator, key_argument_names, tam_required_file, tam_
|
||||||
from .crypto.keymanager import KeyManager
|
from .crypto.keymanager import KeyManager
|
||||||
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
||||||
from .helpers import Error, NoManifestError, set_ec
|
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 PrefixSpec, SortBySpec, HUMAN_SORT_KEYS, FilesCacheMode
|
||||||
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
||||||
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
||||||
|
@ -1755,8 +1755,10 @@ class Archiver:
|
||||||
def cache_validate(section, name, value=None, check_value=True):
|
def cache_validate(section, name, value=None, check_value=True):
|
||||||
if section not in ['cache', ]:
|
if section not in ['cache', ]:
|
||||||
raise ValueError('Invalid section')
|
raise ValueError('Invalid section')
|
||||||
# I looked at the cache config and did not see anything a user would want to edit,
|
if name in ['previous_location', ]:
|
||||||
# so, for now, raise for any key name
|
if check_value:
|
||||||
|
Location(value)
|
||||||
|
else:
|
||||||
raise ValueError('Invalid name')
|
raise ValueError('Invalid name')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -2562,7 +2564,9 @@ class Archiver:
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups',
|
parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups',
|
||||||
add_help=False)
|
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,
|
parser.common_options = self.CommonOptions(define_common_options,
|
||||||
suffix_precedence=('_maincommand', '_midcommand', '_subcommand'))
|
suffix_precedence=('_maincommand', '_midcommand', '_subcommand'))
|
||||||
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,
|
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,
|
||||||
|
@ -2570,7 +2574,6 @@ class Archiver:
|
||||||
parser.common_options.add_common_group(parser, '_maincommand', provide_defaults=True)
|
parser.common_options.add_common_group(parser, '_maincommand', provide_defaults=True)
|
||||||
|
|
||||||
common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog)
|
common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog)
|
||||||
# some empty defaults for all subparsers
|
|
||||||
common_parser.set_defaults(paths=[], patterns=[])
|
common_parser.set_defaults(paths=[], patterns=[])
|
||||||
parser.common_options.add_common_group(common_parser, '_subcommand')
|
parser.common_options.add_common_group(common_parser, '_subcommand')
|
||||||
|
|
||||||
|
@ -3754,12 +3757,17 @@ class Archiver:
|
||||||
type=CompressionSpec, default=CompressionSpec('lz4'),
|
type=CompressionSpec, default=CompressionSpec('lz4'),
|
||||||
help='select compression algorithm, see the output of the '
|
help='select compression algorithm, see the output of the '
|
||||||
'"borg help compression" command for details.')
|
'"borg help compression" command for details.')
|
||||||
archive_group.add_argument('--recompress', dest='recompress', nargs='?', default='never', const='if-different',
|
archive_group.add_argument('--recompress', metavar='MODE', dest='recompress', nargs='?',
|
||||||
choices=('never', 'if-different', 'always'),
|
default='never', const='if-different', choices=('never', 'if-different', 'always'),
|
||||||
help='recompress data chunks according to ``--compression`` if `if-different`. '
|
help='recompress data chunks according to ``--compression``. '
|
||||||
'When `always`, chunks that are already compressed that way are not skipped, '
|
'MODE `if-different`: '
|
||||||
'but compressed again. Only the algorithm is considered for `if-different`, '
|
'recompress if current compression is with a different compression algorithm '
|
||||||
'not the compression level (if any).')
|
'(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',
|
archive_group.add_argument('--chunker-params', metavar='PARAMS', dest='chunker_params',
|
||||||
type=ChunkerParams, default=CHUNKER_PARAMS,
|
type=ChunkerParams, default=CHUNKER_PARAMS,
|
||||||
help='specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, '
|
help='specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, '
|
||||||
|
|
Loading…
Reference in New Issue