ruby-changes:64757
From: Nobuyoshi <ko1@a...>
Date: Tue, 5 Jan 2021 21:47:41 +0900 (JST)
Subject: [ruby-changes:64757] 075824ebd5 (master): sync_default_gems.rb: reduced accesses to REPOSITORIES
https://git.ruby-lang.org/ruby.git/commit/?id=075824ebd5 From 075824ebd53932898015fa264c7b8b8804c946b0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 5 Jan 2021 21:23:07 +0900 Subject: sync_default_gems.rb: reduced accesses to REPOSITORIES diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 6202150..6db42b6 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -84,9 +84,10 @@ REPOSITORIES = { https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L84 } def sync_default_gems(gem) - puts "Sync #{REPOSITORIES[gem.to_sym]}" + repo = REPOSITORIES[gem.to_sym] + puts "Sync #{repo}" - upstream = File.join("..", "..", REPOSITORIES[gem.to_sym]) + upstream = File.join("..", "..", repo) case gem when "rubygems" @@ -342,11 +343,12 @@ IGNORE_FILE_PATTERN = https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L343 )\z/x def sync_default_gems_with_commits(gem, ranges, edit: nil) - puts "Sync #{REPOSITORIES[gem.to_sym]} with commit history." + repo = REPOSITORIES[gem.to_sym] + puts "Sync #{repo} with commit history." IO.popen(%W"git remote") do |f| unless f.read.split.include?(gem) - `git remote add #{gem} git@g...:#{REPOSITORIES[gem.to_sym]}.git` + `git remote add #{gem} git@g...:#{repo}.git` end end system(*%W"git fetch --no-tags #{gem}") @@ -376,7 +378,7 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L378 ENV["FILTER_BRANCH_SQUELCH_WARNING"] = "1" commits.each do |sha, subject| - puts "Pick #{sha} from #{REPOSITORIES[gem.to_sym]}." + puts "Pick #{sha} from #{repo}." skipped = false result = IO.popen(%W"git cherry-pick #{sha}", &:read) @@ -421,9 +423,8 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L423 puts "Update commit message: #{sha}" - prefix = "[#{(REPOSITORIES[gem.to_sym])}]".gsub(/\//, '\/') - suffix = "https://github.com/#{(REPOSITORIES[gem.to_sym])}/commit/#{sha[0,10]}" - `git filter-branch -f --msg-filter 'grep "" - | sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD` + suffix = "https://github.com/#{repo}/commit/#{sha[0,10]}" + `git filter-branch -f --msg-filter 'grep "" - | sed "1s|^|[#{repo}] |" && echo && echo #{suffix}' -- HEAD~1..HEAD` unless $?.success? puts "Failed to modify commit message of #{sha}" break -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/