diff --git a/tool/vcs.rb b/tool/vcs.rb index 629d521320..a7cfa08d52 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -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