本文整理匯總了PHP中PhabricatorRepository::getRemoteCommandFuture方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorRepository::getRemoteCommandFuture方法的具體用法?PHP PhabricatorRepository::getRemoteCommandFuture怎麽用?PHP PhabricatorRepository::getRemoteCommandFuture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhabricatorRepository
的用法示例。
在下文中一共展示了PhabricatorRepository::getRemoteCommandFuture方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeUpdate
protected function executeUpdate(PhabricatorRepository $repository, $local_path)
{
// This is a local command, but needs credentials.
$future = $repository->getRemoteCommandFuture('fetch --all');
$future->setCWD($local_path);
$future->resolvex();
}
示例2: executeUpdate
protected function executeUpdate(PhabricatorRepository $repository, $local_path)
{
// Run a bunch of sanity checks to detect people checking out repositories
// inside other repositories, making empty directories, pointing the local
// path at some random file or path, etc.
list($err, $stdout) = $repository->execLocalCommand('rev-parse --show-toplevel');
if ($err) {
// Try to raise a more tailored error message in the more common case
// of the user creating an empty directory. (We could try to remove it,
// but might not be able to, and it's much simpler to raise a good
// message than try to navigate those waters.)
if (is_dir($local_path)) {
$files = Filesystem::listDirectory($local_path, $include_hidden = true);
if (!$files) {
throw new Exception("Expected to find a git repository at '{$local_path}', but there " . "is an empty directory there. Remove the directory: the daemon " . "will run 'git clone' for you.");
}
}
throw new Exception("Expected to find a git repository at '{$local_path}', but there is " . "a non-repository directory (with other stuff in it) there. Move or " . "remove this directory (or reconfigure the repository to use a " . "different directory), and then either clone a repository yourself " . "or let the daemon do it.");
} else {
$repo_path = rtrim($stdout, "\n");
if (empty($repo_path)) {
throw new Exception("Expected to find a git repository at '{$local_path}', but " . "there was no result from `git rev-parse --show-toplevel`. " . "Something is misconfigured or broken. The git repository " . "may be inside a '.git/' directory.");
}
if (!Filesystem::pathsAreEquivalent($repo_path, $local_path)) {
throw new Exception("Expected to find repo at '{$local_path}', but the actual " . "git repository root for this directory is '{$repo_path}'. " . "Something is misconfigured. The repository's 'Local Path' should " . "be set to some place where the daemon can check out a working " . "copy, and should not be inside another git repository.");
}
}
// This is a local command, but needs credentials.
$future = $repository->getRemoteCommandFuture('fetch --all --prune');
$future->setCWD($local_path);
$future->resolvex();
}
示例3: executeUpdate
protected function executeUpdate(PhabricatorRepository $repository, $local_path)
{
// This is a local command, but needs credentials.
$future = $repository->getRemoteCommandFuture('pull -u');
$future->setCWD($local_path);
try {
$future->resolvex();
} catch (CommandException $ex) {
$err = $ex->getError();
$stdout = $ex->getStdOut();
// NOTE: Between versions 2.1 and 2.1.1, Mercurial changed the behavior
// of "hg pull" to return 1 in case of a successful pull with no changes.
// This behavior has been reverted, but users who updated between Feb 1,
// 2012 and Mar 1, 2012 will have the erroring version. Do a dumb test
// against stdout to check for this possibility.
// See: https://github.com/facebook/phabricator/issues/101/
// NOTE: Mercurial has translated versions, which translate this error
// string. In a translated version, the string will be something else,
// like "aucun changement trouve". There didn't seem to be an easy way
// to handle this (there are hard ways but this is not a common problem
// and only creates log spam, not application failures). Assume English.
// TODO: Remove this once we're far enough in the future that deployment
// of 2.1 is exceedingly rare?
if ($err == 1 && preg_match('/no changes found/', $stdout)) {
return;
} else {
throw $ex;
}
}
}
示例4: pushToHgRepository
private function pushToHgRepository(PhabricatorRepository $proxy)
{
$future = $proxy->getRemoteCommandFuture('push --verbose --rev tip -- %P', $proxy->getRemoteURIEnvelope());
try {
$future->setCWD($proxy->getLocalPath())->resolvex();
} catch (CommandException $ex) {
if (preg_match('/no changes found/', $ex->getStdOut())) {
// mercurial says nothing changed, but that's good
} else {
throw $ex;
}
}
}