本文整理汇总了PHP中PhabricatorRepository::execLocalCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepository::execLocalCommand方法的具体用法?PHP PhabricatorRepository::execLocalCommand怎么用?PHP PhabricatorRepository::execLocalCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorRepository
的用法示例。
在下文中一共展示了PhabricatorRepository::execLocalCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: mercurialPathExists
private function mercurialPathExists(PhabricatorRepository $repository, $path, $rev)
{
if ($path == '/') {
return true;
}
// NOTE: For directories, this grabs the entire directory contents, but
// we don't have any more surgical approach available to us in Mercurial.
// We can't use "log" because it doesn't have enough information for us
// to figure out when a directory is deleted by a change.
list($err) = $repository->execLocalCommand('cat --rev %s -- %s > /dev/null', $rev, $path);
if ($err) {
return false;
} else {
return true;
}
}
开发者ID:nexeck,项目名称:phabricator,代码行数:16,代码来源:PhabricatorRepositoryMercurialCommitChangeParserWorker.php