Changed revision regexp to make source: links accept a branch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11063 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
852b336f5e
commit
94d9172634
@ -755,7 +755,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
if repository && User.current.allowed_to?(:browse_repository, project)
|
if repository && User.current.allowed_to?(:browse_repository, project)
|
||||||
name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
|
name =~ %r{^[/\\]*(.*?)(@([^/\\@]+?))?(#(L\d+))?$}
|
||||||
path, rev, anchor = $1, $3, $5
|
path, rev, anchor = $1, $3, $5
|
||||||
link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
|
link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
|
||||||
:path => to_path_param(path),
|
:path => to_path_param(path),
|
||||||
|
@ -280,11 +280,13 @@ RAW
|
|||||||
source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
|
source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
|
||||||
source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
|
source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
|
||||||
source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
|
source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
|
||||||
|
source_url_with_branch = '/projects/ecookbook/repository/revisions/branch/entry/some/file'
|
||||||
|
|
||||||
export_url = '/projects/ecookbook/repository/raw/some/file'
|
export_url = '/projects/ecookbook/repository/raw/some/file'
|
||||||
export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
|
export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
|
||||||
export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
|
export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
|
||||||
export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
|
export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
|
||||||
|
export_url_with_branch = '/projects/ecookbook/repository/revisions/branch/raw/some/file'
|
||||||
|
|
||||||
to_test = {
|
to_test = {
|
||||||
# tickets
|
# tickets
|
||||||
@ -315,6 +317,7 @@ RAW
|
|||||||
'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
|
'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
|
||||||
'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
|
'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
|
||||||
'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
|
'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
|
||||||
|
'source:/some/file@branch' => link_to('source:/some/file@branch', source_url_with_branch, :class => 'source'),
|
||||||
'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
|
'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
|
||||||
'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
|
'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
|
||||||
'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
|
'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
|
||||||
@ -324,6 +327,7 @@ RAW
|
|||||||
'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
|
'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
|
||||||
'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
|
'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
|
||||||
'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
|
'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
|
||||||
|
'export:/some/file@branch' => link_to('export:/some/file@branch', export_url_with_branch, :class => 'source download'),
|
||||||
# forum
|
# forum
|
||||||
'forum#2' => link_to('Discussion', board_url, :class => 'board'),
|
'forum#2' => link_to('Discussion', board_url, :class => 'board'),
|
||||||
'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),
|
'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user