浏览代码

fixup! Add borg config command (fixes #3304)

Don't use list unpacking for function calls in order to support py3.4

Reword basic borg config help

It doesn't edit the repo config, but any borg-related config.
Milkey Mouse 7 年之前
父节点
当前提交
5331b378f7
共有 2 个文件被更改,包括 15 次插入9 次删除
  1. 1 1
      src/borg/archiver.py
  2. 14 8
      src/borg/testsuite/archiver.py

+ 1 - 1
src/borg/archiver.py

@@ -3733,7 +3733,7 @@ class Archiver:
                                           description=self.do_config.__doc__,
                                           epilog=config_epilog,
                                           formatter_class=argparse.RawDescriptionHelpFormatter,
-                                          help='get and set repository config options')
+                                          help='get and set configuration values')
         subparser.set_defaults(func=self.do_config)
         subparser.add_argument('-c', '--cache', dest='cache', action='store_true',
                                help='get and set values from the repo cache')

+ 14 - 8
src/borg/testsuite/archiver.py

@@ -2782,14 +2782,20 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02
         self.create_test_files()
         os.unlink('input/flagfile')
         self.cmd('init', '--encryption=repokey', self.repository_location)
-        for flags in [[], ['--cache']]:
-            for cfg_key in {'testkey', 'testsection.testkey'}:
-                self.cmd('config', self.repository_location, *flags, cfg_key, exit_code=1)
-                self.cmd('config', self.repository_location, *flags, cfg_key, 'testcontents')
-                output = self.cmd('config', self.repository_location, *flags, cfg_key)
-                assert output == 'testcontents\n'
-                self.cmd('config', self.repository_location, *flags, '--delete', cfg_key)
-                self.cmd('config', self.repository_location, *flags, cfg_key, exit_code=1)
+        for cfg_key in {'testkey', 'testsection.testkey'}:
+            self.cmd('config', self.repository_location, cfg_key, exit_code=1)
+            self.cmd('config', self.repository_location, cfg_key, 'testcontents')
+            output = self.cmd('config', self.repository_location, cfg_key)
+            assert output == 'testcontents\n'
+            self.cmd('config', self.repository_location, '--delete', cfg_key)
+            self.cmd('config', self.repository_location, cfg_key, exit_code=1)
+
+            self.cmd('config', self.repository_location, '--cache', cfg_key, exit_code=1)
+            self.cmd('config', self.repository_location, '--cache', cfg_key, 'testcontents')
+            output = self.cmd('config', self.repository_location, '--cache', cfg_key)
+            assert output == 'testcontents\n'
+            self.cmd('config', self.repository_location, '--cache', '--delete', cfg_key)
+            self.cmd('config', self.repository_location, '--cache', cfg_key, exit_code=1)
 
     requires_gnutar = pytest.mark.skipif(not have_gnutar(), reason='GNU tar must be installed for this test.')
     requires_gzip = pytest.mark.skipif(not shutil.which('gzip'), reason='gzip must be installed for this test.')