]> source.dussan.org Git - redmine.git/commitdiff
Merged r21792 from trunk to 5.0-stable (#36258).
authorGo MAEDA <maeda@farend.jp>
Thu, 1 Sep 2022 06:47:06 +0000 (06:47 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 1 Sep 2022 06:47:06 +0000 (06:47 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21794 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/mercurial_adapter.rb
test/fixtures/repositories/mercurial_repository.hg
test/functional/repositories_mercurial_controller_test.rb
test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
test/unit/repository_mercurial_test.rb

index da831323ff8fbd9a7a4675a1eaaf9a64b6e00c9e..43e248a253432bcbe452ca4a56df62ff7961a9d9 100644 (file)
@@ -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
index 33a5d135e7964295afc066c7bf549703ed37a4af..1388fc3593aa668677bb257ff436552ee8072d82 100644 (file)
Binary files a/test/fixtures/repositories/mercurial_repository.hg and b/test/fixtures/repositories/mercurial_repository.hg differ
index d88a95f0aa50274c40fbc56a1c00d7d8b55a1091..a31dd91a83aef232b486e08445ca81b91f39204f 100644 (file)
@@ -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
index cd6a919e8e9bdfd5eb7dc16705914137ae0a3d30..b329048d6686439a555ac97edb232217e5e68d76 100644 (file)
@@ -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 <jsmith@foo.bar>', 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',
index 622ee5b69095947b86bcee451befae96daf9667d..d383394bdf80fb7d3365f06c543465479b81cc18 100644 (file)
@@ -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