Show messages around the line when replacing failed in format_changelog
This commit is contained in:
parent
615758bd82
commit
82489f0242
@ -580,7 +580,19 @@ class VCS
|
|||||||
s = s.lines
|
s = s.lines
|
||||||
fix.each_line do |x|
|
fix.each_line do |x|
|
||||||
if %r[^ +(\d+)s/(.+)/(.*)/] =~ x
|
if %r[^ +(\d+)s/(.+)/(.*)/] =~ x
|
||||||
|
begin
|
||||||
s[$1.to_i][$2] = $3
|
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
|
||||||
end
|
end
|
||||||
s = s.join('')
|
s = s.join('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user