Page MenuHomePhorge
Diviner libphutil Tech Docs ArcanistHgProxyClient

final class ArcanistHgProxyClient
libphutil Technical Documentation ()

Client for an ArcanistHgProxyServer. This client talks to a PHP process which serves as a proxy in front of a Mercurial server process. The PHP proxy allows multiple clients to use the same Mercurial server.

This class presents an API which is similar to the hg command-line API.

Each client is bound to a specific working copy:

$working_copy = '/path/to/some/hg/working/copy/';
$client = new ArcanistHgProxyClient($working_copy);

For example, to run hg log -l 5 via a client:

$command = array('log', '-l', '5');
list($err, $stdout, $stderr) = $client->executeCommand($command);

The advantage of using this complex mechanism is that commands run in this way do not need to pay the startup overhead for hg and the Python runtime, which is often on the order of 100ms or more per command.

Tasks

Construction

  • public function __construct($working_copy) — Build a new client. This client is bound to a working copy. A server must already be running on this working copy for the client to work.

Configuration

  • public function setSkipHello($skip) — When connecting, do not expect the "capabilities" message.

Executing Mercurial Commands

  • public function executeCommand($argv) — Execute a command (given as a list of arguments) via the command server.

Internals

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function __construct($working_copy)

Build a new client. This client is bound to a working copy. A server must already be running on this working copy for the client to work.

Parameters
string$working_copyPath to a Mercurial working copy.
Return
this//Implicit.//

public function setSkipHello($skip)

When connecting, do not expect the "capabilities" message.

Parameters
bool$skipTrue to skip the "capabilities" message.
Return
this

public function executeCommand($argv)

Execute a command (given as a list of arguments) via the command server.

Parameters
list<string>$argvA list of command arguments, like "log", "-l", "5".
Return
tuple<int, string, string>Return code, stdout and stderr.

private function connectToDaemon()

This method is not documented.
Return
wild

private function launchDaemon()

This method is not documented.
Return
wild