[前][次][番号順一覧][スレッド一覧]

ruby-changes:62181

From: Kazuhiro <ko1@a...>
Date: Fri, 10 Jul 2020 19:29:52 +0900 (JST)
Subject: [ruby-changes:62181] 82489f0242 (master): Show messages around the line when replacing failed in format_changelog

https://git.ruby-lang.org/ruby.git/commit/?id=82489f0242

From 82489f02429c14f945dbef787308d13adfa0018d Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Fri, 10 Jul 2020 19:27:11 +0900
Subject: Show messages around the line when replacing failed in
 format_changelog


diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index 2f9ba46..0c01abb 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -580,7 +580,19 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L580
               s = s.lines
               fix.each_line do |x|
                 if %r[^ +(\d+)s/(.+)/(.*)/] =~ x
-                  s[$1.to_i][$2] = $3
+                  begin
+                    s[$1.to_i][$2] = $3
+                  rescue IndexError
+                    message = ["format_changelog failed to replace #{$2.dump} with #{$3.dump} at #$1\n"]
+                    from = [1, $1.to_i-2].max
+                    to = [s.size-1, $1.to_i+2].min
+                    s.each_with_index do |e, i|
+                      next if i < from
+                      break if to < i
+                      message << "#{i}:#{e}"
+                    end
+                    raise message.join('')
+                  end
                 end
               end
               s = s.join('')
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]