mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
9a63e76b81
commit
1a873c6a70
1 changed files with 8 additions and 2 deletions
10
tool/vcs.rb
10
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
|
||||
|
|
Loading…
Add table
Reference in a new issue