Home ⌂Doc Index ◂Up ▴

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 (str)
root directory of the repository
encoding (str)
encoding to be used by the command server
vcs (Hg)
reference to the VCS object
parent (QObject)
reference to the parent object

HgClient.__prompt

__prompt(size, message)

Private method to prompt the user for some input.

size (int)
maximum length of the requested input
message (str)
message sent by the server
Returns:
tuple containing data entered by the user and a flag indicating a password input
Return Type:
tuple of (str, bool)

HgClient.__readChannel

__readChannel()

Private method to read data from the command server.

Returns:
tuple of channel designator and channel data
Return Type:
tuple of (str, int or str or bytes)

HgClient.__readHello

__readHello()

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

Returns:
tuple of flag indicating success and an error message in case of failure
Return Type:
tuple of (bool, str)

HgClient.__runcommand

__runcommand(args, inputChannels, outputChannels)

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

args (list of str)
list of arguments for the command
inputChannels (dict)
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 (dict)
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
Return Type:
int
Raises RuntimeError:
raised to indicate an unexpected command channel

HgClient.__serverFinished

__serverFinished(exitCode, exitStatus)

Private slot connected to the finished signal.

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

HgClient.__writeDataBlock

__writeDataBlock(data)

Private slot to write some data to the command server.

data (str)
data to be sent

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
Return Type:
bool

HgClient.myprompt

myprompt()

HgClient.restartServer

restartServer()

Public method to restart the command server.

Returns:
tuple of flag indicating a successful start and an error message in case of failure
Return Type:
tuple of (bool, str)

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 str)
list of arguments for the command
prompt (func(int, str) -> (str, bool))
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. If an output function is given as well, the prompt data is passed through the output function. The function must return the input data and a flag indicating a password input.
inputData (func(int) -> bytes)
function to reply to bulk data requests by the server. It receives the max number of bytes to return.
output (func(str))
function receiving the data from the server. If a prompt function is given, it is assumed, that the prompt output is passed via this function.
error (func(str))
function receiving error messages from the server
Returns:
tuple of output and errors of the command server. In case output and/or error functions were given, the respective return value will be an empty string.
Return Type:
tuple of (str, str)

HgClient.startServer

startServer()

Public method to start the command server.

Returns:
tuple of flag indicating a successful start and an error message in case of failure
Return Type:
tuple of (bool, str)

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
Return Type:
bool
Up



Home ⌂Doc Index ◂Up ▴