/** * testShowObjectLog */ public function testShowObjectLog() { $branch = $this->getRepository()->getBranch('master'); $obj = $this->getRepository()->getTree('HEAD', 'test-folder/test-file')->getBlob(); $lc = LogCommand::getInstance(); $this->assertEquals("log '-s' '--pretty=raw' '--no-color' -- 'test-folder/test-file'", $lc->showObjectLog($obj)); $this->assertEquals("log '-s' '--pretty=raw' '--no-color' 'master' -- 'test-folder/test-file'", $lc->showObjectLog($obj, $branch)); }
/** * get the commit properties from command * * @param string $ref treeish reference * @param string $path path * @param int $limit limit * @param string $offset offset * @param boolean $firstParent first parent * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @see ShowCommand::commitInfo */ private function createFromCommand($ref, $path, $limit, $offset, $firstParent) { $command = LogCommand::getInstance($this->getRepository())->showLog($ref, $path, $limit, $offset, $firstParent); $outputLines = $this->getRepository()->getCaller()->execute($command)->getOutputLines(true); $this->parseOutputLines($outputLines); }
/** * Get a log for an object * * @param \GitElephant\Objects\Object $obj The Object instance * @param null|string|\GitElephant\Objects\Branch $branch The branch to read from * @param int $limit Limit to n entries * @param int|null $offset Skip n entries * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return \GitElephant\Objects\Log */ public function getObjectLog(Object $obj, $branch = null, $limit = 1, $offset = null) { $command = LogCommand::getInstance($this)->showObjectLog($obj, $branch, $limit, $offset); return Log::createFromOutputLines($this, $this->caller->execute($command)->getOutputLines()); }