From: Go MAEDA Date: Thu, 1 Sep 2022 06:47:06 +0000 (+0000) Subject: Merged r21792 from trunk to 5.0-stable (#36258). X-Git-Tag: 5.0.3~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8cbe5014b18dd88c4224a9e579d11ed5e5f6a17b;p=redmine.git Merged r21792 from trunk to 5.0-stable (#36258). git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21794 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index da831323f..43e248a25 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -230,7 +230,7 @@ module Redmine end ), :time => Time.parse(le['date']['__content__']), - :message => CGI.unescape(le['msg']['__content__']), + :message => CGI.unescape(le['msg']['__content__'] || ''), :paths => paths, :parents => parents_ary) end diff --git a/test/fixtures/repositories/mercurial_repository.hg b/test/fixtures/repositories/mercurial_repository.hg index 33a5d135e..1388fc359 100644 Binary files a/test/fixtures/repositories/mercurial_repository.hg and b/test/fixtures/repositories/mercurial_repository.hg differ diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index d88a95f0a..a31dd91a8 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -27,7 +27,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s PRJ_ID = 3 - NUM_REV = 40 + NUM_REV = 43 def setup super diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb index cd6a919e8..b329048d6 100644 --- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb @@ -87,8 +87,8 @@ class MercurialAdapterTest < ActiveSupport::TestCase adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo) repo_path = adp.info.root_url.tr('\\', "/") assert_equal REPOSITORY_PATH, repo_path - assert_equal '39', adp.info.lastrev.revision - assert_equal '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4', adp.info.lastrev.scmid + assert_equal '42', adp.info.lastrev.revision + assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', adp.info.lastrev.scmid end end @@ -113,6 +113,14 @@ class MercurialAdapterTest < ActiveSupport::TestCase assert_equal "ctrl-s\u0013message", revisions[0].message end + def test_empty_message + revisions = @adapter.revisions(nil, '05b4c556a8a1', '05b4c556a8a1') + assert_equal 1, revisions.size + assert_equal '41', revisions[0].revision + assert_equal 'jsmith ', revisions[0].author + assert_equal '', revisions[0].message + end + def test_parents revs1 = @adapter.revisions(nil, 0, 0) assert_equal 1, revs1.size @@ -349,7 +357,12 @@ class MercurialAdapterTest < ActiveSupport::TestCase @adapter.branches.each do |b| branches << b end - assert_equal 9, branches.length + assert_equal 10, branches.length + + branch = branches[-10] + assert_equal 'branch-empty-message', branch.to_s + assert_equal '42', branch.revision + assert_equal 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', branch.scmid branch = branches[-9] assert_equal 'double"quote"branch', branch.to_s @@ -400,6 +413,7 @@ class MercurialAdapterTest < ActiveSupport::TestCase def test_branchmap bm = { + 'branch-empty-message' => 'ba20ebce08dbd2f0320b93faf7bba7c86186a1f7', 'double"quote"branch' => '04aed9840e9266e535f5f20f7e42c9f9f84f9cf4', 'issue-23055-ctrl-char' => '3e998343166a1b8273973bcd46dd2bad74344d74', 'default' => '31eeee7395c8c78e66dd54c50addd078d10b2355', diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 622ee5b69..d383394bd 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -25,7 +25,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase include Redmine::I18n REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s - NUM_REV = 40 + NUM_REV = 43 def setup User.current = nil @@ -170,7 +170,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - assert_equal 51, @repository.filechanges.count + assert_equal 53, @repository.filechanges.count rev0 = @repository.changesets.find_by_revision('0') assert_equal "Initial import.\nThe repository contains 3 files.", rev0.comments @@ -597,7 +597,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase @repository.fetch_changesets @project.reload assert_equal NUM_REV, @repository.changesets.count - [(NUM_REV - 1).to_s, "04aed9840e92", "04aed"].each do |r1| + [(NUM_REV - 1).to_s, "ba20ebce08db", "ba20e"].each do |r1| changeset = @repository.find_changeset_by_name(r1) assert_nil changeset.next end