@@ -154,13 +154,14 class Changeset < ActiveRecord::Base | |||||
154 | end |
|
154 | end | |
155 |
|
155 | |||
156 | def text_tag(ref_project=nil) |
|
156 | def text_tag(ref_project=nil) | |
|
157 | repo = "" | |||
|
158 | if repository && repository.identifier.present? | |||
|
159 | repo = "#{repository.identifier}|" | |||
|
160 | end | |||
157 | tag = if scmid? |
|
161 | tag = if scmid? | |
158 | "commit:#{scmid}" |
|
162 | "commit:#{repo}#{scmid}" | |
159 | else |
|
163 | else | |
160 | "r#{revision}" |
|
164 | "#{repo}r#{revision}" | |
161 | end |
|
|||
162 | if repository && repository.identifier.present? |
|
|||
163 | tag = "#{repository.identifier}|#{tag}" |
|
|||
164 | end |
|
165 | end | |
165 | if ref_project && project && ref_project != project |
|
166 | if ref_project && project && ref_project != project | |
166 | tag = "#{project.identifier}:#{tag}" |
|
167 | tag = "#{project.identifier}:#{tag}" |
@@ -345,6 +345,16 class ChangesetTest < ActiveSupport::TestCase | |||||
345 | assert_equal 'commit:0123456789', c.text_tag |
|
345 | assert_equal 'commit:0123456789', c.text_tag | |
346 | end |
|
346 | end | |
347 |
|
347 | |||
|
348 | def test_text_tag_hash_with_repository_identifier | |||
|
349 | r = Repository::Subversion.new( | |||
|
350 | :project_id => 1, | |||
|
351 | :url => 'svn://localhost/test', | |||
|
352 | :identifier => 'documents') | |||
|
353 | c = Changeset.new(:revision => '7234cb27', :scmid => '7234cb27', :repository => r) | |||
|
354 | assert_equal 'commit:documents|7234cb27', c.text_tag | |||
|
355 | assert_equal 'ecookbook:commit:documents|7234cb27', c.text_tag(Project.find(2)) | |||
|
356 | end | |||
|
357 | ||||
348 | def test_previous |
|
358 | def test_previous | |
349 | changeset = Changeset.find_by_revision('3') |
|
359 | changeset = Changeset.find_by_revision('3') | |
350 | assert_equal Changeset.find_by_revision('2'), changeset.previous |
|
360 | assert_equal Changeset.find_by_revision('2'), changeset.previous |
General Comments 0
You need to be logged in to leave comments.
Login now