mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 07:01:59 +00:00
--stats does not work with --dry-run, emit error msg and exit, fixes #4373
This commit is contained in:
parent
f541d6e689
commit
68aff8b8c4
2 changed files with 4 additions and 2 deletions
|
@ -4241,6 +4241,9 @@ def run(self, args):
|
||||||
args.progress |= is_serve
|
args.progress |= is_serve
|
||||||
self._setup_implied_logging(vars(args))
|
self._setup_implied_logging(vars(args))
|
||||||
self._setup_topic_debugging(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
|
||||||
if args.show_version:
|
if args.show_version:
|
||||||
logging.getLogger('borg.output.show-version').info('borgbackup version %s' % __version__)
|
logging.getLogger('borg.output.show-version').info('borgbackup version %s' % __version__)
|
||||||
self.prerun_checks(logger)
|
self.prerun_checks(logger)
|
||||||
|
|
|
@ -1870,10 +1870,9 @@ def test_prune_repository_save_space(self):
|
||||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||||
self.cmd('create', self.repository_location + '::test1', src_dir)
|
self.cmd('create', self.repository_location + '::test1', src_dir)
|
||||||
self.cmd('create', self.repository_location + '::test2', src_dir)
|
self.cmd('create', self.repository_location + '::test2', src_dir)
|
||||||
output = self.cmd('prune', '--list', '--stats', '--dry-run', self.repository_location, '--keep-daily=2')
|
output = self.cmd('prune', '--list', '--dry-run', self.repository_location, '--keep-daily=2')
|
||||||
assert re.search(r'Keeping archive \(rule: daily #1\):\s+test2', output)
|
assert re.search(r'Keeping archive \(rule: daily #1\):\s+test2', output)
|
||||||
assert re.search(r'Would prune:\s+test1', output)
|
assert re.search(r'Would prune:\s+test1', output)
|
||||||
self.assert_in('Deleted data:', output)
|
|
||||||
output = self.cmd('list', self.repository_location)
|
output = self.cmd('list', self.repository_location)
|
||||||
self.assert_in('test1', output)
|
self.assert_in('test1', output)
|
||||||
self.assert_in('test2', output)
|
self.assert_in('test2', output)
|
||||||
|
|
Loading…
Reference in a new issue