Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump-formula-pr: restore formula if duplicate PR exists #8011

Merged
merged 1 commit into from
Jul 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Library/Homebrew/dev-cmd/bump-formula-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def bump_formula_pr

new_formula_version = formula_version(formula, requested_spec, new_contents)

check_for_duplicate_pull_requests(formula, tap_full_name, new_formula_version.to_s)
check_for_duplicate_pull_requests(formula, backup_file, tap_full_name, new_formula_version.to_s)

if !new_mirrors && !formula_spec.mirrors.empty?
if args.force?
Expand Down Expand Up @@ -481,7 +481,7 @@ def fetch_pull_requests(query, tap_full_name, state: nil)
[]
end

def check_for_duplicate_pull_requests(formula, tap_full_name, version)
def check_for_duplicate_pull_requests(formula, backup_file, tap_full_name, version)
# check for open requests
pull_requests = fetch_pull_requests(formula.name, tap_full_name, state: "open")

Expand All @@ -497,8 +497,10 @@ def check_for_duplicate_pull_requests(formula, tap_full_name, version)
if args.force? && !args.quiet?
opoo duplicates_message
elsif !args.force? && args.quiet?
formula.path.atomic_write(backup_file) unless args.dry_run?
odie error_message
elsif !args.force?
formula.path.atomic_write(backup_file) unless args.dry_run?
odie <<~EOS
#{duplicates_message.chomp}
#{error_message}
Expand Down