/** * rev-parse command - often used to return a commit tag. * * @param array $options the options to apply to rev-parse * * @throws \RuntimeException * @throws \InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return array */ public function revParse(array $options = array()) { $c = RevParseCommand::getInstance()->revParse($this, $options); $caller = $this->repository->getCaller(); $caller->execute($c); return array_map('trim', $caller->getOutputLines(true)); }
/** * get output lines from git-remote show [name] * * NOTE: for technical reasons $name is optional, however under normal * implementation it SHOULD be passed! * * @param string $name Name of remote to show details * @param RemoteCommand $remoteCmd Optionally provide RemoteCommand object * @param bool $queryRemotes Do not fetch new information from remotes * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return array */ public function getShowOutput($name = null, RemoteCommand $remoteCmd = null, $queryRemotes = true) { if (!$remoteCmd) { $remoteCmd = RemoteCommand::getInstance($this->repository); } $command = $remoteCmd->show($name, $queryRemotes); return $this->repository->getCaller()->execute($command)->getOutputLines(true); }
/** * Creates a new tag on the repository and returns it * * @param \GitElephant\Repository $repository repository instance * @param string $name branch name * @param string $startPoint branch to start from * @param string $message tag message * * @throws \RuntimeException * @return \GitElephant\Objects\Branch */ public static function create(Repository $repository, $name, $startPoint = null, $message = null) { $repository->getCaller()->execute(TagCommand::getInstance($repository)->create($name, $startPoint, $message)); return $repository->getTag($name); }
/** * Creates a new branch on the repository and returns it * * @param \GitElephant\Repository $repository repository instance * @param string $name branch name * @param string $startPoint branch to start from * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return \GitElephant\Objects\Branch */ public static function create(Repository $repository, $name, $startPoint = null) { $repository->getCaller()->execute(BranchCommand::getInstance($repository)->create($name, $startPoint)); return new self($repository, $name); }
/** * create from git command */ private function createFromCommand() { $command = MainCommand::getInstance($this->repository)->status(true); $lines = $this->repository->getCaller()->execute($command)->getOutputLines(true); $this->parseOutputLines($lines); }