/** * factory method to create a commit * * @param Repository $repository repository instance * @param string $message commit message * @param bool $stageAll automatically stage the dirty working tree. Alternatively call stage() on the repo * @param string|Author $author override the author for this commit * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \InvalidArgumentException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return Commit */ public static function create(Repository $repository, $message, $stageAll = false, $author = null) { $repository->getCaller()->execute(MainCommand::getInstance($repository)->commit($message, $stageAll, $author)); return $repository->getCommit(); }
/** * 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); }
/** * Checkout a branch * This function change the state of the repository on the filesystem * * @param string|TreeishInterface $ref the reference to checkout * @param bool $create like -b on the command line * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return Repository */ public function checkout($ref, $create = false) { if ($create && is_null($this->getBranch($ref))) { $this->createBranch($ref); } $this->caller->execute(MainCommand::getInstance($this)->checkout($ref)); return $this; }
/** * Checkout a branch * This function change the state of the repository on the filesystem * * @param string|TreeishInterface $ref the reference to checkout * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return Repository */ public function checkout($ref) { $this->caller->execute(MainCommand::getInstance($this)->checkout($ref)); return $this; }