本文整理汇总了PHP中GitRepository::run方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::run方法的具体用法?PHP GitRepository::run怎么用?PHP GitRepository::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitRepository
的用法示例。
在下文中一共展示了GitRepository::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: push
/**
* Pushes a tag to a remote repository.
*
* @param null|string|GitRemote $remote the remote repository to push to. If null, falls back to repository $defaultRemote.
* @return string the response from git
*/
public function push($remote = null)
{
if (is_null($remote)) {
$remote = $this->repository->remote;
}
return $this->repository->run("push {$remote} tag {$this->name}");
}
示例2: getCommits
/**
* Gets a list of commits in this branch
* @return GitCommit[] an array of git commits, indexed by hash
*/
public function getCommits()
{
if (is_null($this->_commits)) {
$this->_commits = array();
$branchName = $this->remote ? $this->remote->name . '/' . $this->name : $this->name;
$command = 'log --pretty=format:"%H" ' . $branchName;
foreach (explode("\n", $this->repository->run($command)) as $hash) {
$hash = trim($hash);
if (!$hash) {
continue;
}
$this->_commits[$hash] = new GitCommit($hash, $this->repository);
}
}
return $this->_commits;
}
示例3: loadData
/**
* Loads the metadata for the commit
*/
protected function loadData()
{
$delimiter = '|||---|||---|||';
$command = 'show --pretty=format:"%an' . $delimiter . '%ae' . $delimiter . '%cd' . $delimiter . '%s' . $delimiter . '%B' . $delimiter . '%N" ' . $this->hash;
$response = $this->repository->run($command);
$parts = explode($delimiter, $response);
$this->_authorName = array_shift($parts);
$this->_authorEmail = array_shift($parts);
$this->_time = array_shift($parts);
$this->_subject = array_shift($parts);
$this->_message = array_shift($parts);
$this->_notes = array_shift($parts);
}
示例4: getTags
/**
* Gets a list of tags for this remote repository
*
* @return GitTag[] an array of tags
*/
public function getTags()
{
$tags = array();
foreach (explode("\n", $this->repository->run('ls-remote --tags ' . $this->name)) as $i => $ref) {
if ($i == 0) {
continue;
}
//ignore first line "From: repository..."
if (substr_count($ref, '^{}')) {
continue;
}
//ignore dereferenced tag objects for annotated tags
$ref = explode('refs/tags/', trim($ref), 2);
$tagName = $ref[1];
$tag = new GitTag($tagName, $this->repository, $this);
$tags[$tagName] = $tag;
}
return $tags;
}