Example #1
0
 /**
  * number of commits that lead to this one
  *
  * @throws \RuntimeException
  * @throws \Symfony\Component\Process\Exception\LogicException
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  * @return int|void
  */
 public function count()
 {
     $command = RevListCommand::getInstance($this->getRepository())->commitPath($this);
     return count($this->getCaller()->execute($command)->getOutputLines(true));
 }
Example #2
0
 /**
  * parse the output of a git command showing a commit
  *
  * @param array $outputLines output lines
  *
  * @throws \RuntimeException
  * @throws \Symfony\Component\Process\Exception\InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\LogicException
  * @throws \InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  * @return void
  */
 private function parseOutputLines($outputLines)
 {
     $found = false;
     foreach ($outputLines as $tagString) {
         if ($tagString != '') {
             if ($this->name === trim($tagString)) {
                 $lines = $this->getCaller()->execute(RevListCommand::getInstance($this->getRepository())->getTagCommit($this))->getOutputLines();
                 $this->setSha($lines[0]);
                 $found = true;
                 break;
             }
         }
     }
     if (!$found) {
         throw new \InvalidArgumentException(sprintf('the tag %s doesn\'t exists', $this->name));
     }
 }