--- a/examples/log.lua Sun Sep 11 01:08:22 2016 +0800
+++ b/examples/log.lua Fri Sep 16 07:55:11 2016 +0800
local client = hglib.Client.open()
-client:runcommand('clone', '-U', 'https://bitbucket.org/av6/lua-hglib', '/tmp/testrepo')
-local code, o, e, d = client:runcommand('log', '-l', '5', '-T', 'json', '-R', '/tmp/testrepo')
+client:runcommand({'clone', '-U', 'https://bitbucket.org/av6/lua-hglib', '/tmp/testrepo'})
+local code, o, e, d = client:runcommand({'log', '-l', '5', '-T', 'json', '-R', '/tmp/testrepo'})
--- a/examples/version.lua Sun Sep 11 01:08:22 2016 +0800
+++ b/examples/version.lua Fri Sep 16 07:55:11 2016 +0800
local client = hglib.Client.open()
-local code, o, e, d = client:runcommand('version', '--quiet')
+local code, o, e, d = client:runcommand({'version', '--quiet'})
--- a/hglib.lua Sun Sep 11 01:08:22 2016 +0800
+++ b/hglib.lua Fri Sep 16 07:55:11 2016 +0800
-function Client:runcommand(...)
+function Client:runcommand(command)
if not self.capabilities.runcommand then
return nil, '', 'runcommand is not supported by this command server', ''
self.wh:write('runcommand\n')
- write_block(self.wh, ...)
+ write_block(self.wh, unpack(command))
--- a/spec/hglib_spec.lua Sun Sep 11 01:08:22 2016 +0800
+++ b/spec/hglib_spec.lua Fri Sep 16 07:55:11 2016 +0800
it('can use runcommand to request version', function()
local client = hglib.Client.open()
- local code, o, e, d = client:runcommand('version', '--verbose')
+ local code, o, e, d = client:runcommand({'version', '--verbose'})
assert.are_equal(0, code)
assert.is_not_nil(o:find('Mercurial Distributed SCM'))
it('can use runcommand to run nonexistent command', function()
local client = hglib.Client.open()
- local code, o, e, d = client:runcommand('extirpate')
+ local code, o, e, d = client:runcommand({'extirpate'})
assert.are_equal(255, code)
assert.is_not_nil(o:find('use "hg help" for the full list of commands'))
it('can use runcommand to inspect this repo', function()
local client = hglib.Client.open('.')
- local code, o, e, d = client:runcommand('log', '-r0')
+ local code, o, e, d = client:runcommand({'log', '-r0'})
assert.are_equal(0, code)
assert.is_not_nil(o:find('hglib: absolute basics'))