]> source.dussan.org Git - redmine.git/commitdiff
Fixed Changeset#text_tag for changeset with hash and repository identifier (#13544).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jan 2014 09:19:47 +0000 (09:19 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jan 2014 09:19:47 +0000 (09:19 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12660 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/changeset.rb
test/unit/changeset_test.rb

index 36598112495c2a9072ff0ac6181a973f4dda8f9e..1040282dae531b4fde7a87f4d1790c27c1e0b075 100644 (file)
@@ -154,13 +154,14 @@ class Changeset < ActiveRecord::Base
   end
 
   def text_tag(ref_project=nil)
+    repo = ""
+    if repository && repository.identifier.present?
+      repo = "#{repository.identifier}|"
+    end
     tag = if scmid?
-      "commit:#{scmid}"
+      "commit:#{repo}#{scmid}"
     else
-      "r#{revision}"
-    end
-    if repository && repository.identifier.present?
-      tag = "#{repository.identifier}|#{tag}"
+      "#{repo}r#{revision}"
     end
     if ref_project && project && ref_project != project
       tag = "#{project.identifier}:#{tag}"
index d1ac607b4b5ea78bb087596b5f59a21e5c9b795d..9eb46594ccb259b2365da868df2b65457c3bf8f9 100644 (file)
@@ -343,6 +343,16 @@ class ChangesetTest < ActiveSupport::TestCase
     assert_equal 'commit:0123456789', c.text_tag
   end
 
+  def test_text_tag_hash_with_repository_identifier
+    r = Repository::Subversion.new(
+          :project_id => 1,
+          :url     => 'svn://localhost/test',
+          :identifier => 'documents')
+    c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => r)
+    assert_equal 'commit:documents|7234cb27', c.text_tag
+    assert_equal 'ecookbook:commit:documents|7234cb27', c.text_tag(Project.find(2))
+  end
+
   def test_previous
     changeset = Changeset.find_by_revision('3')
     assert_equal Changeset.find_by_revision('2'), changeset.previous