mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Pass args
in pr-pull
instead of using global args
.
This commit is contained in:
parent
8a1f8ab858
commit
76cc31f134
@ -76,7 +76,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def signoff!(pr, tap:)
|
def signoff!(pr, tap:, args:)
|
||||||
message = Utils.popen_read "git", "-C", tap.path, "log", "-1", "--pretty=%B"
|
message = Utils.popen_read "git", "-C", tap.path, "log", "-1", "--pretty=%B"
|
||||||
subject = message.lines.first.strip
|
subject = message.lines.first.strip
|
||||||
|
|
||||||
@ -95,15 +95,15 @@ module Homebrew
|
|||||||
body += "\n\n#{close_message}" unless body.include? close_message
|
body += "\n\n#{close_message}" unless body.include? close_message
|
||||||
new_message = [subject, body, trailers].join("\n\n").strip
|
new_message = [subject, body, trailers].join("\n\n").strip
|
||||||
|
|
||||||
if Homebrew.args.dry_run?
|
if args.dry_run?
|
||||||
puts "git commit --amend --signoff -m $message"
|
puts "git commit --amend --signoff -m $message"
|
||||||
else
|
else
|
||||||
safe_system "git", "-C", tap.path, "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", new_message
|
safe_system "git", "-C", tap.path, "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", new_message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cherry_pick_pr!(pr, path: ".")
|
def cherry_pick_pr!(pr, path: ".", args:)
|
||||||
if Homebrew.args.dry_run?
|
if args.dry_run?
|
||||||
puts <<~EOS
|
puts <<~EOS
|
||||||
git fetch --force origin +refs/pull/#{pr}/head
|
git fetch --force origin +refs/pull/#{pr}/head
|
||||||
git merge-base HEAD FETCH_HEAD
|
git merge-base HEAD FETCH_HEAD
|
||||||
@ -120,7 +120,7 @@ module Homebrew
|
|||||||
result = Homebrew.args.verbose? ? system(*cherry_pick_args) : quiet_system(*cherry_pick_args)
|
result = Homebrew.args.verbose? ? system(*cherry_pick_args) : quiet_system(*cherry_pick_args)
|
||||||
|
|
||||||
unless result
|
unless result
|
||||||
if Homebrew.args.resolve?
|
if args.resolve?
|
||||||
odie "Cherry-pick failed: try to resolve it."
|
odie "Cherry-pick failed: try to resolve it."
|
||||||
else
|
else
|
||||||
system "git", "-C", path, "cherry-pick", "--abort"
|
system "git", "-C", path, "cherry-pick", "--abort"
|
||||||
@ -138,19 +138,19 @@ module Homebrew
|
|||||||
opoo "Current branch is #{branch}: do you need to pull inside #{ref}?"
|
opoo "Current branch is #{branch}: do you need to pull inside #{ref}?"
|
||||||
end
|
end
|
||||||
|
|
||||||
def formulae_need_bottles?(tap, original_commit)
|
def formulae_need_bottles?(tap, original_commit, args:)
|
||||||
return if Homebrew.args.dry_run?
|
return if args.dry_run?
|
||||||
|
|
||||||
changed_formulae(tap, original_commit).any? do |f|
|
changed_formulae(tap, original_commit).any? do |f|
|
||||||
!f.bottle_unneeded? && !f.bottle_disabled?
|
!f.bottle_unneeded? && !f.bottle_disabled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mirror_formulae(tap, original_commit, publish: true, org:, repo:)
|
def mirror_formulae(tap, original_commit, publish: true, org:, repo:, args:)
|
||||||
changed_formulae(tap, original_commit).select do |f|
|
changed_formulae(tap, original_commit).select do |f|
|
||||||
stable_urls = [f.stable.url] + f.stable.mirrors
|
stable_urls = [f.stable.url] + f.stable.mirrors
|
||||||
stable_urls.grep(%r{^https://dl.bintray.com/#{org}/#{repo}/}) do |mirror_url|
|
stable_urls.grep(%r{^https://dl.bintray.com/#{org}/#{repo}/}) do |mirror_url|
|
||||||
if Homebrew.args.dry_run?
|
if args.dry_run?
|
||||||
puts "brew mirror #{f.full_name}"
|
puts "brew mirror #{f.full_name}"
|
||||||
else
|
else
|
||||||
odebug "Mirroring #{mirror_url}"
|
odebug "Mirroring #{mirror_url}"
|
||||||
@ -210,7 +210,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pr_pull
|
def pr_pull
|
||||||
pr_pull_args.parse
|
args = pr_pull_args.parse
|
||||||
|
|
||||||
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
||||||
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||||
@ -239,14 +239,16 @@ module Homebrew
|
|||||||
Dir.mktmpdir pr do |dir|
|
Dir.mktmpdir pr do |dir|
|
||||||
cd dir do
|
cd dir do
|
||||||
original_commit = Utils.popen_read("git", "-C", tap.path, "rev-parse", "HEAD").chomp
|
original_commit = Utils.popen_read("git", "-C", tap.path, "rev-parse", "HEAD").chomp
|
||||||
cherry_pick_pr! pr, path: tap.path
|
cherry_pick_pr!(pr, path: tap.path, args: args)
|
||||||
signoff! pr, tap: tap unless args.clean?
|
signoff!(pr, tap: tap, args: args) unless args.clean?
|
||||||
|
|
||||||
unless args.no_upload?
|
unless args.no_upload?
|
||||||
mirror_formulae(tap, original_commit, org: bintray_org, repo: mirror_repo, publish: !args.no_publish?)
|
mirror_formulae(tap, original_commit,
|
||||||
|
org: bintray_org, repo: mirror_repo, publish: !args.no_publish?,
|
||||||
|
args: args)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless formulae_need_bottles? tap, original_commit
|
unless formulae_need_bottles?(tap, original_commit, args: args)
|
||||||
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user