Adds the repository identifier to Changeset#text_tag (#779).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9255 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-03-24 13:03:36 +00:00
parent fae5250e52
commit bb36fa5d12
2 changed files with 14 additions and 0 deletions

View File

@ -157,6 +157,9 @@ class Changeset < ActiveRecord::Base
else else
"r#{revision}" "r#{revision}"
end end
if repository && repository.identifier.present?
tag = "#{repository.identifier}|#{tag}"
end
if ref_project && project && ref_project != project if ref_project && project && ref_project != project
tag = "#{project.identifier}:#{tag}" tag = "#{project.identifier}:#{tag}"
end end

View File

@ -255,6 +255,17 @@ class ChangesetTest < ActiveSupport::TestCase
assert_equal 'ecookbook:r520', c.text_tag(Project.find(2)) assert_equal 'ecookbook:r520', c.text_tag(Project.find(2))
end end
def test_text_tag_revision_with_repository_identifier
r = Repository::Subversion.create!(
:project_id => 1,
:url => 'svn://localhost/test',
:identifier => 'documents')
c = Changeset.new(:revision => '520', :repository => r)
assert_equal 'documents|r520', c.text_tag
assert_equal 'ecookbook:documents|r520', c.text_tag(Project.find(2))
end
def test_text_tag_hash def test_text_tag_hash
c = Changeset.new( c = Changeset.new(
:scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518', :scmid => '7234cb2750b63f47bff735edc50a1c0a433c2518',