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
This commit is contained in:
parent
00d50157d3
commit
8407db9854
@ -126,11 +126,10 @@ class Changeset < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def text_tag
|
def text_tag
|
||||||
c = scmid? ? scmid : revision
|
if scmid?
|
||||||
if c.to_s =~ /^[0-9]*$/
|
"commit:#{scmid}"
|
||||||
"r#{c}"
|
|
||||||
else
|
else
|
||||||
"commit:#{c}"
|
"r#{revision}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ class ChangesetTest < ActiveSupport::TestCase
|
|||||||
c = Changeset.new(:repository => Project.find(1).repository,
|
c = Changeset.new(:repository => Project.find(1).repository,
|
||||||
:committed_on => 24.hours.ago,
|
:committed_on => 24.hours.ago,
|
||||||
:comments => 'Worked on this issue #1 @2h',
|
:comments => 'Worked on this issue #1 @2h',
|
||||||
:scmid => '520',
|
|
||||||
:revision => '520',
|
:revision => '520',
|
||||||
:user => User.find(2))
|
:user => User.find(2))
|
||||||
assert_difference 'TimeEntry.count' do
|
assert_difference 'TimeEntry.count' do
|
||||||
@ -171,8 +170,8 @@ class ChangesetTest < ActiveSupport::TestCase
|
|||||||
assert c.issues.first.project != c.project
|
assert c.issues.first.project != c.project
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_text_tag_numeric
|
def test_text_tag_revision
|
||||||
c = Changeset.new(:scmid => '520', :revision => '520')
|
c = Changeset.new(:revision => '520')
|
||||||
assert_equal 'r520', c.text_tag
|
assert_equal 'r520', c.text_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -181,6 +180,11 @@ class ChangesetTest < ActiveSupport::TestCase
|
|||||||
assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
|
assert_equal 'commit:7234cb2750b63f47bff735edc50a1c0a433c2518', c.text_tag
|
||||||
end
|
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
|
def test_previous
|
||||||
changeset = Changeset.find_by_revision('3')
|
changeset = Changeset.find_by_revision('3')
|
||||||
assert_equal Changeset.find_by_revision('2'), changeset.previous
|
assert_equal Changeset.find_by_revision('2'), changeset.previous
|
||||||
|
Loading…
x
Reference in New Issue
Block a user