| public $changeLog_precond = array('IDF_Precondition::accessSource');␊ |
| public function changeLog($request, $match)␊ |
| {␊ |
| $title = sprintf(__('%1$s %2$s Change Log'), (string) $request->project,␊ |
| $this->getScmType($request));␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| if (!$scm->isAvailable()) {␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help',␊ |
|
| $scm->getMainBranch()));␊ |
| return new Pluf_HTTP_Response_Redirect($url);␊ |
| }␊ |
| $title = sprintf(__('%1$s %2$s Change Log'), (string) $request->project,␊ |
| $this->getScmType($request));␊ |
| $changes = $scm->getChangeLog($commit, 25);␊ |
| $rchanges = array();␊ |
| // Sync with the database␊ |
|
| $rchanges = new Pluf_Template_ContextVars($rchanges);␊ |
| $scmConf = $request->conf->getVal('scm', 'git');␊ |
| $in_branches = $scm->inBranches($commit, '');␊ |
| $tags = $scm->getTags();␊ |
| $in_tags = $scm->inTags($commit, '');␊ |
| return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/changelog.html',␊ |
| array(␊ |
| 'page_title' => $title,␊ |
|
| 'commit' => $commit,␊ |
| 'branches' => $branches,␊ |
| 'tree_in' => $in_branches,␊ |
| 'tags' => $tags,␊ |
| 'tags_in' => $in_tags,␊ |
| 'scm' => $scmConf,␊ |
| ),␊ |
| $request);␊ |
|
| public $treeBase_precond = array('IDF_Precondition::accessSource');␊ |
| public function treeBase($request, $match)␊ |
| {␊ |
| $title = sprintf(__('%1$s %2$s Source Tree'),␊ |
| $request->project, $this->getScmType($request));␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| if (!$scm->isAvailable()) {␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help',␊ |
|
| $scm->getMainBranch()));␊ |
| return new Pluf_HTTP_Response_Redirect($url);␊ |
| }␊ |
| $title = sprintf(__('%1$s %2$s Source Tree'),␊ |
| $request->project, $this->getScmType($request));␊ |
| $branches = $scm->getBranches();␊ |
| $in_branches = $scm->inBranches($commit, '');␊ |
| $tags = $scm->getTags();␊ |
| $in_tags = $scm->inTags($commit, '');␊ |
| $cache = Pluf_Cache::factory();␊ |
| $key = sprintf('Project:%s::IDF_Views_Source::treeBase:%s::',␊ |
| $request->project->id, $commit);␊ |
|
| 'commit' => $commit,␊ |
| 'tree_in' => $in_branches,␊ |
| 'branches' => $branches,␊ |
| 'tags' => $tags,␊ |
| 'tags_in' => $in_tags,␊ |
| 'props' => $props,␊ |
| ),␊ |
| $request);␊ |
|
| public $tree_precond = array('IDF_Precondition::accessSource');␊ |
| public function tree($request, $match)␊ |
| {␊ |
| $title = sprintf(__('%1$s %2$s Source Tree'), ␊ |
| $request->project, $this->getScmType($request));␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $commit = $match[2];␊ |
| $request_file = $match[3];␊ |
| ␊ |
| if (!$scm->isAvailable()) {␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help',␊ |
| array($request->project->shortname));␊ |
| return new Pluf_HTTP_Response_Redirect($url);␊ |
| }␊ |
| $branches = $scm->getBranches();␊ |
| $fburl = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase',␊ |
| array($request->project->shortname,␊ |
| $scm->getMainBranch()));␊ |
| $request_file = $match[3];␊ |
| if (substr($request_file, -1) == '/') {␊ |
| $request_file = substr($request_file, 0, -1);␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::tree',␊ |
|
| // Redirect to the first branch␊ |
| return new Pluf_HTTP_Response_Redirect($fburl);␊ |
| }␊ |
| $branches = $scm->getBranches();␊ |
| $tags = $scm->getTags();␊ |
| if ($request_file_info->type != 'tree') {␊ |
| $info = self::getRequestedFileMimeType($request_file_info, ␊ |
| $info = self::getRequestedFileMimeType($request_file_info,␊ |
| $commit, $scm);␊ |
| if (!self::isText($info)) {␊ |
| ␊ |
| $rep = new Pluf_HTTP_Response($scm->getFile($request_file_info),␊ |
| $info[0]);␊ |
| $rep->headers['Content-Disposition'] = 'attachment; filename="'.$info[1].'"';␊ |
|
| } else {␊ |
| // We want to display the content of the file as text␊ |
| $extra = array('branches' => $branches,␊ |
| 'tags' => $tags,␊ |
| 'commit' => $commit,␊ |
| 'request_file' => $request_file,␊ |
| 'request_file_info' => $request_file_info,␊ |
|
| }␊ |
| ␊ |
| $bc = self::makeBreadCrumb($request->project, $commit, $request_file_info->fullpath);␊ |
| $title = sprintf(__('%1$s %2$s Source Tree'),␊ |
| $request->project, $this->getScmType($request));␊ |
| ␊ |
| $page_title = $bc.' - '.$title;␊ |
| $cobject = $scm->getCommit($commit);␊ |
|
| return new Pluf_HTTP_Response_Redirect($url);␊ |
| }␊ |
| $in_branches = $scm->inBranches($commit, $request_file);␊ |
| $in_tags = $scm->inTags($commit, $request_file);␊ |
| $cache = Pluf_Cache::factory();␊ |
| $key = sprintf('Project:%s::IDF_Views_Source::tree:%s::%s',␊ |
| $request->project->id, $commit, $request_file);␊ |
|
| 'prev' => $previous,␊ |
| 'tree_in' => $in_branches,␊ |
| 'branches' => $branches,␊ |
| 'tags' => $tags,␊ |
| 'tags_in' => $in_tags,␊ |
| 'props' => $props,␊ |
| ),␊ |
| $request);␊ |
|
| {␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $commit = $match[2];␊ |
| $branches = $scm->getBranches();␊ |
| if (!$scm->isValidRevision($commit)) {␊ |
| // Redirect to the first branch␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase',␊ |
|
| $diff = new IDF_Diff($cobject->changes);␊ |
| $diff->parse();␊ |
| $scmConf = $request->conf->getVal('scm', 'git');␊ |
| $in_branches = $scm->inBranches($commit, '');␊ |
| $branches = $scm->getBranches();␊ |
| $in_branches = $scm->inBranches($cobject->commit, '');␊ |
| $tags = $scm->getTags();␊ |
| $in_tags = $scm->inTags($cobject->commit, '');␊ |
| return Pluf_Shortcuts_RenderToResponse('idf/source/commit.html',␊ |
| array(␊ |
| 'page_title' => $page_title,␊ |
|
| 'commit' => $commit,␊ |
| 'branches' => $branches,␊ |
| 'tree_in' => $in_branches,␊ |
| 'tags' => $tags,␊ |
| 'tags_in' => $in_tags,␊ |
| 'scm' => $scmConf,␊ |
| 'rcommit' => $rcommit,␊ |
| 'large_commit' => $large,␊ |
|
| {␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $commit = $match[2];␊ |
| $branches = $scm->getBranches();␊ |
| if (!$scm->isValidRevision($commit)) {␊ |
| // Redirect to the first branch␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase',␊ |
|
| $this->getScmType($request));␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $branches = $extra['branches'];␊ |
| $tags = $extra['tags'];␊ |
| $commit = $extra['commit'];␊ |
| $request_file = $extra['request_file'];␊ |
| $request_file_info = $extra['request_file_info'];␊ |
|
| $page_title = $bc.' - '.$title;␊ |
| $cobject = $scm->getCommit($commit);␊ |
| $in_branches = $scm->inBranches($commit, $request_file);␊ |
| $in_tags = $scm->inTags($commit, '');␊ |
| // try to find the previous level if it exists.␊ |
| $prev = explode('/', $request_file);␊ |
| $l = array_pop($prev);␊ |
|
| 'prev' => $previous,␊ |
| 'tree_in' => $in_branches,␊ |
| 'branches' => $branches,␊ |
| 'tags' => $tags,␊ |
| 'tags_in' => $in_tags,␊ |
| 'props' => $props,␊ |
| ),␊ |
| $request);␊ |
|
| public function getFile($request, $match)␊ |
| {␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $branches = $scm->getBranches();␊ |
| $commit = $match[2];␊ |
| $request_file = $match[3];␊ |
| if (!$scm->isValidRevision($commit)) {␊ |
|
| {␊ |
| $commit = trim($match[2]);␊ |
| $scm = IDF_Scm::get($request->project);␊ |
| $branches = $scm->getBranches();␊ |
| if (!$scm->isValidRevision($commit)) {␊ |
| // Redirect to the first branch␊ |
| $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::treeBase',␊ |