2017-06-28 13:18:03 +03:00
|
|
|
# sync following repositories to ruby repository
|
|
|
|
#
|
|
|
|
# * https://github.com/rubygems/rubygems
|
2020-01-10 16:56:46 +03:00
|
|
|
# * https://github.com/rubygems/bundler
|
2017-08-29 14:52:50 +03:00
|
|
|
# * https://github.com/ruby/rdoc
|
2019-04-27 08:53:09 +03:00
|
|
|
# * https://github.com/ruby/reline
|
2017-06-28 13:18:03 +03:00
|
|
|
# * https://github.com/flori/json
|
|
|
|
# * https://github.com/ruby/psych
|
|
|
|
# * https://github.com/ruby/fileutils
|
|
|
|
# * https://github.com/ruby/fiddle
|
|
|
|
# * https://github.com/ruby/stringio
|
|
|
|
# * https://github.com/ruby/io-console
|
|
|
|
# * https://github.com/ruby/csv
|
|
|
|
# * https://github.com/ruby/webrick
|
|
|
|
# * https://github.com/ruby/dbm
|
|
|
|
# * https://github.com/ruby/gdbm
|
|
|
|
# * https://github.com/ruby/sdbm
|
|
|
|
# * https://github.com/ruby/etc
|
|
|
|
# * https://github.com/ruby/date
|
|
|
|
# * https://github.com/ruby/zlib
|
|
|
|
# * https://github.com/ruby/fcntl
|
|
|
|
# * https://github.com/ruby/strscan
|
2017-08-02 05:20:48 +03:00
|
|
|
# * https://github.com/ruby/ipaddr
|
2018-06-11 10:42:28 +03:00
|
|
|
# * https://github.com/ruby/logger
|
|
|
|
# * https://github.com/ruby/prime
|
|
|
|
# * https://github.com/ruby/matrix
|
|
|
|
# * https://github.com/ruby/ostruct
|
2018-07-09 17:01:05 +03:00
|
|
|
# * https://github.com/ruby/irb
|
2018-07-20 04:25:59 +03:00
|
|
|
# * https://github.com/ruby/tracer
|
2018-07-25 14:53:57 +03:00
|
|
|
# * https://github.com/ruby/forwardable
|
2018-07-25 15:28:17 +03:00
|
|
|
# * https://github.com/ruby/mutex_m
|
2019-05-14 15:36:59 +03:00
|
|
|
# * https://github.com/ruby/racc
|
2019-11-06 05:29:51 +03:00
|
|
|
# * https://github.com/ruby/singleton
|
2019-11-06 16:17:03 +03:00
|
|
|
# * https://github.com/ruby/open3
|
2019-11-07 02:43:10 +03:00
|
|
|
# * https://github.com/ruby/getoptlong
|
2019-11-07 05:17:12 +03:00
|
|
|
# * https://github.com/ruby/pstore
|
2019-11-07 07:21:46 +03:00
|
|
|
# * https://github.com/ruby/delegate
|
2019-11-07 07:53:05 +03:00
|
|
|
# * https://github.com/ruby/benchmark
|
2019-11-07 09:24:59 +03:00
|
|
|
# * https://github.com/ruby/net-pop
|
2019-11-07 09:38:40 +03:00
|
|
|
# * https://github.com/ruby/net-smtp
|
2019-11-07 10:34:03 +03:00
|
|
|
# * https://github.com/ruby/cgi
|
2019-11-08 08:31:43 +03:00
|
|
|
# * https://github.com/ruby/readline
|
2019-11-08 09:39:39 +03:00
|
|
|
# * https://github.com/ruby/readline-ext
|
2019-11-08 09:47:18 +03:00
|
|
|
# * https://github.com/ruby/observer
|
2019-11-08 13:21:47 +03:00
|
|
|
# * https://github.com/ruby/timeout
|
2019-11-08 14:18:08 +03:00
|
|
|
# * https://github.com/ruby/yaml
|
2019-11-11 16:17:50 +03:00
|
|
|
# * https://github.com/ruby/uri
|
2019-11-26 12:25:56 +03:00
|
|
|
# * https://github.com/ruby/openssl
|
2019-10-29 17:08:37 +03:00
|
|
|
# * https://github.com/ruby/did_you_mean
|
2017-06-28 13:18:03 +03:00
|
|
|
#
|
|
|
|
|
2019-07-14 08:29:38 +03:00
|
|
|
require 'fileutils'
|
2019-07-14 09:22:12 +03:00
|
|
|
include FileUtils
|
2019-07-14 08:29:38 +03:00
|
|
|
|
2017-07-03 05:13:59 +03:00
|
|
|
$repositories = {
|
2017-06-28 13:18:03 +03:00
|
|
|
rubygems: 'rubygems/rubygems',
|
2020-01-10 16:56:46 +03:00
|
|
|
bundler: 'rubygems/bundler',
|
2017-08-29 14:52:50 +03:00
|
|
|
rdoc: 'ruby/rdoc',
|
2019-04-27 08:53:09 +03:00
|
|
|
reline: 'ruby/reline',
|
2017-06-28 13:18:03 +03:00
|
|
|
json: 'flori/json',
|
2017-07-14 08:33:15 +03:00
|
|
|
psych: 'ruby/psych',
|
2017-06-28 13:18:03 +03:00
|
|
|
fileutils: 'ruby/fileutils',
|
|
|
|
fiddle: 'ruby/fiddle',
|
|
|
|
stringio: 'ruby/stringio',
|
|
|
|
ioconsole: 'ruby/io-console',
|
|
|
|
csv: 'ruby/csv',
|
|
|
|
webrick: 'ruby/webrick',
|
|
|
|
dbm: 'ruby/dbm',
|
|
|
|
gdbm: 'ruby/gdbm',
|
|
|
|
sdbm: 'ruby/sdbm',
|
|
|
|
etc: 'ruby/etc',
|
|
|
|
date: 'ruby/date',
|
|
|
|
zlib: 'ruby/zlib',
|
|
|
|
fcntl: 'ruby/fcntl',
|
|
|
|
strscan: 'ruby/strscan',
|
2017-08-02 05:20:48 +03:00
|
|
|
ipaddr: 'ruby/ipaddr',
|
2018-06-11 10:42:28 +03:00
|
|
|
logger: 'ruby/logger',
|
|
|
|
prime: 'ruby/prime',
|
|
|
|
matrix: 'ruby/matrix',
|
|
|
|
ostruct: 'ruby/ostruct',
|
2018-07-09 17:01:05 +03:00
|
|
|
irb: 'ruby/irb',
|
2018-07-20 05:24:59 +03:00
|
|
|
tracer: 'ruby/tracer',
|
2018-07-25 15:15:45 +03:00
|
|
|
forwardable: "ruby/forwardable",
|
2019-05-14 15:36:59 +03:00
|
|
|
mutex_m: "ruby/mutex_m",
|
2019-11-06 05:29:51 +03:00
|
|
|
racc: "ruby/racc",
|
2019-11-06 16:17:03 +03:00
|
|
|
singleton: "ruby/singleton",
|
|
|
|
open3: "ruby/open3",
|
2019-11-07 02:43:10 +03:00
|
|
|
getoptlong: "ruby/getoptlong",
|
2019-11-07 05:17:12 +03:00
|
|
|
pstore: "ruby/pstore",
|
2019-11-07 07:21:46 +03:00
|
|
|
delegate: "ruby/delegate",
|
2019-11-07 07:53:05 +03:00
|
|
|
benchmark: "ruby/benchmark",
|
2019-11-07 09:24:59 +03:00
|
|
|
netpop: "ruby/net-pop",
|
2019-11-07 09:38:40 +03:00
|
|
|
netsmtp: "ruby/net-smtp",
|
2019-11-07 10:34:03 +03:00
|
|
|
cgi: "ruby/cgi",
|
2019-11-08 08:31:43 +03:00
|
|
|
readline: "ruby/readline",
|
2019-11-08 09:47:18 +03:00
|
|
|
readlineext: "ruby/readline-ext",
|
|
|
|
observer: "ruby/observer",
|
2019-11-08 13:21:47 +03:00
|
|
|
timeout: "ruby/timeout",
|
2019-11-08 14:18:08 +03:00
|
|
|
yaml: "ruby/yaml",
|
2019-11-11 16:17:50 +03:00
|
|
|
uri: "ruby/uri",
|
2019-11-26 12:25:56 +03:00
|
|
|
openssl: "ruby/openssl",
|
2019-10-29 17:08:37 +03:00
|
|
|
did_you_mean: "ruby/did_you_mean"
|
2017-06-28 13:18:03 +03:00
|
|
|
}
|
|
|
|
|
2017-07-03 05:13:59 +03:00
|
|
|
def sync_default_gems(gem)
|
|
|
|
puts "Sync #{$repositories[gem.to_sym]}"
|
|
|
|
|
2019-07-14 08:17:06 +03:00
|
|
|
upstream = File.join("..", "..", $repositories[gem.to_sym])
|
|
|
|
|
2017-07-03 05:13:59 +03:00
|
|
|
case gem
|
|
|
|
when "rubygems"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[lib/rubygems* test/rubygems])
|
|
|
|
cp_r(Dir.glob("#{upstream}/lib/rubygems*"), "lib")
|
|
|
|
cp_r("#{upstream}/test/rubygems", "test")
|
2018-11-03 02:07:56 +03:00
|
|
|
when "bundler"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[lib/bundler* libexec/bundler libexec/bundle spec/bundler man/bundle* man/gemfile*])
|
|
|
|
cp_r(Dir.glob("#{upstream}/lib/bundler*"), "lib")
|
|
|
|
cp_r(Dir.glob("#{upstream}/exe/bundle*"), "libexec")
|
|
|
|
cp_r("#{upstream}/bundler.gemspec", "lib/bundler")
|
|
|
|
cp_r("#{upstream}/spec", "spec/bundler")
|
|
|
|
cp_r(Dir.glob("#{upstream}/man/*.{1,5,1\.txt,5\.txt,ronn}"), "man")
|
|
|
|
rm_rf(%w[spec/bundler/support/artifice/vcr_cassettes])
|
2017-07-03 05:13:59 +03:00
|
|
|
when "rdoc"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[lib/rdoc* test/rdoc libexec/rdoc libexec/ri])
|
|
|
|
cp_r(Dir.glob("#{upstream}/lib/rdoc*"), "lib")
|
2019-07-26 10:34:15 +03:00
|
|
|
cp_r("#{upstream}/test/rdoc", "test")
|
2019-07-14 09:22:12 +03:00
|
|
|
cp_r("#{upstream}/rdoc.gemspec", "lib/rdoc")
|
|
|
|
cp_r("#{upstream}/exe/rdoc", "libexec")
|
|
|
|
cp_r("#{upstream}/exe/ri", "libexec")
|
2020-01-11 15:48:06 +03:00
|
|
|
rm_rf(%w[lib/rdoc/markdown.kpeg lib/rdoc/markdown/literals.kpeg lib/rdoc/rd/block_pager.ry lib/rdoc/rd/inline_parser.ry])
|
2017-08-29 14:52:50 +03:00
|
|
|
`git checkout lib/rdoc/.document`
|
2019-04-27 08:53:09 +03:00
|
|
|
when "reline"
|
2019-08-29 15:49:19 +03:00
|
|
|
rm_rf(%w[lib/reline* test/reline])
|
2019-07-14 09:22:12 +03:00
|
|
|
cp_r(Dir.glob("#{upstream}/lib/reline*"), "lib")
|
2019-08-18 01:52:49 +03:00
|
|
|
cp_r("#{upstream}/test/reline", "test")
|
2019-07-14 09:22:12 +03:00
|
|
|
cp_r("#{upstream}/reline.gemspec", "lib/reline")
|
2017-07-03 05:13:59 +03:00
|
|
|
when "json"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/json test/json])
|
|
|
|
cp_r("#{upstream}/ext/json/ext", "ext/json")
|
|
|
|
cp_r("#{upstream}/tests", "test/json")
|
|
|
|
cp_r("#{upstream}/lib", "ext/json")
|
|
|
|
cp_r("#{upstream}/json.gemspec", "ext/json")
|
2019-10-31 04:18:57 +03:00
|
|
|
rm_rf(%w[ext/json/lib/json/ext ext/json/lib/json/pure.rb ext/json/lib/json/pure])
|
|
|
|
`git checkout ext/json/extconf.rb ext/json/parser/prereq.mk ext/json/generator/depend ext/json/parser/depend ext/json/depend`
|
2017-07-03 05:13:59 +03:00
|
|
|
when "psych"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/psych test/psych])
|
|
|
|
cp_r("#{upstream}/ext/psych", "ext")
|
|
|
|
cp_r("#{upstream}/lib", "ext/psych")
|
|
|
|
cp_r("#{upstream}/test/psych", "test")
|
|
|
|
rm_rf(%w[ext/psych/lib/org ext/psych/lib/psych.jar ext/psych/lib/psych_jars.rb])
|
|
|
|
rm_rf(%w[ext/psych/lib/psych.{bundle,so} ext/psych/lib/2.*])
|
|
|
|
rm_rf(["ext/psych/yaml/LICENSE"])
|
|
|
|
cp_r("#{upstream}/psych.gemspec", "ext/psych")
|
2017-07-14 08:33:15 +03:00
|
|
|
`git checkout ext/psych/depend`
|
2017-07-03 05:13:59 +03:00
|
|
|
when "fiddle"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/fiddle test/fiddle])
|
|
|
|
cp_r("#{upstream}/ext/fiddle", "ext")
|
|
|
|
cp_r("#{upstream}/lib", "ext/fiddle")
|
|
|
|
cp_r("#{upstream}/test/fiddle", "test")
|
|
|
|
cp_r("#{upstream}/fiddle.gemspec", "ext/fiddle")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/fiddle/depend`
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/fiddle/lib/fiddle.{bundle,so}])
|
2017-07-03 05:13:59 +03:00
|
|
|
when "stringio"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/stringio test/stringio])
|
|
|
|
cp_r("#{upstream}/ext/stringio", "ext")
|
|
|
|
cp_r("#{upstream}/test/stringio", "test")
|
|
|
|
cp_r("#{upstream}/stringio.gemspec", "ext/stringio")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/stringio/depend ext/stringio/README.md`
|
|
|
|
when "ioconsole"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/io/console test/io/console])
|
|
|
|
cp_r("#{upstream}/ext/io/console", "ext/io")
|
|
|
|
cp_r("#{upstream}/test/io/console", "test/io")
|
|
|
|
mkdir_p("ext/io/console/lib")
|
|
|
|
cp_r("#{upstream}/lib/io/console", "ext/io/console/lib")
|
|
|
|
cp_r("#{upstream}/io-console.gemspec", "ext/io/console")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/io/console/depend`
|
|
|
|
when "dbm"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/dbm test/dbm])
|
|
|
|
cp_r("#{upstream}/ext/dbm", "ext")
|
|
|
|
cp_r("#{upstream}/test/dbm", "test")
|
|
|
|
cp_r("#{upstream}/dbm.gemspec", "ext/dbm")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/dbm/depend`
|
|
|
|
when "gdbm"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/gdbm test/gdbm])
|
|
|
|
cp_r("#{upstream}/ext/gdbm", "ext")
|
|
|
|
cp_r("#{upstream}/test/gdbm", "test")
|
|
|
|
cp_r("#{upstream}/gdbm.gemspec", "ext/gdbm")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/gdbm/depend ext/gdbm/README`
|
|
|
|
when "sdbm"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/sdbm test/sdbm])
|
|
|
|
cp_r("#{upstream}/ext/sdbm", "ext")
|
|
|
|
cp_r("#{upstream}/test/sdbm", "test")
|
|
|
|
cp_r("#{upstream}/sdbm.gemspec", "ext/sdbm")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/sdbm/depend`
|
|
|
|
when "etc"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/etc test/etc])
|
|
|
|
cp_r("#{upstream}/ext/etc", "ext")
|
|
|
|
cp_r("#{upstream}/test/etc", "test")
|
|
|
|
cp_r("#{upstream}/etc.gemspec", "ext/etc")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/etc/depend`
|
|
|
|
when "date"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/date test/date])
|
|
|
|
cp_r("#{upstream}/ext/date", "ext")
|
|
|
|
cp_r("#{upstream}/lib", "ext/date")
|
|
|
|
cp_r("#{upstream}/test/date", "test")
|
|
|
|
cp_r("#{upstream}/date.gemspec", "ext/date")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/date/depend`
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(["ext/date/lib/date_core.bundle"])
|
2017-07-03 05:13:59 +03:00
|
|
|
when "zlib"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/zlib test/zlib])
|
|
|
|
cp_r("#{upstream}/ext/zlib", "ext")
|
|
|
|
cp_r("#{upstream}/test/zlib", "test")
|
|
|
|
cp_r("#{upstream}/zlib.gemspec", "ext/zlib")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/zlib/depend`
|
|
|
|
when "fcntl"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/fcntl])
|
|
|
|
cp_r("#{upstream}/ext/fcntl", "ext")
|
|
|
|
cp_r("#{upstream}/fcntl.gemspec", "ext/fcntl")
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/fcntl/depend`
|
|
|
|
when "strscan"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[ext/strscan test/strscan])
|
|
|
|
cp_r("#{upstream}/ext/strscan", "ext")
|
|
|
|
cp_r("#{upstream}/test/strscan", "test")
|
|
|
|
cp_r("#{upstream}/strscan.gemspec", "ext/strscan")
|
|
|
|
rm_rf(%w["ext/strscan/regenc.h ext/strscan/regint.h"])
|
2017-07-03 05:13:59 +03:00
|
|
|
`git checkout ext/strscan/depend`
|
2019-05-14 15:36:59 +03:00
|
|
|
when "racc"
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(%w[lib/racc* ext/racc test/racc])
|
|
|
|
cp_r(Dir.glob("#{upstream}/lib/racc*"), "lib")
|
|
|
|
mkdir_p("ext/racc/cparse")
|
|
|
|
cp_r(Dir.glob("#{upstream}/ext/racc/cparse/*"), "ext/racc/cparse")
|
|
|
|
cp_r("#{upstream}/test", "test/racc")
|
2019-12-10 11:03:13 +03:00
|
|
|
cp_r("#{upstream}/racc.gemspec", "lib/racc")
|
2019-10-30 15:00:01 +03:00
|
|
|
rm_rf("test/racc/lib")
|
|
|
|
rm_rf("lib/racc/cparse-jruby.jar")
|
|
|
|
`git checkout ext/racc/cparse/README ext/racc/cparse/depend`
|
2019-11-07 10:34:03 +03:00
|
|
|
when "cgi"
|
|
|
|
rm_rf(%w[lib/cgi.rb lib/cgi ext/cgi test/cgi])
|
|
|
|
cp_r("#{upstream}/ext/cgi", "ext")
|
|
|
|
cp_r("#{upstream}/lib", ".")
|
|
|
|
cp_r("#{upstream}/test/cgi", "test")
|
|
|
|
cp_r("#{upstream}/cgi.gemspec", "lib/cgi")
|
|
|
|
`git checkout ext/cgi/escape/depend`
|
2019-11-26 12:25:56 +03:00
|
|
|
when "openssl"
|
|
|
|
rm_rf(%w[ext/openssl test/openssl])
|
|
|
|
cp_r("#{upstream}/ext/openssl", "ext")
|
|
|
|
mkdir_p("ext/openssl/lib")
|
|
|
|
cp_r("#{upstream}/lib/openssl", "ext/openssl/lib")
|
|
|
|
cp_r("#{upstream}/lib/openssl.rb", "ext/openssl/lib")
|
|
|
|
cp_r("#{upstream}/test", "test/openssl")
|
|
|
|
rm_rf("test/openssl/envutil.rb")
|
|
|
|
cp_r("#{upstream}/openssl.gemspec", "ext/openssl")
|
|
|
|
cp_r("#{upstream}/HISTORY.md", "ext/openssl")
|
|
|
|
`git checkout ext/openssl/depend`
|
2019-11-07 09:24:59 +03:00
|
|
|
when "netpop"
|
|
|
|
sync_lib "net-pop"
|
|
|
|
mv "lib/net-pop.gemspec", "lib/net/pop"
|
2019-11-07 09:38:40 +03:00
|
|
|
when "netsmtp"
|
|
|
|
sync_lib "net-smtp"
|
|
|
|
mv "lib/net-smtp.gemspec", "lib/net/smtp"
|
2019-11-08 09:39:39 +03:00
|
|
|
when "readlineext"
|
|
|
|
sync_lib "readline-ext"
|
|
|
|
mv "lib/readline-ext.gemspec", "ext/readline"
|
2019-10-29 17:08:37 +03:00
|
|
|
when "did_you_mean"
|
|
|
|
rm_rf(%w[lib/did_you_mean* test/did_you_mean])
|
|
|
|
cp_r(Dir.glob("#{upstream}/lib/did_you_mean*"), "lib")
|
|
|
|
cp_r("#{upstream}/did_you_mean.gemspec", "lib/did_you_mean")
|
|
|
|
cp_r("#{upstream}/test", "test/did_you_mean")
|
|
|
|
rm_rf(%w[test/did_you_mean/tree_spell/test_explore.rb])
|
2017-07-03 05:13:59 +03:00
|
|
|
else
|
2019-11-06 05:33:03 +03:00
|
|
|
sync_lib gem
|
2017-07-03 05:13:59 +03:00
|
|
|
end
|
2017-06-28 13:18:03 +03:00
|
|
|
end
|
|
|
|
|
2019-07-27 05:23:47 +03:00
|
|
|
IGNORE_FILE_PATTERN = /(\.travis.yml|appveyor\.yml|azure\-pipelines\.yml|\.gitignore|Gemfile|README\.md|History\.txt|Rakefile|CODE_OF_CONDUCT\.md)/
|
|
|
|
|
2019-07-14 10:56:39 +03:00
|
|
|
def sync_default_gems_with_commits(gem, range)
|
|
|
|
puts "Sync #{$repositories[gem.to_sym]} with commit history."
|
|
|
|
|
|
|
|
IO.popen(%W"git remote") do |f|
|
|
|
|
unless f.read.split.include?(gem)
|
|
|
|
`git remote add #{gem} git@github.com:#{$repositories[gem.to_sym]}.git`
|
|
|
|
end
|
|
|
|
end
|
2019-11-04 03:38:34 +03:00
|
|
|
system(*%W"git fetch --no-tags #{gem}")
|
2019-07-14 11:15:06 +03:00
|
|
|
|
2019-11-30 08:48:26 +03:00
|
|
|
unless range.include?("..")
|
|
|
|
range = "#{range}~1..#{range}"
|
|
|
|
end
|
|
|
|
|
2019-08-20 13:26:12 +03:00
|
|
|
commits = IO.popen(%W"git log --format=%H,%s #{range}") do |f|
|
|
|
|
f.read.split("\n").reverse.map{|commit| commit.split(',', 2)}
|
2019-07-26 12:14:32 +03:00
|
|
|
end
|
2019-07-26 11:06:54 +03:00
|
|
|
|
2019-07-26 12:14:32 +03:00
|
|
|
# Ignore Merge commit and insufficiency commit for ruby core repository.
|
|
|
|
commits.delete_if do |sha, subject|
|
2019-08-20 13:26:12 +03:00
|
|
|
files = IO.popen(%W"git diff-tree --no-commit-id --name-only -r #{sha}") do |f|
|
|
|
|
f.readlines
|
2019-07-26 12:14:32 +03:00
|
|
|
end
|
2019-08-07 16:29:02 +03:00
|
|
|
subject =~ /^Merge/ || subject =~ /^Auto Merge/ || files.all?{|file| file =~ IGNORE_FILE_PATTERN}
|
2019-07-26 12:14:32 +03:00
|
|
|
end
|
2019-07-26 11:06:54 +03:00
|
|
|
|
2019-07-26 12:14:32 +03:00
|
|
|
puts "Try to pick these commits:"
|
|
|
|
puts commits.map{|commit| commit.join(": ")}.join("\n")
|
|
|
|
puts "----"
|
2019-07-14 11:53:14 +03:00
|
|
|
|
2019-07-27 06:31:07 +03:00
|
|
|
failed_commits = []
|
|
|
|
|
2019-12-17 17:38:18 +03:00
|
|
|
ENV["FILTER_BRANCH_SQUELCH_WARNING"] = "1"
|
|
|
|
|
2019-07-26 12:14:32 +03:00
|
|
|
commits.each do |sha, subject|
|
|
|
|
puts "Pick #{sha} from #{$repositories[gem.to_sym]}."
|
2019-07-14 15:31:16 +03:00
|
|
|
|
2019-07-27 06:31:07 +03:00
|
|
|
skipped = false
|
|
|
|
result = IO.popen(%W"git cherry-pick #{sha}").read
|
|
|
|
if result =~ /nothing\ to\ commit/
|
|
|
|
`git reset`
|
|
|
|
skipped = true
|
|
|
|
puts "Skip empty commit #{sha}"
|
|
|
|
end
|
|
|
|
next if skipped
|
|
|
|
|
|
|
|
if result.empty?
|
|
|
|
failed_commits << sha
|
|
|
|
`git reset` && `git checkout .` && `git clean -fd`
|
|
|
|
skipped = true
|
2019-07-26 12:14:32 +03:00
|
|
|
puts "Failed to pick #{sha}"
|
|
|
|
end
|
2019-07-27 06:31:07 +03:00
|
|
|
next if skipped
|
|
|
|
|
|
|
|
puts "Update commit message: #{sha}"
|
|
|
|
|
2019-07-26 12:14:32 +03:00
|
|
|
prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/')
|
|
|
|
suffix = "https://github.com/#{($repositories[gem.to_sym])}/commit/#{sha[0,10]}"
|
|
|
|
`git filter-branch -f --msg-filter 'sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD`
|
|
|
|
unless $?.success?
|
|
|
|
puts "Failed to modify commit message of #{sha}"
|
|
|
|
break
|
2019-07-14 11:15:06 +03:00
|
|
|
end
|
|
|
|
end
|
2019-07-27 06:31:07 +03:00
|
|
|
|
2019-12-07 16:02:24 +03:00
|
|
|
unless failed_commits.empty?
|
|
|
|
puts "---- failed commits ----"
|
|
|
|
puts failed_commits
|
|
|
|
end
|
2019-07-14 10:56:39 +03:00
|
|
|
end
|
|
|
|
|
2018-07-17 14:39:16 +03:00
|
|
|
def sync_lib(repo)
|
2019-04-26 12:18:09 +03:00
|
|
|
unless File.directory?("../#{repo}")
|
2019-07-26 10:45:18 +03:00
|
|
|
abort %[Expected '../#{repo}' \(#{File.expand_path("../#{repo}")}\) to be a directory, but it wasn't.]
|
2019-04-26 12:18:09 +03:00
|
|
|
end
|
2019-07-14 09:22:12 +03:00
|
|
|
rm_rf(["lib/#{repo}.rb", "lib/#{repo}/*", "test/test_#{repo}.rb"])
|
|
|
|
cp_r(Dir.glob("../#{repo}/lib/*"), "lib")
|
2018-07-25 14:53:57 +03:00
|
|
|
tests = if File.directory?("test/#{repo}")
|
|
|
|
"test/#{repo}"
|
|
|
|
else
|
|
|
|
"test/test_#{repo}.rb"
|
|
|
|
end
|
2019-11-07 02:43:10 +03:00
|
|
|
cp_r("../#{repo}/#{tests}", "test") if File.exist?("../#{repo}/#{tests}")
|
2018-07-25 14:47:04 +03:00
|
|
|
gemspec = if File.directory?("lib/#{repo}")
|
|
|
|
"lib/#{repo}/#{repo}.gemspec"
|
|
|
|
else
|
|
|
|
"lib/#{repo}.gemspec"
|
|
|
|
end
|
2019-07-14 09:22:12 +03:00
|
|
|
cp_r("../#{repo}/#{repo}.gemspec", "#{gemspec}")
|
2018-07-17 14:39:16 +03:00
|
|
|
end
|
|
|
|
|
2018-10-25 13:16:28 +03:00
|
|
|
def update_default_gems(gem)
|
|
|
|
author, repository = $repositories[gem.to_sym].split('/')
|
|
|
|
|
|
|
|
unless File.exist?("../../#{author}/#{repository}")
|
2019-07-14 09:22:12 +03:00
|
|
|
mkdir_p("../../#{author}")
|
2018-10-25 13:16:28 +03:00
|
|
|
`git clone git@github.com:#{author}/#{repository}.git ../../#{author}/#{repository}`
|
|
|
|
end
|
|
|
|
|
|
|
|
Dir.chdir("../../#{author}/#{repository}") do
|
|
|
|
unless `git remote`.match(/ruby\-core/)
|
|
|
|
`git remote add ruby-core git@github.com:ruby/ruby.git`
|
2019-08-18 11:40:01 +03:00
|
|
|
`git fetch ruby-core --no-tags`
|
2019-08-18 12:08:38 +03:00
|
|
|
`git co ruby-core/master`
|
2018-10-25 13:16:28 +03:00
|
|
|
`git branch ruby-core`
|
|
|
|
end
|
|
|
|
`git co ruby-core`
|
2019-08-18 12:08:38 +03:00
|
|
|
`git fetch ruby-core master --no-tags`
|
|
|
|
`git rebase ruby-core/master`
|
2018-10-25 13:16:28 +03:00
|
|
|
`git co master`
|
|
|
|
`git stash`
|
|
|
|
`git pull --rebase`
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
case ARGV[0]
|
|
|
|
when "up"
|
|
|
|
$repositories.keys.each{|gem| update_default_gems(gem.to_s)}
|
|
|
|
when "all"
|
2017-07-03 05:13:59 +03:00
|
|
|
$repositories.keys.each{|gem| sync_default_gems(gem.to_s)}
|
2018-10-25 13:16:28 +03:00
|
|
|
else
|
2019-07-14 10:56:39 +03:00
|
|
|
if ARGV[1]
|
|
|
|
sync_default_gems_with_commits(ARGV[0], ARGV[1])
|
|
|
|
else
|
|
|
|
sync_default_gems(ARGV[0])
|
|
|
|
end
|
2017-06-28 13:18:03 +03:00
|
|
|
end
|