Page MenuHomePhabricator
Diviner Arcanist Tech Docs ArcanistHgProxyClient

final class ArcanistHgProxyClient
Arcanist 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

Methods

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