Example #1
0
 /**
  * get the commit properties from command
  *
  * @see ShowCommand::commitInfo
  */
 private function createFromCommand()
 {
     $command = TagCommand::getInstance($this->getRepository())->listTags();
     $outputLines = $this->getCaller()->execute($command, true, $this->getRepository()->getPath())->getOutputLines();
     $this->parseOutputLines($outputLines);
 }
Example #2
0
 /**
  * Try to get a branch or a tag by its name.
  *
  * @param string $name the reference name (a tag name or a branch name)
  *
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  * @return \GitElephant\Objects\Tag|\GitElephant\Objects\Branch|null
  */
 public function getBranchOrTag($name)
 {
     if (in_array($name, $this->getBranches(true))) {
         return new Branch($this, $name);
     }
     $tagFinderOutput = $this->caller->execute(TagCommand::getInstance($this)->listTags())->getOutputLines(true);
     foreach ($tagFinderOutput as $line) {
         if ($line === $name) {
             return new Tag($this, $name);
         }
     }
     return null;
 }