scm: mercurial: use 12 chars id for format_changeset_identifier (#14361)

git-svn-id: http://svn.redmine.org/redmine/trunk@12749 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-01 04:23:53 +00:00
parent fdc0731cb5
commit 5dcecec1bd
2 changed files with 12 additions and 1 deletions

View File

@ -59,7 +59,7 @@ class Repository::Mercurial < Repository
# Returns the readable identifier for the given mercurial changeset
def self.format_changeset_identifier(changeset)
"#{changeset.revision}:#{changeset.scmid}"
"#{changeset.revision}:#{changeset.scmid[0, 12]}"
end
# Returns the identifier for the given Mercurial changeset

View File

@ -297,6 +297,17 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
assert_equal '2:400bb8672109', c.format_identifier
end
def test_format_identifier_long_id
assert_equal 0, @repository.changesets.count
Changeset.create!(:repository => @repository,
:committed_on => Time.now,
:revision => '0',
:scmid => '0885933ad4f68d77c2649cd11f8311276e7ef7ce',
:comments => 'test')
c = @repository.changesets.find_by_revision('0')
assert_equal '0:0885933ad4f6', c.format_identifier
end
def test_find_changeset_by_empty_name
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets