# HG changeset patch # User Idan Kamara # Date 2011-06-21 12:38:10 # Node ID 964a72038bb03dfa9c978526414c1b50522729eb # Parent 5fd5dd9a610a595384b5be6018cceccd98e47507 cmdserver, runcommand: properly handle the client sending no arguments No real reason for a client to do this, but still possible. Previously if the client sent no arguments, a list with an empty string [''] would be used as the arguments to dispatch, which would cause hg to complain about an ambiguous command. Instead, we simply check for no arguments and use an empty list instead (which is equivalent to invoking hg with no args on the command line). diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -171,7 +171,10 @@ class server(object): and writes the return code to the result channel """ length = struct.unpack('>I', self._read(4))[0] - args = self._read(length).split('\0') + if not length: + args = [] + else: + args = self._read(length).split('\0') # copy the ui so changes to it don't persist between requests req = dispatch.request(args, self.ui.copy(), self.repo, self.cin,