コード例 #1
0
ファイル: GitDown.php プロジェクト: skizu/gitdown
 /**
  * @param $fileName string
  * @return \Gitonomy\Git\Blob
  */
 protected function getFile($fileName)
 {
     try {
         return $this->getEntry($this->commit->getTree(), $fileName);
     } catch (GitReferenceNotFoundException $e) {
         throw new ReferenceNotFoundException($e->getMessage());
     } catch (GitInvalidArgumentException $e) {
         throw new InvalidArgumentException($e->getMessage());
     }
 }
コード例 #2
0
ファイル: FileSystemProvider.php プロジェクト: anroots/pgca
 /**
  * @param Commit $commitData
  * @return \Anroots\Pgca\Git\Commit
  */
 private function createCommit(Commit $commitData)
 {
     // Remove the last character from the commit message.
     // This is always a newline due to the way Gitlib works.
     $commitMessage = substr($commitData->getMessage(), 0, mb_strlen($commitData->getMessage()) - 1);
     $files = $this->extractFilePaths($commitData->getDiff()->getFiles());
     return $this->commitFactory->create(['hash' => $commitData->getHash(), 'message' => $commitMessage, 'shortHash' => $commitData->getShortHash(), 'summary' => $commitData->getSubjectMessage(), 'authorName' => $commitData->getAuthorName(), 'changedFiles' => $files]);
 }
コード例 #3
0
ファイル: CommitPager.php プロジェクト: dzirg44/dogpro
 /**
  * @param $commit
  * @return array
  */
 public static function commitToArray(Commit $commit)
 {
     $branches = [];
     foreach ($commit->getIncludingBranches(true, false) as $branch) {
         $branches[] = $branch->getName();
     }
     return ['hash' => $commit->getHash(), 'shortHash' => $commit->getShortHash(), 'message' => $commit->getMessage(), 'shortMessage' => $commit->getShortMessage(), 'image' => "//www.gravatar.com/avatar/" . md5($commit->getAuthorEmail()), 'branches' => $branches, 'name' => $commit->getAuthorName(), 'email' => $commit->getAuthorEmail(), 'date' => $commit->getCommitterDate()->format(DATE_ISO8601)];
 }
コード例 #4
0
ファイル: GitUrlGenerator.php プロジェクト: AlexGk/browser
 public function generateCommitUrl(Commit $commit)
 {
     return $this->generator->generate('commit', array('hash' => $commit->getHash(), 'repository' => $this->getName($commit->getRepository())));
 }
コード例 #5
0
ファイル: GitExtension.php プロジェクト: gitonomy/git-bundle
 public function renderAuthor(\Twig_Environment $env, Commit $commit, array $options = array())
 {
     $options = array_merge(array('size' => 15), $options);
     return $this->renderBlock($env, 'author', array('name' => $commit->getAuthorName(), 'size' => $options['size'], 'email' => $commit->getAuthorEmail(), 'email_md5' => md5($commit->getAuthorEmail())));
 }
コード例 #6
0
 /**
  * @param Commit $commit
  * @return array
  */
 protected function commitMessageArray(Commit $commit)
 {
     return array('hash' => $commit->getHash(), 'revision' => $commit->getRevision(), 'message' => $commit->getMessage(), 'committer' => $commit->getCommitterEmail(), 'data' => $commit->getCommitterDate());
 }
コード例 #7
0
ファイル: DNProject.php プロジェクト: silverstripe/deploynaut
 /**
  * @param \Gitonomy\Git\Commit $commit
  * @return mixed
  */
 public function getCommitTags(\Gitonomy\Git\Commit $commit)
 {
     $cachekey = $this->ID . '_tags_' . $commit->getRevision();
     $cache = self::get_git_cache();
     $result = $cache->load($cachekey);
     // we check against false, because in many cases the tag list is an empty array
     if ($result === false) {
         $repo = $this->getRepository();
         $result = $repo->getReferences()->resolveTags($commit->getRevision());
         $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_' . $this->ID]);
     }
     return $result;
 }
コード例 #8
0
ファイル: SlackNotifier.php プロジェクト: dzirg44/dogpro
 /**
  * @param Release $release
  * @param $commit
  * @return array
  */
 protected function describeCommitFields(Release $release, Commit $commit)
 {
     return [['title' => 'Commit', 'value' => $commit->getShortHash(), 'short' => true], ['title' => 'Message', 'value' => $commit->getShortMessage(), 'short' => true], ['title' => 'Author', 'value' => $commit->getAuthorName() . '(' . $commit->getAuthorEmail() . ')'], ['title' => 'Details', 'value' => $release->url()]];
 }
コード例 #9
0
 /**
  * @inheritdoc
  */
 public function generateCommitUrl(Commit $commit)
 {
     return $this->generator->generate($this->routeNames['commit'], array($this->routeArgs['commit_repository'] => $this->getName($commit->getRepository()), $this->routeArgs['commit_hash'] => $commit->getHash()));
 }
コード例 #10
0
 protected function commitToArray(Commit $commit)
 {
     $commitData = array('hash' => $commit->getHash(), 'shortHash' => $commit->getShortHash(), 'parentHashes' => $commit->getParentHashes(), 'shortMessage' => $commit->getShortMessage(), 'authorName' => $commit->getAuthorName(), 'authorEmail' => $commit->getAuthorEmail(), 'authorDate' => $commit->getAuthorDate(), 'message' => $commit->getMessage());
     return $commitData;
 }