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
|
||||
|
||||
def signoff!(pr, tap:)
|
||||
def signoff!(pr, tap:, args:)
|
||||
message = Utils.popen_read "git", "-C", tap.path, "log", "-1", "--pretty=%B"
|
||||
subject = message.lines.first.strip
|
||||
|
||||
@ -95,15 +95,15 @@ module Homebrew
|
||||
body += "\n\n#{close_message}" unless body.include? close_message
|
||||
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"
|
||||
else
|
||||
safe_system "git", "-C", tap.path, "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", new_message
|
||||
end
|
||||
end
|
||||
|
||||
def cherry_pick_pr!(pr, path: ".")
|
||||
if Homebrew.args.dry_run?
|
||||
def cherry_pick_pr!(pr, path: ".", args:)
|
||||
if args.dry_run?
|
||||
puts <<~EOS
|
||||
git fetch --force origin +refs/pull/#{pr}/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)
|
||||
|
||||
unless result
|
||||
if Homebrew.args.resolve?
|
||||
if args.resolve?
|
||||
odie "Cherry-pick failed: try to resolve it."
|
||||
else
|
||||
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}?"
|
||||
end
|
||||
|
||||
def formulae_need_bottles?(tap, original_commit)
|
||||
return if Homebrew.args.dry_run?
|
||||
def formulae_need_bottles?(tap, original_commit, args:)
|
||||
return if args.dry_run?
|
||||
|
||||
changed_formulae(tap, original_commit).any? do |f|
|
||||
!f.bottle_unneeded? && !f.bottle_disabled?
|
||||
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|
|
||||
stable_urls = [f.stable.url] + f.stable.mirrors
|
||||
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}"
|
||||
else
|
||||
odebug "Mirroring #{mirror_url}"
|
||||
@ -210,7 +210,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def pr_pull
|
||||
pr_pull_args.parse
|
||||
args = pr_pull_args.parse
|
||||
|
||||
bintray_user = ENV["HOMEBREW_BINTRAY_USER"]
|
||||
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"]
|
||||
@ -239,14 +239,16 @@ module Homebrew
|
||||
Dir.mktmpdir pr do |dir|
|
||||
cd dir do
|
||||
original_commit = Utils.popen_read("git", "-C", tap.path, "rev-parse", "HEAD").chomp
|
||||
cherry_pick_pr! pr, path: tap.path
|
||||
signoff! pr, tap: tap unless args.clean?
|
||||
cherry_pick_pr!(pr, path: tap.path, args: args)
|
||||
signoff!(pr, tap: tap, args: args) unless args.clean?
|
||||
|
||||
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
|
||||
|
||||
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"
|
||||
next
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user