vcs.rb: dcommit for each commit

svn to git bridge on ci.ruby-lang.org sometimes stalls when
dcommitting some commits at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-26 13:34:09 +00:00
Родитель e168963d8a
Коммит eab10990ac
1 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -479,16 +479,18 @@ class VCS
rev = cmd_read(%W"#{COMMAND} svn info"+[STDERR=>[:child, :out]])[/^Last Changed Rev: (\d+)/, 1]
com = cmd_read(%W"#{COMMAND} svn find-rev r#{rev}").chomp
# TODO: dcommit necessary commits only with --add-author-from
same = true
cmd_pipe([COMMAND, "log", "--format=%ae %ce", "#{com}..@"], "rb") do |r|
r.each do |l|
same &&= /^(\S+) +\1$/ =~ l
end
commits = cmd_read([COMMAND, "log", "--reverse", "--format=%H %ae %ce", "#{com}..@"], "rb").split("\n")
commits.each_with_index do |l, i|
r, a, c = l.split
dcommit = [COMMAND, "svn", "dcommit"]
dcommit.insert(-2, "-n") if $DEBUG
dcommit << "--add-author-from" unless a == c
dcommit << r
system(*dcommit) or return false
system(COMMAND, "rebase") or return false
end
ret = system(COMMAND, "svn", "dcommit", *(["--add-author-from"] unless same))
if ret and rev
if rev
old = [cmd_read(%W"#{COMMAND} log -1 --format=%H").chomp]
old << cmd_read(%W"#{COMMAND} svn reset -r#{rev}")[/^r#{rev} = (\h+)/, 1]
3.times do
@ -497,7 +499,7 @@ class VCS
break unless old.include?(cmd_read(%W"#{COMMAND} log -1 --format=%H").chomp)
end
end
ret
true
end
end
end