mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Show messages around the line when replacing failed in format_changelog
This commit is contained in:
parent
615758bd82
commit
82489f0242
1 changed files with 13 additions and 1 deletions
|
@ -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('')
|
||||
|
|
Loading…
Reference in a new issue