Merge pull request #4993 from ThomasWaldmann/prune-stats-dry

ignore --stats when given with --dry-run, but continue, fixes #4373
This commit is contained in:
TW 2020-03-07 19:27:18 +01:00 committed by GitHub
commit de2bbf7c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -4371,8 +4371,10 @@ class Archiver:
self._setup_implied_logging(vars(args))
self._setup_topic_debugging(args)
if getattr(args, 'stats', False) and getattr(args, 'dry_run', False):
logger.error("--stats does not work with --dry-run.")
return self.exit_code
# the data needed for --stats is not computed when using --dry-run, so we can't do it.
# for ease of scripting, we just ignore --stats when given with --dry-run.
logger.warning("Ignoring --stats. It is not supported when using --dry-run.")
args.stats = False
if args.show_version:
logging.getLogger('borg.output.show-version').info('borgbackup version %s' % __version__)
self.prerun_checks(logger, is_serve)