Skip to content

Commit

Permalink
Show an error message when --dry-run & --stats are used simultaneously (
Browse files Browse the repository at this point in the history
#3305)

show an error when --dry-run & --stats are both used, fixes #3298
  • Loading branch information
milkey-mouse authored and ThomasWaldmann committed Nov 10, 2017
1 parent 726dbdf commit cffac7e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/borg/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2669,8 +2669,9 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
When using ``--stats``, you will get some statistics about how much data was
added - the "This Archive" deduplicated size there is most interesting as that is
how much your repository will grow.
Please note that the "All archives" stats refer to the state after creation.
how much your repository will grow. Please note that the "All archives" stats refer to
the state after creation. Also, the ``--stats`` and ``--dry-run`` options are mutually
exclusive because the data is not actually compressed and deduplicated during a dry run.
See the output of the "borg help patterns" command for more help on exclude patterns.
See the output of the "borg help placeholders" command for more help on placeholders.
Expand Down Expand Up @@ -2738,10 +2739,12 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
help='create backup')
subparser.set_defaults(func=self.do_create)

subparser.add_argument('-n', '--dry-run', dest='dry_run', action='store_true',
dryrun_group = subparser.add_mutually_exclusive_group()
dryrun_group.add_argument('-n', '--dry-run', dest='dry_run', action='store_true',
help='do not create a backup archive')
subparser.add_argument('-s', '--stats', dest='stats', action='store_true',
dryrun_group.add_argument('-s', '--stats', dest='stats', action='store_true',
help='print statistics for the created archive')

subparser.add_argument('--list', dest='output_list', action='store_true',
help='output verbose list of items (files, dirs, ...)')
subparser.add_argument('--filter', metavar='STATUSCHARS', dest='output_filter',
Expand Down

0 comments on commit cffac7e

Please sign in to comment.