Example #1
0
 /**
  * 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));
 }
Example #2
0
 public function showLog($ref, $path = null, $limit = null, $offset = null, $firstParent = false)
 {
     parent::showLog($ref, $path, $limit, $offset, $firstParent);
     $this->addCommandArgument('--graph');
     return $this->getCommand();
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * 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());
 }
Example #5
0
 /**
  * testLogCreatedFromOutputLines
  */
 public function testLogCreatedFromOutputLines()
 {
     $tree = $this->getRepository()->getTree();
     $obj = $tree[count($tree) - 1];
     $logCommand = new LogCommand();
     $command = $logCommand->showObjectLog($obj);
     $log = Log::createFromOutputLines($this->getRepository(), $this->caller->execute($command)->getOutputLines());
     $this->assertInstanceOf('GitElephant\\Objects\\Log', $log);
     $this->assertCount(1, $log);
 }