eric6/Plugins/VcsPlugins/vcsMercurial/HgClient.py

changeset 7257
c4d0cac9b5c9
parent 7192
a22eee00b052
child 7360
9190402e4505
equal deleted inserted replaced
7256:4ef3b78ebb4e 7257:c4d0cac9b5c9
8 """ 8 """
9 9
10 import struct 10 import struct
11 import io 11 import io
12 12
13 from PyQt5.QtCore import QProcess, QObject, QByteArray, QCoreApplication, \ 13 from PyQt5.QtCore import (
14 QThread 14 QProcess, QObject, QByteArray, QCoreApplication, QThread
15 )
15 from PyQt5.QtWidgets import QDialog 16 from PyQt5.QtWidgets import QDialog
16 17
17 from .HgUtilities import prepareProcess 18 from .HgUtilities import prepareProcess
18 19
19 20
174 Private method to read data from the command server. 175 Private method to read data from the command server.
175 176
176 @return tuple of channel designator and channel data 177 @return tuple of channel designator and channel data
177 (string, integer or string or bytes) 178 (string, integer or string or bytes)
178 """ 179 """
179 if self.__server.bytesAvailable() > 0 or \ 180 if (
180 self.__server.waitForReadyRead(10000): 181 self.__server.bytesAvailable() > 0 or
182 self.__server.waitForReadyRead(10000)
183 ):
181 data = bytes(self.__server.peek(HgClient.OutputFormatSize)) 184 data = bytes(self.__server.peek(HgClient.OutputFormatSize))
182 if not data or len(data) < HgClient.OutputFormatSize: 185 if not data or len(data) < HgClient.OutputFormatSize:
183 return "", "" 186 return "", ""
184 187
185 channel, length = struct.unpack(HgClient.OutputFormat, data) 188 channel, length = struct.unpack(HgClient.OutputFormat, data)
186 channel = channel.decode(self.__encoding) 189 channel = channel.decode(self.__encoding)
187 if channel in "IL": 190 if channel in "IL":
188 self.__server.read(HgClient.OutputFormatSize) 191 self.__server.read(HgClient.OutputFormatSize)
189 return channel, length 192 return channel, length
190 else: 193 else:
191 if self.__server.bytesAvailable() < \ 194 if (
192 HgClient.OutputFormatSize + length: 195 self.__server.bytesAvailable() <
196 HgClient.OutputFormatSize + length
197 ):
193 return "", "" 198 return "", ""
194 self.__server.read(HgClient.OutputFormatSize) 199 self.__server.read(HgClient.OutputFormatSize)
195 data = self.__server.read(length) 200 data = self.__server.read(length)
196 if channel == "r": 201 if channel == "r":
197 return (channel, data) 202 return (channel, data)

eric ide

mercurial