/** * @inheritdoc */ public function generateTreeUrl(Revision $revision, $path = '') { if ($revision instanceof Tag or $revision instanceof Branch) { $rev = $revision->getName(); } else { $rev = $revision->getRevision(); } return $this->generator->generate($this->routeNames['tree'], array($this->routeArgs['tree_repository'] => $this->getName($revision->getRepository()), $this->routeArgs['tree_revision'] => $rev, $this->routeArgs['tree_path'] => $path)); }
/** * Constructor. * * @param Gitonomy\Git\Repository $repository Repository of the commit * * @param string $hash Hash of the commit */ public function __construct(Repository $repository, $hash, array $data = array()) { if (!preg_match('/^[a-f0-9]{40}$/', $hash)) { throw new ReferenceNotFoundException($hash); } parent::__construct($repository, $hash); $this->setData($data); }
/** * Returns all lines of the blame. * * @return array */ public function getLines() { if (null !== $this->lines) { return $this->lines; } $args = array('-p'); if (null !== $this->lineRange) { $args[] = '-L'; $args[] = $this->lineRange; } $args[] = $this->revision->getRevision(); $args[] = '--'; $args[] = $this->file; $parser = new BlameParser($this->repository); $parser->parse($this->repository->run('blame', $args)); $this->lines = $parser->lines; return $this->lines; }
public function generateTreeUrl(Revision $revision, $path = '') { return $this->generator->generate('tree', array('revision' => $revision->getRevision(), 'path' => $path, 'repository' => $this->getName($revision->getRepository()))); }