redmine-backporter: Clarify the actual control flow

The `rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}")`
case seems to be used if and only if it's manually specified in the
argument to the done command. It was hard to notice it with the previous
code.
This commit is contained in:
Takashi Kokubun 2024-09-02 02:05:21 -07:00
parent 73c39a5f93
commit 7d47f3c94f

View File

@ -351,10 +351,9 @@ eom
next next
end end
if rev.nil? && log = find_git_log("##@issue]") if rev && has_commit(rev, "ruby_#{TARGET_VERSION.tr('.','_')}")
/^commit (?<rev>\h{40})$/ =~ log notes = "ruby_#{TARGET_VERSION.tr('.','_')} commit:#{rev}."
end elsif rev.nil? && (log = find_git_log("##@issue]")) && /^commit (?<rev>\h{40})$/ =~ log
if log && rev
str = log[/merge revision\(s\) ([^:]+)(?=:)/] str = log[/merge revision\(s\) ([^:]+)(?=:)/]
if str if str
str.sub!(/\Amerge/, 'merged') str.sub!(/\Amerge/, 'merged')
@ -368,10 +367,6 @@ eom
str << notes str << notes
end end
notes = str 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 else
puts "no commit is found whose log include ##@issue" puts "no commit is found whose log include ##@issue"
next next