diff --git a/src/IDF/Template/IssueComment.php b/src/IDF/Template/IssueComment.php index 2fe11b2..aa43cf1 100644 --- a/src/IDF/Template/IssueComment.php +++ b/src/IDF/Template/IssueComment.php @@ -126,14 +126,10 @@ class IDF_Template_IssueComment extends Pluf_Template_Tag */ function callbackCommit($m) { - try { - if ('commit' != $this->scm->testHash($m[0])) { - return $m[0]; // not a commit. - } - } catch (IDF_Scm_Exception $e) { - return $m[0]; // commit not found. - } $co = $this->scm->getCommit($m[0]); + if (!$co) { + return $m[0]; // not a commit. + } return ''.$m[0].''; @@ -141,18 +137,14 @@ class IDF_Template_IssueComment extends Pluf_Template_Tag function callbackSource($m) { - $branches = $this->scm->getBranches(); - if (count($branches) == 0) return $m[0]; + if (!$this->scm->isAvailable()) return $m[0]; $file = $m[2]; - if ('commit' != $this->scm->testHash($branches[0], $file)) { - return $m[0]; - } - $request_file_info = $this->scm->getFileInfo($file, $branches[0]); + $request_file_info = $this->scm->getPathInfo($file); if (!$request_file_info) { return $m[0]; } if ($request_file_info->type != 'tree') { - return $m[1].''.$m[2].''; + return $m[1].''.$m[2].''; } return $m[0]; } diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 0927870..85301ba 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -88,6 +88,7 @@ class IDF_Views_Source } $rchanges = new Pluf_Template_ContextVars($rchanges); $scmConf = $request->conf->getVal('scm', 'git'); + $in_branches = $scm->inBranches($commit, ''); return Pluf_Shortcuts_RenderToResponse('idf/source/changelog.html', array( 'page_title' => $title, @@ -95,6 +96,7 @@ class IDF_Views_Source 'changes' => $rchanges, 'commit' => $commit, 'branches' => $branches, + 'tree_in' => $in_branches, 'scm' => $scmConf, ), $request); @@ -128,7 +130,6 @@ class IDF_Views_Source $res = new Pluf_Template_ContextVars($scm->getTree($commit)); $cache->set($key, $res); } - //$tree_in = in_array($commit, $branches); $scmConf = $request->conf->getVal('scm', 'git'); $props = $scm->getProperties($commit); return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/tree.html', diff --git a/src/IDF/templates/idf/source/base.html b/src/IDF/templates/idf/source/base.html index 3c79c32..f80a937 100644 --- a/src/IDF/templates/idf/source/base.html +++ b/src/IDF/templates/idf/source/base.html @@ -1,9 +1,10 @@ {extends "idf/base.html"} {block tabsource} class="active"{/block} {block subtabs} +{if array_key_exists($commit, $branches)}{assign $currentCommit = $commit}{else}{assign $currentCommit = $project.getScmRoot()}{/if}
-{trans 'Source Tree'} | -{trans 'Change Log'} +{trans 'Source Tree'} | +{trans 'Change Log'} {if $inCommit}| {trans 'Commit'}{/if} | {trans 'How To Get The Code'}
diff --git a/src/IDF/templates/idf/source/changelog.html b/src/IDF/templates/idf/source/changelog.html index e249369..4a9a77e 100644 --- a/src/IDF/templates/idf/source/changelog.html +++ b/src/IDF/templates/idf/source/changelog.html @@ -27,12 +27,13 @@ {/block} + {block context} {if $scm != 'svn'}

{trans 'Branches:'}
-{foreach $branches as $branch} -{aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $branch)} -{$branch}
+{foreach $branches as $branch => $path} +{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)} +{$branch}
{/foreach}

{else}