Patchwork [hglib] client: fix passing multiple config settings

login
register
mail settings
Submitter Julien Cristau
Date Sept. 30, 2014, 10:04 a.m.
Message ID <91af1467940b91946b1b.1412071480@crater1.logilab.fr>
Download mbox | patch
Permalink /patch/6036/
State Not Applicable
Headers show

Comments

Julien Cristau - Sept. 30, 2014, 10:04 a.m.
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1412071234 -7200
#      Tue Sep 30 12:00:34 2014 +0200
# Node ID 91af1467940b91946b1b980db026f194c0bf3f7b
# Parent  a3373bf28ccbd84018e7e43fcee079ba02c7cb0c
client: fix passing multiple config settings
Matt Mackall - Sept. 30, 2014, 5:58 p.m.
On Tue, 2014-09-30 at 12:04 +0200, Julien Cristau wrote:
> # HG changeset patch
> # User Julien Cristau <julien.cristau@logilab.fr>
> # Date 1412071234 -7200
> #      Tue Sep 30 12:00:34 2014 +0200
> # Node ID 91af1467940b91946b1b980db026f194c0bf3f7b
> # Parent  a3373bf28ccbd84018e7e43fcee079ba02c7cb0c
> client: fix passing multiple config settings

Queued, thanks.

Patch

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')])