summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-10 06:42:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-10 06:42:35 +0000
commit1a873c6a70e49653d3735a48a4c8de13d29e972b (patch)
treef9d974e8243391f8fefceb324aa9508167e2c26c /tool/vcs.rb
parent9a63e76b816f597a8ebef10646b3fbdcdf14a882 (diff)
vcs.rb: dryrun: option of GIT::SVN#commit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 77674c5..a4162ce 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -491,16 +491,22 @@ class VCS
end
end
- def commit
+ def last_changed_revision
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
+ return rev, com
+ end
+
+ def commit(opts = {})
+ dryrun = opts.fetch(:dryrun) {$DEBUG} if opts
+ rev, com = last_changed_revision
head = cmd_read(%W"#{COMMAND} symbolic-ref --short HEAD").chomp
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.insert(-2, "-n") if dryrun
dcommit << "--add-author-from" unless a == c
dcommit << r
system(*dcommit) or return false