Преглед изворни кода

With the "create" action, only one of "--list" ("--files") and "--progress" flags can be used.

Dan Helfman пре 2 година
родитељ
комит
9b83afe491
3 измењених фајлова са 14 додато и 0 уклоњено
  1. 2 0
      NEWS
  2. 5 0
      borgmatic/commands/arguments.py
  3. 7 0
      tests/integration/commands/test_arguments.py

+ 2 - 0
NEWS

@@ -1,5 +1,7 @@
 1.7.8.dev0
 1.7.8.dev0
  * #621: Add optional authentication to the ntfy monitoring hook.
  * #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
 1.7.7
  * #642: Add MySQL database hook "add_drop_database" configuration option to control whether dumped
  * #642: Add MySQL database hook "add_drop_database" configuration option to control whether dumped

+ 5 - 0
borgmatic/commands/arguments.py

@@ -833,6 +833,11 @@ def parse_arguments(*unparsed_arguments):
             'The --excludes flag has been replaced with exclude_patterns in configuration.'
             '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 (
     if (
         ('list' in arguments and 'rinfo' in arguments and arguments['list'].json)
         ('list' in arguments and 'rinfo' in arguments and arguments['list'].json)
         or ('list' in arguments and 'info' in arguments and arguments['list'].json)
         or ('list' in arguments and 'info' in arguments and arguments['list'].json)

+ 7 - 0
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')
         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():
 def test_parse_arguments_allows_json_with_list_or_info():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])