/** * Parse the response of a git-log command. * * @param Repository $repository The project repository * @param string $output * @return array<Commit> */ public static function parse(Repository $repository, $output) { $commits = array(); if (!empty($output)) { foreach (explode("\n", $output) as $line) { $commit = new Commit($repository, 'HEAD'); $commit->init($line); $commits[$commit->getHash()] = $commit; } } return $commits; }
/** * Appends commit along with comments. * @param Commit commit object */ public function addCommit(Commit $commit) { $new = $this->findCommit($commit->getHash()); $new->setLabel($commit->getLabel()); $new->addComments($commit->getComments()); }
/** * @param Commit $commit */ public function addCommit(Commit $commit) { $this->commits[(string) $commit->getHash()] = $commit; }
public function renderCommitHead(Commit $commit) { return $this->indent . '- [' . $commit->getHash() . '] ' . $commit->getLabel(); }