eric6.Plugins.VcsPlugins.vcsMercurial.HgClient

Module implementing an interface to the Mercurial command server.

Global Attributes

None

Classes

HgClient Class implementing the Mercurial command server interface.

Functions

None


HgClient

Class implementing the Mercurial command server interface.

Derived from

QObject

Class Attributes

Channels
InputFormat
OutputFormat
OutputFormatSize
ReturnFormat

Class Methods

None

Methods

HgClient Constructor
__prompt Private method to prompt the user for some input.
__readChannel Private method to read data from the command server.
__readHello Private method to read the hello message sent by the command server.
__runcommand Private method to run a command in the server (low level).
__serverFinished Private slot connected to the finished signal.
__writeDataBlock Private slot to write some data to the command server.
cancel Public method to cancel the running command.
func
isExecuting Public method to check, if the server is executing a command.
myprompt
restartServer Public method to restart the command server.
runcommand Public method to execute a command via the command server.
startServer Public method to start the command server.
stopServer Public method to stop the command server.
wasCanceled Public method to check, if the last command was canceled.

Static Methods

None

HgClient (Constructor)

HgClient(repoPath, encoding, vcs, parent=None)

Constructor

repoPath
root directory of the repository (string)
encoding
encoding to be used by the command server (string)
vcs
reference to the VCS object (Hg)
parent
reference to the parent object (QObject)

HgClient.__prompt

__prompt(size, message)

Private method to prompt the user for some input.

size
maximum length of the requested input (integer)
message
message sent by the server (string)
Returns:
data entered by the user (string)

HgClient.__readChannel

__readChannel()

Private method to read data from the command server.

Returns:
tuple of channel designator and channel data (string, integer or string or bytes)

HgClient.__readHello

__readHello()

Private method to read the hello message sent by the command server.

Returns:
tuple of flag indicating success (boolean) and an error message in case of failure (string)

HgClient.__runcommand

__runcommand(args, inputChannels, outputChannels)

Private method to run a command in the server (low level).

args
list of arguments for the command (list of string)
inputChannels
dictionary of input channels. The dictionary must have the keys 'I' and 'L' and each entry must be a function receiving the number of bytes to write.
outputChannels
dictionary of output channels. The dictionary must have the keys 'o' and 'e' and each entry must be a function receiving the data.
Returns:
result code of the command, -1 if the command server wasn't started or -10, if the command was canceled (integer)
Raises RuntimeError:
raised to indicate an unexpected command channel

HgClient.__serverFinished

__serverFinished(exitCode, exitStatus)

Private slot connected to the finished signal.

exitCode
exit code of the process (integer)
exitStatus
exit status of the process (QProcess.ExitStatus)

HgClient.__writeDataBlock

__writeDataBlock(data)

Private slot to write some data to the command server.

data
data to be sent (string)

HgClient.cancel

cancel()

Public method to cancel the running command.

HgClient.func

func()

HgClient.isExecuting

isExecuting()

Public method to check, if the server is executing a command.

Returns:
flag indicating the execution of a command (boolean)

HgClient.myprompt

myprompt()

HgClient.restartServer

restartServer()

Public method to restart the command server.

Returns:
tuple of flag indicating a successful start (boolean) and an error message (string) in case of failure

HgClient.runcommand

runcommand(args, prompt=None, inputData=None, output=None, error=None)

Public method to execute a command via the command server.

args
list of arguments for the command (list of string)
prompt=
function to reply to prompts by the server. It receives the max number of bytes to return and the contents of the output channel received so far.
inputData=
function to reply to bulk data requests by the server. It receives the max number of bytes to return.
output=
function receiving the data from the server (string). If a prompt function is given, this parameter will be ignored.
error=
function receiving error messages from the server (string)
Returns:
output and errors of the command server (string). In case output and/or error functions were given, the respective return value will be an empty string.

HgClient.startServer

startServer()

Public method to start the command server.

Returns:
tuple of flag indicating a successful start (boolean) and an error message (string) in case of failure

HgClient.stopServer

stopServer()

Public method to stop the command server.

HgClient.wasCanceled

wasCanceled()

Public method to check, if the last command was canceled.

Returns:
flag indicating the cancel state (boolean)
Up