route: scm: fix git and mercurial changes action
If branch name has special character, "View revisions" link has route error. For example, Redmine Mercurial hgsubversion mirror has "../sandbox/rails-3.2" named branch. Git default branch of bare repository is defined at HEAD. In most cases, it is *master*. Mercurial GUI standard behavior is showing all revisions on top page. So, Redmine default branch is *nil*. Mercurial top page "View revisions" link has route error. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9617 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2c28d6b5d1
commit
b4350ca91a
|
@ -214,6 +214,9 @@ RedmineApp::Application.routes.draw do
|
|||
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
|
||||
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
|
||||
|
||||
get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
|
||||
:to => 'repositories#changes'
|
||||
|
||||
get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
|
||||
get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
|
||||
post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
|
||||
|
@ -228,13 +231,16 @@ RedmineApp::Application.routes.draw do
|
|||
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
|
||||
:controller => 'repositories',
|
||||
:constraints => {
|
||||
:action => /(browse|show|entry|changes|annotate|diff)/,
|
||||
:action => /(browse|show|entry|annotate|diff)/,
|
||||
:rev => /[a-z0-9\.\-_]+/
|
||||
}
|
||||
|
||||
get 'projects/:id/repository/statistics', :to => 'repositories#stats'
|
||||
get 'projects/:id/repository/graph', :to => 'repositories#graph'
|
||||
|
||||
get 'projects/:id/repository/changes(/*path(.:ext))',
|
||||
:to => 'repositories#changes'
|
||||
|
||||
get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
|
||||
get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
|
||||
get 'projects/:id/repository/revision', :to => 'repositories#revision'
|
||||
|
@ -249,7 +255,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
|
||||
:controller => 'repositories',
|
||||
:constraints => {
|
||||
:action => /(browse|show|entry|changes|annotate|diff)/,
|
||||
:action => /(browse|show|entry|annotate|diff)/,
|
||||
:rev => /[a-z0-9\.\-_]+/
|
||||
}
|
||||
get 'projects/:id/repository/:repository_id/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/
|
||||
|
|
|
@ -134,16 +134,29 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
|
|||
)
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/revisions/2457/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
||||
:rev => '2457' }
|
||||
:path => "/projects/redmine/repository/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine' }
|
||||
)
|
||||
['2457', 'master', 'slash/slash'].each do |rev|
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/revisions/2457/changes/#{@path_hash[:path]}" },
|
||||
:path => "/projects/redmine/repository/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
||||
:path => @path_hash[:param] , :rev => '2457'}
|
||||
:rev => rev },
|
||||
{},
|
||||
{ :rev => rev }
|
||||
)
|
||||
end
|
||||
['2457', 'master', 'slash/slash'].each do |rev|
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
||||
:path => @path_hash[:param], :rev => rev },
|
||||
{},
|
||||
{ :rev => rev }
|
||||
)
|
||||
end
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/revisions/2457/diff" },
|
||||
|
@ -215,16 +228,29 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
|
|||
)
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/foo/revisions/2457/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo',
|
||||
:rev => '2457' }
|
||||
:path => "/projects/redmine/repository/foo/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo' }
|
||||
)
|
||||
['2457', 'master', 'slash/slash'].each do |rev|
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/foo/revisions/2457/changes/#{@path_hash[:path]}" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo',
|
||||
:path => @path_hash[:param] , :rev => '2457'}
|
||||
:path => "/projects/redmine/repository/foo/changes" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
||||
:repository_id => 'foo', :rev => rev },
|
||||
{},
|
||||
{ :rev => rev }
|
||||
)
|
||||
end
|
||||
['2457', 'master', 'slash/slash'].each do |rev|
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
|
||||
{ :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
||||
:repository_id => 'foo', :path => @path_hash[:param], :rev => rev },
|
||||
{},
|
||||
{ :rev => rev }
|
||||
)
|
||||
end
|
||||
assert_routing(
|
||||
{ :method => 'get',
|
||||
:path => "/projects/redmine/repository/foo/revisions/2457/diff" },
|
||||
|
|
Loading…
Reference in New Issue