From f92b7b7b97d57ad3f58034556224141d2f0e65c7 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 2 Feb 2021 19:15:45 +0900 Subject: [PATCH] Pass revision by hand if the commit message lacks the ticket number --- tool/redmine-backporter.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb index 06c37ab811..df54c7eb26 100755 --- a/tool/redmine-backporter.rb +++ b/tool/redmine-backporter.rb @@ -422,9 +422,10 @@ eom }, "done" => proc{|args| - raise CommandSyntaxError unless /\A(\d+)?(?:\s*-- +(.*))?\z/ =~ args - notes = $2 + raise CommandSyntaxError unless /\A(\d+)?(?: by (\h+))?(?:\s*-- +(.*))?\z/ =~ args + notes = $3 notes.strip! if notes + rev = $2 if $1 i = $1.to_i i = @issues[i]["id"] if @issues && i < @issues.size @@ -435,7 +436,8 @@ eom next end - if system("svn info #{RUBY_REPO_PATH&.shellescape}", %i(out err) => IO::NULL) # SVN + if rev + elsif system("svn info #{RUBY_REPO_PATH&.shellescape}", %i(out err) => IO::NULL) # SVN if (log = find_svn_log("##@issue]")) && (/revision="(?\d+)/ =~ log) rev = "r#{rev}" end @@ -457,6 +459,10 @@ eom str << notes end notes = str + elsif rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}") + # Backport commit's log doesn't have the issue number. + # Instead of that manually it's provided. + notes = "ruby_#{TARGET_VERSION.tr('.','_')} commit:#{rev}." else puts "no commit is found whose log include ##@issue" next