diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index 37c3e00ba..dcd07dad5 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -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 diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index da0b6ec77..a9c5da7eb 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -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