diff --git a/Library/Homebrew/dev-cmd/bump-cask-pr.rb b/Library/Homebrew/dev-cmd/bump-cask-pr.rb index 6000b4ea48..3654de10b2 100644 --- a/Library/Homebrew/dev-cmd/bump-cask-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-cask-pr.rb @@ -52,7 +52,7 @@ module Homebrew flag "--fork-org=", description: "Use the specified GitHub organization for forking." switch "-f", "--force", - description: "Ignore duplicate open PRs." + hidden: true conflicts "--dry-run", "--write" conflicts "--no-audit", "--online" @@ -68,6 +68,7 @@ module Homebrew args = bump_cask_pr_args.parse odeprecated "brew bump-cask-pr --online" if args.online? + odisabled "brew bump-cask-pr --force" if args.force? # This will be run by `brew audit` or `brew style` later so run it first to # not start spamming during normal output. @@ -252,7 +253,7 @@ module Homebrew state: "open", version: nil, file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s, - args: args) + quiet: args.quiet?) # if we haven't already found open requests, try for an exact match across closed requests new_version.instance_variables.each do |version_type| @@ -265,7 +266,7 @@ module Homebrew state: "closed", version: shortened_version(version, cask: cask), file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s, - args: args, + quiet: args.quiet?, ) end end diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index 535a4896d5..634fa73110 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -71,7 +71,7 @@ module Homebrew description: "Specify the new commit corresponding to the specified git " \ "or specified ." switch "-f", "--force", - description: "Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified." + description: "Remove all mirrors if `--mirror` was not specified." flag "--python-package-name=", description: "Use the specified when finding Python resources for . " \ "If no package name is specified, it will be inferred from the formula's stable URL." @@ -433,7 +433,7 @@ module Homebrew GitHub.check_for_duplicate_pull_requests(formula.name, tap_remote_repo, state: "open", file: formula.path.relative_path_from(formula.tap.path).to_s, - args: args) + quiet: args.quiet?) end def check_new_version(formula, tap_remote_repo, args:, version: nil, url: nil, tag: nil) @@ -464,7 +464,7 @@ module Homebrew version: version, state: "closed", file: formula.path.relative_path_from(formula.tap.path).to_s, - args: args) + quiet: args.quiet?) end def alias_update_pair(formula, new_formula_version) diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index 08d0aeff7d..b84d94b66c 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -44,7 +44,6 @@ module Homebrew flag "--start-with=", description: "Letter or word that the list of package results should alphabetically follow." switch "-f", "--force", - description: "Ignore duplicate open PRs.", hidden: true conflicts "--cask", "--formula" @@ -64,6 +63,8 @@ module Homebrew raise UsageError, "`--limit` must be used with either `--formula` or `--cask`." end + odisabled "brew bump --force" if args.force? + Homebrew.with_no_api_env do formulae_and_casks = if args.installed? formulae = args.cask? ? [] : Formula.installed @@ -492,7 +493,7 @@ module Homebrew return end - return if !args.force? && (open_pull_requests.present? || closed_pull_requests.present?) + return if open_pull_requests.present? || closed_pull_requests.present? version_args = if version_info.multiple_versions %W[--version-arm=#{new_version.arm} --version-intel=#{new_version.intel}] @@ -507,7 +508,6 @@ module Homebrew "--no-browse", "--message=Created by `brew bump`", ] - bump_cask_pr_args << "--force" if args.force? system HOMEBREW_BREW_FILE, *bump_cask_pr_args end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 6d9cd08f28..de7de99a73 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -553,7 +553,7 @@ module GitHub @open_pull_requests[cache_key].select { |pr| regex.match?(pr["title"]) } end - def self.check_for_duplicate_pull_requests(name, tap_remote_repo, state:, file:, args:, version: nil) + def self.check_for_duplicate_pull_requests(name, tap_remote_repo, state:, file:, quiet:, version: nil) # `fetch_open_pull_requests` is more reliable but *really* slow, so let's use it only in CI. pull_requests = if state == "open" && ENV["CI"].present? fetch_open_pull_requests(name, tap_remote_repo, version: version) @@ -568,16 +568,20 @@ module GitHub end return if pull_requests.blank? + force = ENV.fetch("HOMEBREW_TEST_BOT_AUTOBUMP", nil).present? duplicates_message = <<~EOS These #{state} pull requests may be duplicates: #{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")} EOS - error_message = "Duplicate PRs should not be opened. Use `--force` to override this error." - if args.force? && !args.quiet? + error_message = <<~EOS + Duplicate PRs should not be opened. + Manually open these PRs if you are sure that they are not duplicates. + EOS + if force && !quiet opoo duplicates_message - elsif !args.force? && args.quiet? + elsif !force && quiet odie error_message - elsif !args.force? + elsif !force odie <<~EOS #{duplicates_message.chomp} #{error_message} diff --git a/completions/bash/brew b/completions/bash/brew index d3b9b955ac..199b50a05d 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -465,7 +465,6 @@ _brew_bump_cask_pr() { --commit --debug --dry-run - --force --fork-org --help --message diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index 30962f4cf1..9bb4783131 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -396,7 +396,6 @@ __fish_brew_complete_cmd 'bump-cask-pr' 'Create a pull request to update cask wi __fish_brew_complete_arg 'bump-cask-pr' -l commit -d 'When passed with `--write-only`, generate a new commit after writing changes to the cask file' __fish_brew_complete_arg 'bump-cask-pr' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'bump-cask-pr' -l dry-run -d 'Print what would be done rather than doing it' -__fish_brew_complete_arg 'bump-cask-pr' -l force -d 'Ignore duplicate open PRs' __fish_brew_complete_arg 'bump-cask-pr' -l fork-org -d 'Use the specified GitHub organization for forking' __fish_brew_complete_arg 'bump-cask-pr' -l help -d 'Show this message' __fish_brew_complete_arg 'bump-cask-pr' -l message -d 'Prepend message to the default pull request message' @@ -419,7 +418,7 @@ __fish_brew_complete_cmd 'bump-formula-pr' 'Create a pull request to update form __fish_brew_complete_arg 'bump-formula-pr' -l commit -d 'When passed with `--write-only`, generate a new commit after writing changes to the formula file' __fish_brew_complete_arg 'bump-formula-pr' -l debug -d 'Display any debugging information' __fish_brew_complete_arg 'bump-formula-pr' -l dry-run -d 'Print what would be done rather than doing it' -__fish_brew_complete_arg 'bump-formula-pr' -l force -d 'Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified' +__fish_brew_complete_arg 'bump-formula-pr' -l force -d 'Remove all mirrors if `--mirror` was not specified' __fish_brew_complete_arg 'bump-formula-pr' -l fork-org -d 'Use the specified GitHub organization for forking' __fish_brew_complete_arg 'bump-formula-pr' -l help -d 'Show this message' __fish_brew_complete_arg 'bump-formula-pr' -l message -d 'Prepend message to the default pull request message' diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 69d5ca98ac..b41aef0d9d 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -517,7 +517,6 @@ _brew_bump_cask_pr() { '--commit[When passed with `--write-only`, generate a new commit after writing changes to the cask file]' \ '--debug[Display any debugging information]' \ '(--write)--dry-run[Print what would be done rather than doing it]' \ - '--force[Ignore duplicate open PRs]' \ '--fork-org[Use the specified GitHub organization for forking]' \ '--help[Show this message]' \ '--message[Prepend message to the default pull request message]' \ @@ -543,7 +542,7 @@ _brew_bump_formula_pr() { '--commit[When passed with `--write-only`, generate a new commit after writing changes to the formula file]' \ '--debug[Display any debugging information]' \ '(--write-only)--dry-run[Print what would be done rather than doing it]' \ - '--force[Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified]' \ + '--force[Remove all mirrors if `--mirror` was not specified]' \ '--fork-org[Use the specified GitHub organization for forking]' \ '--help[Show this message]' \ '--message[Prepend message to the default pull request message]' \ diff --git a/docs/Manpage.md b/docs/Manpage.md index 3411d28c71..df4c005af4 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1073,8 +1073,6 @@ supplied by the user. Specify the *`SHA-256`* checksum of the new download. * `--fork-org`: Use the specified GitHub organization for forking. -* `-f`, `--force`: - Ignore duplicate open PRs. ### `bump-formula-pr` [*`options`*] [*`formula`*] @@ -1128,7 +1126,7 @@ nor vice versa. It must use whichever style specification the formula already us * `--revision`: Specify the new commit *`revision`* corresponding to the specified git *`tag`* or specified *`version`*. * `-f`, `--force`: - Ignore duplicate open PRs. Remove all mirrors if `--mirror` was not specified. + Remove all mirrors if `--mirror` was not specified. * `--python-package-name`: Use the specified *`package-name`* when finding Python resources for *`formula`*. If no package name is specified, it will be inferred from the formula's stable URL. * `--python-extra-packages`: diff --git a/manpages/brew.1 b/manpages/brew.1 index b5cd56aaa6..5eb561e603 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1534,10 +1534,6 @@ Specify the \fISHA\-256\fR checksum of the new download\. \fB\-\-fork\-org\fR Use the specified GitHub organization for forking\. . -.TP -\fB\-f\fR, \fB\-\-force\fR -Ignore duplicate open PRs\. -. .SS "\fBbump\-formula\-pr\fR [\fIoptions\fR] [\fIformula\fR]" Create a pull request to update \fIformula\fR with a new URL or a new tag\. . @@ -1619,7 +1615,7 @@ Specify the new commit \fIrevision\fR corresponding to the specified git \fItag\ . .TP \fB\-f\fR, \fB\-\-force\fR -Ignore duplicate open PRs\. Remove all mirrors if \fB\-\-mirror\fR was not specified\. +Remove all mirrors if \fB\-\-mirror\fR was not specified\. . .TP \fB\-\-python\-package\-name\fR