--- a/README.md Mon Oct 24 00:41:04 2016 +0800
+++ b/README.md Mon Oct 24 14:05:51 2016 +0800
- Maybe use something better than lpc
-- Handle cases when command needs input, but user provided nil
--- a/hglib.lua Mon Oct 24 00:41:04 2016 +0800
+++ b/hglib.lua Mon Oct 24 14:05:51 2016 +0800
local function write_input(length)
write_block(self.wh, input:sub(1, length))
elseif channel == 'd' then
- elseif channel == 'I' and input ~= nil then
+ elseif channel == 'I' then
- elseif channel == 'L' and input ~= nil then
+ elseif channel == 'L' then
write_input(math.min(input:find('\n') or message, message))
elseif channel:lower() ~= channel then
e = e .. '\nhglib: unexpected data on required channel "' .. channel .. '"'
--- a/spec/hglib_spec.lua Mon Oct 24 00:41:04 2016 +0800
+++ b/spec/hglib_spec.lua Mon Oct 24 14:05:51 2016 +0800
assert.are_equal(0, code)
+ local code, o, e, d = client:runcommand({'-R', 'testrepo', 'import', '-'})
+ assert.is_not_nil(o:find('applying patch from stdin'))
+ assert.is_not_nil(e:find('abort: stdin: no diffs found'))
+ assert.are_equal('', d)
+ assert.are_equal(255, code)
local pf = assert(io.open('spec/data/foo.patch', 'rb'))
local patch = pf:read('*all')