当前位置: 首页>>代码示例>>PHP>>正文


PHP GitRepository::run方法代码示例

本文整理汇总了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}");
 }
开发者ID:carrlabs,项目名称:git-wrapper,代码行数:13,代码来源:GitTag.php

示例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;
 }
开发者ID:carrlabs,项目名称:git-wrapper,代码行数:20,代码来源:GitBranch.php

示例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);
 }
开发者ID:carrlabs,项目名称:git-wrapper,代码行数:16,代码来源:GitCommit.php

示例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;
 }
开发者ID:carrlabs,项目名称:git-wrapper,代码行数:24,代码来源:GitRemote.php


注:本文中的GitRepository::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。