Commit 8407db98 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Fixes Changeset#text_tag for numeric scmid (#6681).

Contributed by Toshi MARUYAMA.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4490 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 00d50157
......@@ -126,11 +126,10 @@ class Changeset < ActiveRecord::Base
end
def text_tag
c = scmid? ? scmid : revision
if c.to_s =~ /^[0-9]*$/
"r#{c}"
if scmid?
"commit:#{scmid}"
else
"commit:#{c}"
"r#{revision}"
end
end
......
......@@ -75,7 +75,6 @@ class ChangesetTest < ActiveSupport::TestCase
c = Changeset.new(:repository => Project.find(1).repository,
:committed_on => 24.hours.ago,
:comments => 'Worked on this issue #1 @2h',
:scmid => '520',
:revision => '520',
:user => User.find(2))
assert_difference 'TimeEntry.count' do
......@@ -171,8 +170,8 @@ class ChangesetTest < ActiveSupport::TestCase
assert c.issues.first.project != c.project
end
def test_text_tag_numeric
c = Changeset.new(:scmid => '520', :revision => '520')
def test_text_tag_revision
c = Changeset.new(:revision => '520')
assert_equal 'r520', c.text_tag
end
......@@ -181,6 +180,11 @@ class ChangesetTest < ActiveSupport::TestCase
assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
end
def test_text_tag_hash_all_number
c = Changeset.new(:scmid => '0123456789', :revision => '0123456789')
assert_equal 'commit:0123456789', c.text_tag
end
def test_previous
changeset = Changeset.find_by_revision('3')
assert_equal Changeset.find_by_revision('2'), changeset.previous
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment