Merge pull request #11734 from carlocab/deprecate-autosquash

dev-cmd/pr-publish: pass `--autosquash` by default
This commit is contained in:
Carlo Cabrera 2021-07-20 19:47:01 +08:00 committed by GitHub
commit 1d5bc01f4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,9 @@ module Homebrew
switch "--autosquash", switch "--autosquash",
description: "Instruct `brew pr-publish` to automatically reformat and reword commits "\ description: "Instruct `brew pr-publish` to automatically reformat and reword commits "\
"in the pull request to our preferred format." "in the pull request to our preferred format."
switch "--no-autosquash",
description: "Instruct `brew pr-publish` to skip automatically reformatting and rewording commits "\
"in the pull request to the preferred format."
switch "--ignore-failures", switch "--ignore-failures",
description: "Include pull requests that have failing status checks." description: "Include pull requests that have failing status checks."
@ -40,6 +43,8 @@ module Homebrew
def pr_automerge def pr_automerge
args = pr_automerge_args.parse args = pr_automerge_args.parse
odeprecated "`brew pr-automerge --autosquash`", "`brew pr-automerge`" if args.autosquash?
without_labels = args.without_labels || [ without_labels = args.without_labels || [
"do not merge", "do not merge",
"new formula", "new formula",
@ -71,7 +76,7 @@ module Homebrew
publish_args = ["pr-publish"] publish_args = ["pr-publish"]
publish_args << "--tap=#{tap}" if tap publish_args << "--tap=#{tap}" if tap
publish_args << "--autosquash" if args.autosquash? publish_args << "--no-autosquash" if args.no_autosquash?
if args.publish? if args.publish?
safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls safe_system HOMEBREW_BREW_FILE, *publish_args, *pr_urls
else else

View File

@ -19,6 +19,9 @@ module Homebrew
switch "--autosquash", switch "--autosquash",
description: "If supported on the target tap, automatically reformat and reword commits "\ description: "If supported on the target tap, automatically reformat and reword commits "\
"in the pull request to our preferred format." "in the pull request to our preferred format."
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request "\
"to the preferred format, even if supported on the target tap."
flag "--branch=", flag "--branch=",
description: "Branch to publish to (default: `master`)." description: "Branch to publish to (default: `master`)."
flag "--message=", flag "--message=",
@ -40,8 +43,10 @@ module Homebrew
workflow = args.workflow || "publish-commit-bottles.yml" workflow = args.workflow || "publish-commit-bottles.yml"
ref = args.branch || "master" ref = args.branch || "master"
odeprecated "`brew pr-publish --autosquash`", "`brew pr-publish`" if args.autosquash?
extra_args = [] extra_args = []
extra_args << "--autosquash" if args.autosquash? extra_args << "--autosquash" unless args.no_autosquash?
extra_args << "--message='#{args.message}'" if args.message.presence extra_args << "--message='#{args.message}'" if args.message.presence
dispatch_args = extra_args.join " " dispatch_args = extra_args.join " "