Fixed issue 180, can't select branches containing / character in git projects.

This commit is contained in:
Loic d'Anterroches 2009-07-08 13:49:16 +02:00
parent 7d6cb22291
commit c0dfd6b5dc
8 changed files with 40 additions and 24 deletions

View File

@ -75,7 +75,12 @@ class IDF_Scm_Git extends IDF_Scm
}
$res = array();
foreach ($out as $b) {
$res[substr($b, 2)] = '';
$b = substr($b, 2);
if (false !== strpos($b, '/')) {
$res[$this->getCommit($b)->commit] = $b;
} else {
$res[$b] = '';
}
}
$this->cache['branches'] = $res;
return $res;

View File

@ -94,7 +94,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',
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/changelog.html',
array(
'page_title' => $title,
'title' => $title,

View File

@ -27,23 +27,3 @@
</tbody>
</table>
{/block}
{block context}
{if $scm != 'svn'}
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{$branch}</a></span><br />
{/foreach}
</p>
{else}
<form class="star" action="{url 'IDF_Views_Source_Svn::changelogRev', array($project.shortname)}" method="get">
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
<p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
<input type="submit" name="s" value="{trans 'Go to revision'}" />
</p>
</form>
{/if}
{/block}

View File

@ -0,0 +1,10 @@
{extends "idf/source/changelog.html"}
{block context}
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{if $path}{$path}{else}{$branch}{/if}</a></span><br />
{/foreach}
</p>
{/block}

View File

@ -25,7 +25,7 @@
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{$branch}</a></span><br />
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{if $path}{$path}{else}{$branch}{/if}</a></span><br />
{/foreach}
</p>
{/block}

View File

@ -55,7 +55,7 @@
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{$branch}</a></span><br />
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{if $path}{$path}{else}{$branch}{/if}</a></span><br />
{/foreach}
</p>
{/block}

View File

@ -0,0 +1,10 @@
{extends "idf/source/changelog.html"}
{block context}
<p><strong>{trans 'Branches:'}</strong><br />
{foreach $branches as $branch => $path}
{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $branch)}
<span class="label{if in_array($branch, $tree_in)} active{/if}"><a href="{$url}" class="label">{$branch}</a></span><br />
{/foreach}
</p>
{/block}

View File

@ -0,0 +1,11 @@
{extends "idf/source/changelog.html"}
{block context}
<form class="star" action="{url 'IDF_Views_Source_Svn::changelogRev', array($project.shortname)}" method="get">
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
<p>
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
<input type="submit" name="s" value="{trans 'Go to revision'}" />
</p>
</form>
{/block}