Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /**
  * 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());
 }
Esempio n. 3
0
 /**
  * @param Commit $commit
  */
 public function addCommit(Commit $commit)
 {
     $this->commits[(string) $commit->getHash()] = $commit;
 }
Esempio n. 4
0
 public function renderCommitHead(Commit $commit)
 {
     return $this->indent . '- [' . $commit->getHash() . '] ' . $commit->getLabel();
 }