summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tool/lib/vcs.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index 2f9ba46e55..0c01abb0ac 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -580,7 +580,19 @@ class VCS
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('')