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:
parent
fdc0731cb5
commit
5dcecec1bd
|
@ -59,7 +59,7 @@ class Repository::Mercurial < Repository
|
||||||
|
|
||||||
# Returns the readable identifier for the given mercurial changeset
|
# Returns the readable identifier for the given mercurial changeset
|
||||||
def self.format_changeset_identifier(changeset)
|
def self.format_changeset_identifier(changeset)
|
||||||
"#{changeset.revision}:#{changeset.scmid}"
|
"#{changeset.revision}:#{changeset.scmid[0, 12]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the identifier for the given Mercurial changeset
|
# Returns the identifier for the given Mercurial changeset
|
||||||
|
|
|
@ -297,6 +297,17 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||||
assert_equal '2:400bb8672109', c.format_identifier
|
assert_equal '2:400bb8672109', c.format_identifier
|
||||||
end
|
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
|
def test_find_changeset_by_empty_name
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
|
|
Loading…
Reference in New Issue