mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
recreate: unify --always-recompress and --recompress
This commit is contained in:
parent
b2953357ed
commit
dcfbd39125
1 changed files with 10 additions and 8 deletions
|
@ -1323,11 +1323,13 @@ def do_recreate(self, args, repository, manifest, key, cache):
|
||||||
matcher, include_patterns = self.build_matcher(args.patterns, args.paths)
|
matcher, include_patterns = self.build_matcher(args.patterns, args.paths)
|
||||||
self.output_list = args.output_list
|
self.output_list = args.output_list
|
||||||
self.output_filter = args.output_filter
|
self.output_filter = args.output_filter
|
||||||
|
recompress = args.recompress != 'never'
|
||||||
|
always_recompress = args.recompress == 'always'
|
||||||
|
|
||||||
recreater = ArchiveRecreater(repository, manifest, key, cache, matcher,
|
recreater = ArchiveRecreater(repository, manifest, key, cache, matcher,
|
||||||
exclude_caches=args.exclude_caches, exclude_if_present=args.exclude_if_present,
|
exclude_caches=args.exclude_caches, exclude_if_present=args.exclude_if_present,
|
||||||
keep_exclude_tags=args.keep_exclude_tags, chunker_params=args.chunker_params,
|
keep_exclude_tags=args.keep_exclude_tags, chunker_params=args.chunker_params,
|
||||||
compression=args.compression, recompress=args.recompress, always_recompress=args.always_recompress,
|
compression=args.compression, recompress=recompress, always_recompress=always_recompress,
|
||||||
progress=args.progress, stats=args.stats,
|
progress=args.progress, stats=args.stats,
|
||||||
file_status_printer=self.print_file_status,
|
file_status_printer=self.print_file_status,
|
||||||
checkpoint_interval=args.checkpoint_interval,
|
checkpoint_interval=args.checkpoint_interval,
|
||||||
|
@ -2922,8 +2924,7 @@ def process_epilog(epilog):
|
||||||
Note that all paths in an archive are relative, therefore absolute patterns/paths
|
Note that all paths in an archive are relative, therefore absolute patterns/paths
|
||||||
will *not* match (--exclude, --exclude-from, PATHs).
|
will *not* match (--exclude, --exclude-from, PATHs).
|
||||||
|
|
||||||
--recompress: all chunks seen will be recompressed using the --compression
|
--recompress allows to change the compression of existing data in archives.
|
||||||
specified.
|
|
||||||
Due to how Borg stores compressed size information this might display
|
Due to how Borg stores compressed size information this might display
|
||||||
incorrect information for archives that were not recreated at the same time.
|
incorrect information for archives that were not recreated at the same time.
|
||||||
There is no risk of data loss by this.
|
There is no risk of data loss by this.
|
||||||
|
@ -3013,11 +3014,12 @@ def process_epilog(epilog):
|
||||||
type=CompressionSpec, default=CompressionSpec('lz4'), metavar='COMPRESSION',
|
type=CompressionSpec, default=CompressionSpec('lz4'), metavar='COMPRESSION',
|
||||||
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', action='store_true',
|
archive_group.add_argument('--recompress', dest='recompress', nargs='?', default='never', const='if-different',
|
||||||
help='recompress chunks according to --compression.')
|
choices=('never', 'if-different', 'always'),
|
||||||
archive_group.add_argument('--always-recompress', dest='always_recompress', action='store_true',
|
help='recompress data chunks according to --compression if "if-different". '
|
||||||
help='always recompress chunks, don\'t skip chunks already compressed with the same '
|
'When "always", chunks that are already compressed that way are not skipped, '
|
||||||
'algorithm.')
|
'but compressed again. Only the algorithm is considered for "if-different", '
|
||||||
|
'not the compression level (if any).')
|
||||||
archive_group.add_argument('--chunker-params', dest='chunker_params',
|
archive_group.add_argument('--chunker-params', dest='chunker_params',
|
||||||
type=ChunkerParams, default=CHUNKER_PARAMS,
|
type=ChunkerParams, default=CHUNKER_PARAMS,
|
||||||
metavar='PARAMS',
|
metavar='PARAMS',
|
||||||
|
|
Loading…
Reference in a new issue