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