Add some punctuations as regexp separators to fix commit logs
This commit is contained in:
parent
c60a529543
commit
af68112a1b
@ -575,6 +575,8 @@ class VCS
|
||||
end
|
||||
end
|
||||
|
||||
LOG_FIX_REGEXP_SEPARATORS = '/!:;|,#%&'
|
||||
|
||||
def format_changelog(path, arg, base_url = nil)
|
||||
env = {'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}
|
||||
cmd = %W"#{COMMAND} log --format=fuller --notes=commits --notes=log-fix --topo-order --no-merges"
|
||||
@ -596,13 +598,16 @@ class VCS
|
||||
s = s.lines
|
||||
fix.each_line do |x|
|
||||
case x
|
||||
when %r[^ +(\d+)s/(.+)/(.*)/]
|
||||
when %r[^ +(\d+)s([#{LOG_FIX_REGEXP_SEPARATORS}])(.+)\2(.*)\2]o
|
||||
n = $1.to_i
|
||||
wrong = $3
|
||||
correct = $4
|
||||
begin
|
||||
s[$1.to_i][$2] = $3
|
||||
s[n][wrong] = correct
|
||||
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
|
||||
message = ["format_changelog failed to replace #{wrong.dump} with #{correct.dump} at #$1\n"]
|
||||
from = [1, n-2].max
|
||||
to = [s.size-1, n+2].min
|
||||
s.each_with_index do |e, i|
|
||||
next if i < from
|
||||
break if to < i
|
||||
@ -610,8 +615,8 @@ class VCS
|
||||
end
|
||||
raise message.join('')
|
||||
end
|
||||
when %r[^( +)(\d+)i/(.*)/]
|
||||
s[$2.to_i, 0] = "#{$1}#{$3}\n"
|
||||
when %r[^( +)(\d+)i([#{LOG_FIX_REGEXP_SEPARATORS}])(.*)\3]o
|
||||
s[$2.to_i, 0] = "#{$1}#{$4}\n"
|
||||
when %r[^ +(\d+)(?:,(\d+))?d]
|
||||
n = $1.to_i
|
||||
e = $2
|
||||
|
Loading…
x
Reference in New Issue
Block a user