diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-12 17:57:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-12 17:57:46 +0000 |
commit | 42cc2d322ac21b7f792a802c6e6702980b198cde (patch) | |
tree | 69b97595b07704882e4819ab30dd35dedfc6fb98 | |
parent | 0367c323de0d3ed266cdb8269bf4170cea4087da (diff) | |
download | redmine-42cc2d322ac21b7f792a802c6e6702980b198cde.tar.gz redmine-42cc2d322ac21b7f792a802c6e6702980b198cde.zip |
Merged r11281 from trunk (#12979).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.2-stable@11362 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f6797dc47..2ca68a44f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -705,7 +705,7 @@ module ApplicationHelper # identifier:version:1.0.0 # identifier:source:some/file def parse_redmine_links(text, default_project, obj, attr, only_path, options) - text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m| + text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-_]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m| leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17 link = nil project = default_project @@ -794,7 +794,7 @@ module ApplicationHelper when 'commit', 'source', 'export' if project repository = nil - if name =~ %r{^(([a-z0-9\-]+)\|)(.+)$} + if name =~ %r{^(([a-z0-9\-_]+)\|)(.+)$} repo_prefix, repo_identifier, name = $1, $2, $3 repository = project.repositories.detect {|repo| repo.identifier == repo_identifier} else diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index e62abb6b7..29c4dabdc 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -403,14 +403,14 @@ RAW end def test_multiple_repositories_redmine_links - svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn1', :url => 'file:///foo/hg') + svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn_repo-1', :url => 'file:///foo/hg') Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123') hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg') Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd') changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') - svn_changeset_link = link_to('svn1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn1', :rev => 123}, + svn_changeset_link = link_to('svn_repo-1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn_repo-1', :rev => 123}, :class => 'changeset', :title => '') hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, :class => 'changeset', :title => '') @@ -420,7 +420,7 @@ RAW to_test = { 'r2' => changeset_link, - 'svn1|r123' => svn_changeset_link, + 'svn_repo-1|r123' => svn_changeset_link, 'invalid|r123' => 'invalid|r123', 'commit:hg1|abcd' => hg_changeset_link, 'commit:invalid|abcd' => 'commit:invalid|abcd', |