diff -r e8a685fd7351 -r d4b642e067e3 Plugins/VcsPlugins/vcsMercurial/HgClient.py --- a/Plugins/VcsPlugins/vcsMercurial/HgClient.py Thu Apr 17 18:22:56 2014 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgClient.py Fri Apr 18 15:07:48 2014 +0200 @@ -174,24 +174,22 @@ @return tuple of channel designator and channel data (string, integer or string or bytes) """ - additionalData = b"" - if self.__server.bytesAvailable() > 0 or \ self.__server.waitForReadyRead(10000): - while bytes(self.__server.peek(1)) not in HgClient.Channels: - additionalData += bytes(self.__server.read(1)) - if additionalData: - return ("o", str(additionalData, self.__encoding, "replace")) - - data = bytes(self.__server.read(HgClient.OutputFormatSize)) - if not data: + data = bytes(self.__server.peek(HgClient.OutputFormatSize)) + if not data or len(data) < HgClient.OutputFormatSize: return "", "" channel, length = struct.unpack(HgClient.OutputFormat, data) channel = channel.decode(self.__encoding) if channel in "IL": + self.__server.read(HgClient.OutputFormatSize) return channel, length else: + if self.__server.bytesAvailable() < \ + HgClient.OutputFormatSize + length: + return "", "" + self.__server.read(HgClient.OutputFormatSize) data = self.__server.read(length) if channel == "r": return (channel, data) @@ -270,7 +268,7 @@ raise RuntimeError( "Unexpected but required channel '{0}'.".format(channel)) - # optional channels + # optional channels or no channel at all else: pass