Fri, 18 Apr 2014 15:07:48 +0200
Fixed the Mercurial command server client handling large data chunks on slow machines.
(grafted from 1d681235c1b45b2d9cfcf2967f5c869b0d0f2552)
--- 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
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Thu Apr 17 18:22:56 2014 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Fri Apr 18 15:07:48 2014 +0200 @@ -18,8 +18,6 @@ from E5Gui.E5Application import e5App from E5Gui import E5MessageBox -from Globals import isWindowsPlatform - from .Ui_HgLogBrowserDialog import Ui_HgLogBrowserDialog import Preferences @@ -87,10 +85,7 @@ else: self.commandMode = "log" self.bundle = bundle - if isWindowsPlatform(): - self.__hgClient = None - else: - self.__hgClient = vcs.getClient() + self.__hgClient = vcs.getClient() self.__initData()
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Thu Apr 17 18:22:56 2014 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Fri Apr 18 15:07:48 2014 +0200 @@ -16,8 +16,6 @@ from E5Gui.E5Application import e5App from E5Gui import E5MessageBox -from Globals import isWindowsPlatform - from .Ui_HgLogDialog import Ui_HgLogDialog import Utilities @@ -55,10 +53,7 @@ else: self.mode = "log" self.bundle = bundle - if isWindowsPlatform(): - self.__hgClient = None - else: - self.__hgClient = self.vcs.getClient() + self.__hgClient = self.vcs.getClient() self.contents.setHtml( self.trUtf8('<b>Processing your request, please wait...</b>'))