Skip to content

Commit

Permalink
pr-pull: add --no-cherry-pick flag
Browse files Browse the repository at this point in the history
Needed for Homebrew/homebrew-core#125556. Without this, `pr-pull`
attempts to cherry-pick commits from the PR branch onto the PR branch,
and then gets upset that nothing happened.

See https://github.com/Homebrew/homebrew-core/actions/runs/4461335852/jobs/7835095294#step:10:40
  • Loading branch information
carlocab committed Mar 19, 2023
1 parent 8f6276e commit c669f1d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Library/Homebrew/dev-cmd/pr-pull.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def self.pr_pull_args
description: "Download the bottles but don't upload them."
switch "--no-commit",
description: "Do not generate a new commit before uploading."
switch "--no-cherry-pick",
description: "Do not cherry-pick commits from the pull request branch."
switch "-n", "--dry-run",
description: "Print what would be done rather than doing it."
switch "--clean",
Expand Down Expand Up @@ -450,15 +452,21 @@ def self.pr_pull
original_commit = ENV["GITHUB_SHA"].presence || tap.path.git_head

unless args.no_commit?
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args)
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args) unless args.no_cherry_pick?
if !args.no_autosquash? && !args.dry_run?
autosquash!(original_commit, tap: tap,
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
end
signoff!(tap.path, pr: pr, dry_run: args.dry_run?) unless args.clean?
end

unless formulae_need_bottles?(tap, original_commit, user, repo, pr, args: args)
# TODO: Fix determination of `original_commit` above for the `--no-cherry-pick` flag.
# When we pull to the PR branch that contains the commits we want to merge,
# `#formulae_need_bottles?` mistakenly returns `true`, because it thinks
# that no formulae have changed. We probably want to use the commit identified
# by `git merge-base`.
if !formulae_need_bottles?(tap, original_commit, user, repo, pr, args: args) &&
!args.no_cherry_pick?
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
next
end
Expand Down

0 comments on commit c669f1d

Please sign in to comment.