2013-02-22 23:51:12 -05:00
|
|
|
#!/bin/sh
|
|
|
|
# -*- ruby -*-
|
|
|
|
exec "${RUBY-ruby}" "-x" "$0" "$@" && [ ] if false
|
|
|
|
#!ruby
|
2019-04-28 09:36:23 -04:00
|
|
|
# This needs ruby 2.0, Subversion and Git.
|
2016-07-02 17:01:04 -04:00
|
|
|
# As a Ruby committer, run this in an SVN repository
|
|
|
|
# to commit a change.
|
2010-08-19 06:16:35 -04:00
|
|
|
|
|
|
|
require 'tempfile'
|
2019-04-21 07:49:11 -04:00
|
|
|
require 'net/http'
|
|
|
|
require 'uri'
|
2019-04-28 10:51:43 -04:00
|
|
|
require 'shellwords'
|
2010-08-19 06:16:35 -04:00
|
|
|
|
|
|
|
ENV['LC_ALL'] = 'C'
|
2019-11-11 11:00:22 -05:00
|
|
|
ORIGIN = 'git@git.ruby-lang.org:ruby.git'
|
2019-11-22 05:05:58 -05:00
|
|
|
GITHUB = 'git@github.com:ruby/ruby.git'
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-28 08:02:01 -04:00
|
|
|
module Merger
|
2019-04-28 09:02:09 -04:00
|
|
|
REPOS = 'svn+ssh://svn@ci.ruby-lang.org/ruby/'
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
2019-04-28 09:02:09 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
class << Merger
|
2019-08-28 01:50:21 -04:00
|
|
|
include Merger
|
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def help
|
|
|
|
puts <<-HELP
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1msimple backport\e[0m
|
2010-08-19 06:16:35 -04:00
|
|
|
ruby #$0 1234
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1mbackport from other branch\e[0m
|
2010-08-19 06:16:35 -04:00
|
|
|
ruby #$0 17502 mvm
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1mrevision increment\e[0m
|
2010-08-19 06:16:35 -04:00
|
|
|
ruby #$0 revisionup
|
|
|
|
|
2015-03-03 03:55:52 -05:00
|
|
|
\e[1mteeny increment\e[0m
|
|
|
|
ruby #$0 teenyup
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1mtagging major release\e[0m
|
2013-12-25 20:28:18 -05:00
|
|
|
ruby #$0 tag 2.2.0
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1mtagging patch release\e[0m (about 2.1.0 or later, it means X.Y.Z (Z > 0) release)
|
2010-08-19 06:16:35 -04:00
|
|
|
ruby #$0 tag
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[1mtagging preview/RC\e[0m
|
2013-12-25 20:28:18 -05:00
|
|
|
ruby #$0 tag 2.2.0-preview1
|
2012-11-01 15:24:21 -04:00
|
|
|
|
2017-12-14 22:22:51 -05:00
|
|
|
\e[1mremove tag\e[0m
|
|
|
|
ruby #$0 removetag 2.2.9
|
|
|
|
|
2015-02-17 03:10:52 -05:00
|
|
|
\e[33;1m* all operations shall be applied to the working directory.\e[0m
|
2019-04-28 11:57:34 -04:00
|
|
|
HELP
|
|
|
|
end
|
|
|
|
|
|
|
|
def interactive(str, editfile = nil)
|
|
|
|
loop do
|
|
|
|
yield if block_given?
|
|
|
|
STDERR.puts "\e[1;33m#{str} ([y]es|[a]bort|[r]etry#{'|[e]dit' if editfile})\e[0m"
|
|
|
|
case STDIN.gets
|
|
|
|
when /\Aa/i then exit
|
|
|
|
when /\Ar/i then redo
|
|
|
|
when /\Ay/i then break
|
|
|
|
when /\Ae/i then system(ENV['EDITOR'], editfile)
|
|
|
|
else exit
|
2019-04-28 08:02:01 -04:00
|
|
|
end
|
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
2015-03-06 19:18:46 -05:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def version_up(teeny: false)
|
|
|
|
now = Time.now
|
|
|
|
now = now.localtime(9*60*60) # server is Japan Standard Time +09:00
|
|
|
|
if svn_mode?
|
|
|
|
system('svn', 'revert', 'version.h')
|
|
|
|
else
|
|
|
|
system('git', 'checkout', 'HEAD', 'version.h')
|
2010-08-19 06:16:35 -04:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
v, pl = version
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
if teeny
|
|
|
|
v[2].succ!
|
|
|
|
end
|
|
|
|
if pl != '-1' # trunk does not have patchlevel
|
|
|
|
pl.succ!
|
|
|
|
end
|
2015-03-03 03:55:52 -05:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
str = open('version.h', 'rb', &:read)
|
|
|
|
ruby_release_date = str[/RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR/] || now.strftime('"%Y-%m-%d"')
|
|
|
|
[%W[RUBY_VERSION "#{v.join('.')}"],
|
|
|
|
%W[RUBY_VERSION_CODE #{v.join('')}],
|
|
|
|
%W[RUBY_VERSION_MAJOR #{v[0]}],
|
|
|
|
%W[RUBY_VERSION_MINOR #{v[1]}],
|
|
|
|
%W[RUBY_VERSION_TEENY #{v[2]}],
|
|
|
|
%W[RUBY_RELEASE_DATE #{ruby_release_date}],
|
|
|
|
%W[RUBY_RELEASE_CODE #{now.strftime('%Y%m%d')}],
|
|
|
|
%W[RUBY_PATCHLEVEL #{pl}],
|
|
|
|
%W[RUBY_RELEASE_YEAR #{now.year}],
|
|
|
|
%W[RUBY_RELEASE_MONTH #{now.month}],
|
|
|
|
%W[RUBY_RELEASE_DAY #{now.day}],
|
|
|
|
].each do |(k, i)|
|
|
|
|
str.sub!(/^(#define\s+#{k}\s+).*$/, "\\1#{i}")
|
|
|
|
end
|
|
|
|
str.sub!(/\s+\z/m, '')
|
|
|
|
fn = sprintf('version.h.tmp.%032b', rand(1 << 31))
|
|
|
|
File.rename('version.h', fn)
|
|
|
|
open('version.h', 'wb') do |f|
|
|
|
|
f.puts(str)
|
|
|
|
end
|
|
|
|
File.unlink(fn)
|
|
|
|
end
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def tag(relname)
|
|
|
|
# relname:
|
|
|
|
# * 2.2.0-preview1
|
|
|
|
# * 2.2.0-rc1
|
|
|
|
# * 2.2.0
|
|
|
|
v, pl = version
|
|
|
|
if relname
|
|
|
|
abort "patchlevel is not -1 but '#{pl}' for preview or rc" if pl != '-1' && /-(?:preview|rc)/ =~ relname
|
2021-04-05 22:25:10 -04:00
|
|
|
abort "patchlevel is not 0 but '#{pl}' for the first release" if pl != '0' && relname.end_with?(".0")
|
2019-04-28 11:57:34 -04:00
|
|
|
pl = relname[/-(.*)\z/, 1]
|
|
|
|
curver = "#{v.join('.')}#{("-#{pl}" if pl)}"
|
|
|
|
if relname != curver
|
|
|
|
abort "given relname '#{relname}' conflicts current version '#{curver}'"
|
2019-04-28 09:36:23 -04:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
else
|
|
|
|
if pl == '-1'
|
|
|
|
abort 'no relname is given and not in a release branch even if this is patch release'
|
2019-04-28 09:36:23 -04:00
|
|
|
end
|
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
tagname = "v#{v.join('_')}#{("_#{pl}" if v[0] < "2" || (v[0] == "2" && v[1] < "1") || /^(?:preview|rc)/ =~ pl)}"
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
if svn_mode?
|
2019-04-28 10:51:43 -04:00
|
|
|
if relname
|
2019-04-28 11:57:34 -04:00
|
|
|
branch_url = `svn info`[/URL: (.*)/, 1]
|
2019-04-28 10:51:43 -04:00
|
|
|
else
|
2019-04-28 11:57:34 -04:00
|
|
|
branch_url = "#{REPOS}branches/ruby_"
|
|
|
|
if v[0] < '2' || (v[0] == '2' && v[1] < '1')
|
|
|
|
abort 'patchlevel must be greater than 0 for patch release' if pl == '0'
|
|
|
|
branch_url << v.join('_')
|
2019-04-28 10:51:43 -04:00
|
|
|
else
|
2019-04-28 11:57:34 -04:00
|
|
|
abort 'teeny must be greater than 0 for patch release' if v[2] == '0'
|
|
|
|
branch_url << v.join('_').sub(/_\d+\z/, '')
|
2019-04-28 10:51:43 -04:00
|
|
|
end
|
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
tag_url = "#{REPOS}tags/#{tagname}"
|
2019-08-28 01:50:21 -04:00
|
|
|
system('svn', 'info', tag_url, out: IO::NULL, err: IO::NULL)
|
|
|
|
if $?.success?
|
2019-04-28 11:57:34 -04:00
|
|
|
abort 'specfied tag already exists. check tag name and remove it if you want to force re-tagging'
|
2019-04-28 11:53:06 -04:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
execute('svn', 'cp', '-m', "add tag #{tagname}", branch_url, tag_url, interactive: true)
|
|
|
|
else
|
|
|
|
unless execute('git', 'tag', tagname)
|
|
|
|
abort 'specfied tag already exists. check tag name and remove it if you want to force re-tagging'
|
2019-04-28 11:53:06 -04:00
|
|
|
end
|
2019-11-11 11:00:22 -05:00
|
|
|
execute('git', 'push', ORIGIN, tagname, interactive: true)
|
2017-12-14 22:22:51 -05:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
2017-12-14 22:22:51 -05:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def remove_tag(relname)
|
|
|
|
# relname:
|
|
|
|
# * 2.2.0-preview1
|
|
|
|
# * 2.2.0-rc1
|
|
|
|
# * 2.2.0
|
|
|
|
# * v2_2_0_preview1
|
|
|
|
# * v2_2_0_rc1
|
|
|
|
# * v2_2_0
|
|
|
|
unless relname
|
|
|
|
raise ArgumentError, 'relname is not specified'
|
|
|
|
end
|
|
|
|
if /^v/ !~ relname
|
|
|
|
tagname = "v#{relname.gsub(/[.-]/, '_')}"
|
|
|
|
else
|
|
|
|
tagname = relname
|
2019-04-28 09:36:23 -04:00
|
|
|
end
|
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
if svn_mode?
|
|
|
|
tag_url = "#{REPOS}tags/#{tagname}"
|
|
|
|
execute('svn', 'rm', '-m', "remove tag #{tagname}", tag_url, interactive: true)
|
|
|
|
else
|
|
|
|
execute('git', 'tag', '-d', tagname)
|
2019-11-11 11:00:22 -05:00
|
|
|
execute('git', 'push', ORIGIN, ":#{tagname}", interactive: true)
|
2019-11-22 05:05:58 -05:00
|
|
|
execute('git', 'push', GITHUB, ":#{tagname}", interactive: true)
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
|
|
|
end
|
2019-04-28 08:16:20 -04:00
|
|
|
|
2019-04-28 12:22:28 -04:00
|
|
|
def update_revision_h
|
2019-04-28 11:57:34 -04:00
|
|
|
if svn_mode?
|
2019-04-28 12:22:28 -04:00
|
|
|
execute('svn', 'up')
|
|
|
|
end
|
|
|
|
execute('ruby tool/file2lastrev.rb --revision.h . > revision.tmp')
|
|
|
|
execute('tool/ifchange', '--timestamp=.revision.time', 'revision.h', 'revision.tmp')
|
|
|
|
execute('rm', '-f', 'revision.tmp')
|
|
|
|
end
|
|
|
|
|
|
|
|
def stat
|
|
|
|
if svn_mode?
|
|
|
|
`svn stat`
|
|
|
|
else
|
|
|
|
`git status --short`
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def diff(file = nil)
|
|
|
|
if svn_mode?
|
2019-04-30 09:23:20 -04:00
|
|
|
command = %w[svn diff --diff-cmd=diff -x -upw]
|
2019-04-28 11:57:34 -04:00
|
|
|
else
|
2019-04-30 09:23:20 -04:00
|
|
|
command = %w[git diff --color]
|
2019-04-28 12:22:28 -04:00
|
|
|
end
|
2019-05-02 17:24:57 -04:00
|
|
|
IO.popen(command + [file].compact, &:read)
|
2019-04-28 12:22:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def commit(file)
|
|
|
|
if svn_mode?
|
|
|
|
begin
|
|
|
|
execute('svn', 'ci', '-F', file)
|
2019-07-27 07:15:53 -04:00
|
|
|
execute('svn', 'update') # svn ci doesn't update revision info on working copy
|
2019-04-28 12:22:28 -04:00
|
|
|
ensure
|
|
|
|
execute('rm', '-f', 'subversion.commitlog')
|
|
|
|
end
|
|
|
|
else
|
|
|
|
current_branch = IO.popen(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], &:read).strip
|
|
|
|
execute('git', 'add', '.') &&
|
2021-02-02 05:12:49 -05:00
|
|
|
execute('git', 'commit', '-F', file)
|
2019-04-28 09:36:23 -04:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
2019-04-28 12:00:20 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
private
|
2019-04-28 12:00:20 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def svn_mode?
|
|
|
|
return @svn_mode if defined?(@svn_mode)
|
2019-04-30 09:24:45 -04:00
|
|
|
@svn_mode = system("svn info", %i(out err) => IO::NULL)
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
2019-04-28 09:36:23 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
# Prints the version of Ruby found in version.h
|
|
|
|
def version
|
|
|
|
v = p = nil
|
|
|
|
open 'version.h', 'rb' do |f|
|
|
|
|
f.each_line do |l|
|
|
|
|
case l
|
|
|
|
when /^#define RUBY_VERSION "(\d+)\.(\d+)\.(\d+)"$/
|
|
|
|
v = $~.captures
|
|
|
|
when /^#define RUBY_VERSION_TEENY (\d+)$/
|
|
|
|
(v ||= [])[2] = $1
|
|
|
|
when /^#define RUBY_PATCHLEVEL (-?\d+)$/
|
|
|
|
p = $1
|
2019-04-28 08:16:20 -04:00
|
|
|
end
|
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
end
|
|
|
|
if v and !v[0]
|
|
|
|
open 'include/ruby/version.h', 'rb' do |f|
|
|
|
|
f.each_line do |l|
|
|
|
|
case l
|
|
|
|
when /^#define RUBY_API_VERSION_MAJOR (\d+)/
|
|
|
|
v[0] = $1
|
|
|
|
when /^#define RUBY_API_VERSION_MINOR (\d+)/
|
|
|
|
v[1] = $1
|
2019-04-28 08:16:20 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
return v, p
|
|
|
|
end
|
2019-04-28 10:51:43 -04:00
|
|
|
|
2019-04-28 11:57:34 -04:00
|
|
|
def execute(*cmd, interactive: false)
|
|
|
|
if interactive
|
|
|
|
Merger.interactive("OK?: #{cmd.shelljoin}")
|
2019-04-28 10:51:43 -04:00
|
|
|
end
|
2019-04-28 11:57:34 -04:00
|
|
|
puts "+ #{cmd.shelljoin}"
|
|
|
|
system(*cmd)
|
|
|
|
end
|
|
|
|
end
|
2010-08-19 06:16:35 -04:00
|
|
|
|
|
|
|
case ARGV[0]
|
2015-03-03 03:55:52 -05:00
|
|
|
when "teenyup"
|
2019-04-28 09:36:23 -04:00
|
|
|
Merger.version_up(teeny: true)
|
2019-04-28 12:22:28 -04:00
|
|
|
puts Merger.diff('version.h')
|
2019-04-28 09:36:23 -04:00
|
|
|
when "up", /\A(ver|version|rev|revision|lv|level|patch\s*level)\s*up\z/
|
2019-04-28 08:02:01 -04:00
|
|
|
Merger.version_up
|
2019-04-28 12:22:28 -04:00
|
|
|
puts Merger.diff('version.h')
|
2010-08-19 06:16:35 -04:00
|
|
|
when "tag"
|
2019-04-28 10:51:43 -04:00
|
|
|
Merger.tag(ARGV[1])
|
2017-12-15 20:56:14 -05:00
|
|
|
when /\A(?:remove|rm|del)_?tag\z/
|
2019-04-28 11:53:06 -04:00
|
|
|
Merger.remove_tag(ARGV[1])
|
2010-08-19 06:16:35 -04:00
|
|
|
when nil, "-h", "--help"
|
2019-04-28 08:02:01 -04:00
|
|
|
Merger.help
|
2010-08-19 06:16:35 -04:00
|
|
|
exit
|
|
|
|
else
|
2019-04-28 12:22:28 -04:00
|
|
|
Merger.update_revision_h
|
2012-02-06 07:55:56 -05:00
|
|
|
|
2016-03-29 05:59:26 -04:00
|
|
|
case ARGV[0]
|
|
|
|
when /--ticket=(.*)/
|
|
|
|
tickets = $1.split(/,/).map{|num| " [Backport ##{num}]"}.join
|
2012-09-23 22:23:48 -04:00
|
|
|
ARGV.shift
|
2012-10-12 03:07:10 -04:00
|
|
|
else
|
2016-03-29 05:59:26 -04:00
|
|
|
tickets = ''
|
2012-09-23 22:23:48 -04:00
|
|
|
end
|
|
|
|
|
2019-04-21 07:49:11 -04:00
|
|
|
revstr = ARGV[0].delete('^, :\-0-9a-fA-F')
|
2014-02-26 23:10:03 -05:00
|
|
|
revs = revstr.split(/[,\s]+/)
|
2019-04-21 07:49:11 -04:00
|
|
|
commit_message = ''
|
2010-08-19 06:16:35 -04:00
|
|
|
|
|
|
|
revs.each do |rev|
|
2019-04-21 07:49:11 -04:00
|
|
|
git_rev = nil
|
2010-08-19 06:16:35 -04:00
|
|
|
case rev
|
2019-04-21 07:49:11 -04:00
|
|
|
when /\A\d{1,6}\z/
|
|
|
|
svn_rev = rev
|
|
|
|
when /\A\h{7,40}\z/
|
|
|
|
git_rev = rev
|
2010-08-19 06:16:35 -04:00
|
|
|
when nil then
|
|
|
|
puts "#$0 revision"
|
|
|
|
exit
|
2014-02-26 23:10:03 -05:00
|
|
|
else
|
|
|
|
puts "invalid revision part '#{rev}' in '#{ARGV[0]}'"
|
|
|
|
exit
|
2010-08-19 06:16:35 -04:00
|
|
|
end
|
|
|
|
|
2019-04-21 07:49:11 -04:00
|
|
|
# Merge revision from Git patch or SVN
|
|
|
|
if git_rev
|
|
|
|
git_uri = "https://git.ruby-lang.org/ruby.git/patch/?id=#{git_rev}"
|
|
|
|
resp = Net::HTTP.get_response(URI(git_uri))
|
|
|
|
if resp.code != '200'
|
|
|
|
abort "'#{git_uri}' returned status '#{resp.code}':\n#{resp.body}"
|
|
|
|
end
|
2019-08-19 02:37:28 -04:00
|
|
|
patch = resp.body.sub(/^diff --git a\/version\.h b\/version\.h\nindex .*\n--- a\/version\.h\n\+\+\+ b\/version\.h\n@@ .* @@\n(?:[-\+ ].*\n|\n)+/, '')
|
2019-04-21 07:49:11 -04:00
|
|
|
|
2019-04-30 09:13:47 -04:00
|
|
|
message = "\n\n#{(patch[/^Subject: (.*)\n\ndiff --git/m, 1] || "Message not found for revision: #{git_rev}\n")}"
|
2019-04-28 12:22:28 -04:00
|
|
|
puts '+ git apply'
|
2019-08-19 02:37:28 -04:00
|
|
|
IO.popen(['git', 'apply'], 'wb') { |f| f.write(patch) }
|
2019-04-21 07:49:11 -04:00
|
|
|
else
|
2019-04-28 08:40:37 -04:00
|
|
|
default_merge_branch = (%r{^URL: .*/branches/ruby_1_8_} =~ `svn info` ? 'branches/ruby_1_8' : 'trunk')
|
2019-04-28 09:02:09 -04:00
|
|
|
svn_src = "#{Merger::REPOS}#{ARGV[1] || default_merge_branch}"
|
2019-04-28 09:14:55 -04:00
|
|
|
message = IO.popen(['svn', 'log', '-c', svn_rev, svn_src], &:read)
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-28 09:14:55 -04:00
|
|
|
cmd = ['svn', 'merge', '--accept=postpone', '-c', svn_rev, svn_src]
|
2019-04-21 07:49:11 -04:00
|
|
|
puts "+ #{cmd.join(' ')}"
|
|
|
|
system(*cmd)
|
|
|
|
end
|
2010-08-19 06:16:35 -04:00
|
|
|
|
2019-04-21 07:49:11 -04:00
|
|
|
commit_message << message.sub(/\A-+\nr.*/, '').sub(/\n-+\n\z/, '').gsub(/^./, "\t\\&")
|
2010-08-19 06:16:35 -04:00
|
|
|
end
|
|
|
|
|
2019-04-28 12:22:28 -04:00
|
|
|
if Merger.diff.empty?
|
|
|
|
Merger.interactive('Nothing is modified, right?')
|
2013-02-21 03:31:45 -05:00
|
|
|
end
|
|
|
|
|
2019-04-28 08:02:01 -04:00
|
|
|
Merger.version_up
|
2010-08-19 06:16:35 -04:00
|
|
|
f = Tempfile.new 'merger.rb'
|
2017-09-10 08:35:06 -04:00
|
|
|
f.printf "merge revision(s) %s:%s", revstr, tickets
|
2019-04-21 07:49:11 -04:00
|
|
|
f.write commit_message
|
2010-08-19 06:16:35 -04:00
|
|
|
f.flush
|
|
|
|
f.close
|
|
|
|
|
2019-04-28 12:22:28 -04:00
|
|
|
Merger.interactive('conflicts resolved?', f.path) do
|
|
|
|
IO.popen(ENV['PAGER'] || ['less', '-R'], 'w') do |g|
|
|
|
|
g << Merger.stat
|
2012-03-25 23:57:03 -04:00
|
|
|
g << "\n\n"
|
2012-03-25 23:57:07 -04:00
|
|
|
f.open
|
2012-03-25 23:57:03 -04:00
|
|
|
g << f.read
|
2012-03-25 23:57:07 -04:00
|
|
|
f.close
|
2012-03-25 23:57:03 -04:00
|
|
|
g << "\n\n"
|
2019-04-28 12:22:28 -04:00
|
|
|
g << Merger.diff
|
2010-08-19 06:16:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-04-28 12:22:28 -04:00
|
|
|
unless Merger.commit(f.path)
|
2010-08-19 06:16:35 -04:00
|
|
|
puts 'commit failed; try again.'
|
|
|
|
end
|
|
|
|
|
2014-05-27 06:34:43 -04:00
|
|
|
f.close(true)
|
2010-08-19 06:16:35 -04:00
|
|
|
end
|