diff --git a/NEWS b/NEWS index 24b49decc..8fad15f45 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ 1.7.8.dev0 * #621: Add optional authentication to the ntfy monitoring hook. + * With the "create" action, only one of "--list" ("--files") and "--progress" flags can be used. + This lines up with the new behavior in Borg 2.0.0b5. 1.7.7 * #642: Add MySQL database hook "add_drop_database" configuration option to control whether dumped diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py index 7a1a34a16..6061da9f8 100644 --- a/borgmatic/commands/arguments.py +++ b/borgmatic/commands/arguments.py @@ -833,6 +833,11 @@ def parse_arguments(*unparsed_arguments): 'The --excludes flag has been replaced with exclude_patterns in configuration.' ) + if 'create' in arguments and arguments['create'].list_files and arguments['create'].progress: + raise ValueError( + 'With the create action, only one of --list (--files) and --progress flags can be used.' + ) + if ( ('list' in arguments and 'rinfo' in arguments and arguments['list'].json) or ('list' in arguments and 'info' in arguments and arguments['list'].json) diff --git a/tests/integration/commands/test_arguments.py b/tests/integration/commands/test_arguments.py index f2d204918..cb001c104 100644 --- a/tests/integration/commands/test_arguments.py +++ b/tests/integration/commands/test_arguments.py @@ -422,6 +422,13 @@ def test_parse_arguments_with_list_flag_but_no_relevant_action_raises_value_erro module.parse_arguments('--list', 'rcreate') +def test_parse_arguments_disallows_list_with_progress_for_create_action(): + flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default']) + + with pytest.raises(ValueError): + module.parse_arguments('create', '--list', '--progress') + + def test_parse_arguments_allows_json_with_list_or_info(): flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])