[PATCH hglib] client: fix passing multiple config settings

Julien Cristau julien.cristau at logilab.fr
Tue Sep 30 05:04:40 CDT 2014


# HG changeset patch
# User Julien Cristau <julien.cristau at logilab.fr>
# Date 1412071234 -7200
#      Tue Sep 30 12:00:34 2014 +0200
# Node ID 91af1467940b91946b1b980db026f194c0bf3f7b
# Parent  a3373bf28ccbd84018e7e43fcee079ba02c7cb0c
client: fix passing multiple config settings

diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -45,11 +45,12 @@ class hgclient(object):
         self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe',
                 '--config', 'ui.interactive=True']
         if path:
             self._args += ['-R', path]
         if configs:
-            self._args += ['--config'] + configs
+            for config in configs:
+                self._args += ['--config', config]
         self._env = {'HGPLAIN': '1'}
         if encoding:
             self._env['HGENCODING'] = encoding
 
         self.server = None
diff --git a/tests/test-config.py b/tests/test-config.py
--- a/tests/test-config.py
+++ b/tests/test-config.py
@@ -23,5 +23,12 @@ class test_config(common.basetest):
     def test_show_source(self):
         config = self.client.config(showsource=True)
 
         self.assertTrue((os.path.abspath('.hg/hgrc') + ':2',
                          'section', 'key', 'value') in config)
+
+
+class test_config_arguments(common.basetest):
+    def test_basic(self):
+        client = hglib.open(configs=['diff.unified=5', 'a.b=foo'])
+        self.assertEqual(client.config('a'), [('a', 'b', 'foo')])
+        self.assertEqual(client.config('diff'), [('diff', 'unified', '5')])


More information about the Mercurial-devel mailing list