/** * @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()); } }
/** * @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]); }
/** * @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)]; }
public function generateCommitUrl(Commit $commit) { return $this->generator->generate('commit', array('hash' => $commit->getHash(), 'repository' => $this->getName($commit->getRepository()))); }
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()))); }
/** * @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()); }
/** * @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; }
/** * @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()]]; }
/** * @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())); }
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; }