dev-cmd/pr-*: replace --no-autosquash with --autosquash
We will now no longer be squashing commits by default, so it makes sense to default to doing nothing but still autosquash commits when requested with `--autosquash`.
This commit is contained in:
parent
b753315b0b
commit
834e4c98fc
@ -28,9 +28,13 @@ module Homebrew
|
|||||||
description: "Pull requests do not require approval to be merged."
|
description: "Pull requests do not require approval to be merged."
|
||||||
switch "--publish",
|
switch "--publish",
|
||||||
description: "Run `brew pr-publish` on matching pull requests."
|
description: "Run `brew pr-publish` on matching pull requests."
|
||||||
|
switch "--autosquash",
|
||||||
|
description: "Instruct `brew pr-publish` to automatically reformat and reword commits " \
|
||||||
|
"in the pull request to the preferred format."
|
||||||
switch "--no-autosquash",
|
switch "--no-autosquash",
|
||||||
description: "Instruct `brew pr-publish` to skip automatically reformatting and rewording commits " \
|
description: "Instruct `brew pr-publish` to skip automatically reformatting and rewording commits " \
|
||||||
"in the pull request to the preferred format."
|
"in the pull request to the preferred format.",
|
||||||
|
replacement: "`--autosquash` to opt in"
|
||||||
switch "--ignore-failures",
|
switch "--ignore-failures",
|
||||||
description: "Include pull requests that have failing status checks."
|
description: "Include pull requests that have failing status checks."
|
||||||
|
|
||||||
@ -41,6 +45,8 @@ module Homebrew
|
|||||||
def pr_automerge
|
def pr_automerge
|
||||||
args = pr_automerge_args.parse
|
args = pr_automerge_args.parse
|
||||||
|
|
||||||
|
odeprecated "`brew pr-publish --no-autosquash`" if args.no_autosquash?
|
||||||
|
|
||||||
without_labels = args.without_labels || [
|
without_labels = args.without_labels || [
|
||||||
"do not merge",
|
"do not merge",
|
||||||
"new formula",
|
"new formula",
|
||||||
@ -71,7 +77,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 << "--workflow=#{args.workflow}" if args.workflow
|
publish_args << "--workflow=#{args.workflow}" if args.workflow
|
||||||
publish_args << "--no-autosquash" if args.no_autosquash?
|
publish_args << "--autosquash" if args.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
|
||||||
|
|||||||
@ -16,19 +16,24 @@ module Homebrew
|
|||||||
Publish bottles for a pull request with GitHub Actions.
|
Publish bottles for a pull request with GitHub Actions.
|
||||||
Requires write access to the repository.
|
Requires write access to the repository.
|
||||||
EOS
|
EOS
|
||||||
|
switch "--autosquash",
|
||||||
|
description: "If supported on the target tap, automatically reformat and reword commits " \
|
||||||
|
"to our preferred format."
|
||||||
switch "--no-autosquash",
|
switch "--no-autosquash",
|
||||||
description: "Skip automatically reformatting and rewording commits in the pull request " \
|
description: "Skip automatically reformatting and rewording commits in the pull request " \
|
||||||
"to the preferred format, even if supported on the target tap."
|
"to the preferred format, even if supported on the target tap.",
|
||||||
|
replacement: "`--autosquash` to opt in"
|
||||||
flag "--branch=",
|
flag "--branch=",
|
||||||
description: "Branch to publish to (default: `master`)."
|
description: "Branch to publish to (default: `master`)."
|
||||||
flag "--message=",
|
flag "--message=",
|
||||||
|
depends_on: "--autosquash",
|
||||||
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
|
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
|
||||||
flag "--tap=",
|
flag "--tap=",
|
||||||
description: "Target tap repository (default: `homebrew/core`)."
|
description: "Target tap repository (default: `homebrew/core`)."
|
||||||
flag "--workflow=",
|
flag "--workflow=",
|
||||||
description: "Target workflow filename (default: `publish-commit-bottles.yml`)."
|
description: "Target workflow filename (default: `publish-commit-bottles.yml`)."
|
||||||
|
|
||||||
conflicts "--no-autosquash", "--message"
|
conflicts "--clean", "--autosquash"
|
||||||
|
|
||||||
named_args :pull_request, min: 1
|
named_args :pull_request, min: 1
|
||||||
end
|
end
|
||||||
@ -37,12 +42,14 @@ module Homebrew
|
|||||||
def pr_publish
|
def pr_publish
|
||||||
args = pr_publish_args.parse
|
args = pr_publish_args.parse
|
||||||
|
|
||||||
|
odeprecated "`brew pr-publish --no-autosquash`" if args.no_autosquash?
|
||||||
|
|
||||||
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||||
workflow = args.workflow || "publish-commit-bottles.yml"
|
workflow = args.workflow || "publish-commit-bottles.yml"
|
||||||
ref = args.branch || "master"
|
ref = args.branch || "master"
|
||||||
|
|
||||||
extra_args = []
|
extra_args = []
|
||||||
extra_args << "--no-autosquash" if args.no_autosquash?
|
extra_args << "--autosquash" if args.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 " "
|
||||||
|
|
||||||
|
|||||||
@ -27,14 +27,17 @@ module Homebrew
|
|||||||
switch "-n", "--dry-run",
|
switch "-n", "--dry-run",
|
||||||
description: "Print what would be done rather than doing it."
|
description: "Print what would be done rather than doing it."
|
||||||
switch "--clean",
|
switch "--clean",
|
||||||
depends_on: "--no-autosquash",
|
|
||||||
description: "Do not amend the commits from pull requests."
|
description: "Do not amend the commits from pull requests."
|
||||||
switch "--keep-old",
|
switch "--keep-old",
|
||||||
description: "If the formula specifies a rebuild version, " \
|
description: "If the formula specifies a rebuild version, " \
|
||||||
"attempt to preserve its value in the generated DSL."
|
"attempt to preserve its value in the generated DSL."
|
||||||
|
switch "--autosquash",
|
||||||
|
description: "Automatically reformat and reword commits in the pull request to our " \
|
||||||
|
"preferred format."
|
||||||
switch "--no-autosquash",
|
switch "--no-autosquash",
|
||||||
description: "Skip automatically reformatting and rewording commits in the pull request to our " \
|
description: "Skip automatically reformatting and rewording commits in the pull request to our " \
|
||||||
"preferred format."
|
"preferred format.",
|
||||||
|
replacement: "`--autosquash` to opt in"
|
||||||
switch "--branch-okay",
|
switch "--branch-okay",
|
||||||
description: "Do not warn if pulling to a branch besides the repository default (useful for testing)."
|
description: "Do not warn if pulling to a branch besides the repository default (useful for testing)."
|
||||||
switch "--resolve",
|
switch "--resolve",
|
||||||
@ -46,6 +49,7 @@ module Homebrew
|
|||||||
flag "--committer=",
|
flag "--committer=",
|
||||||
description: "Specify a committer name and email in `git`'s standard author format."
|
description: "Specify a committer name and email in `git`'s standard author format."
|
||||||
flag "--message=",
|
flag "--message=",
|
||||||
|
depends_on: "--autosquash",
|
||||||
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
|
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
|
||||||
flag "--artifact=",
|
flag "--artifact=",
|
||||||
description: "Download artifacts with the specified name (default: `bottles`)."
|
description: "Download artifacts with the specified name (default: `bottles`)."
|
||||||
@ -62,7 +66,7 @@ module Homebrew
|
|||||||
comma_array "--ignore-missing-artifacts",
|
comma_array "--ignore-missing-artifacts",
|
||||||
description: "Comma-separated list of workflows which can be ignored if they have not been run."
|
description: "Comma-separated list of workflows which can be ignored if they have not been run."
|
||||||
|
|
||||||
conflicts "--no-autosquash", "--message"
|
conflicts "--clean", "--autosquash"
|
||||||
|
|
||||||
named_args :pull_request, min: 1
|
named_args :pull_request, min: 1
|
||||||
end
|
end
|
||||||
@ -424,6 +428,8 @@ module Homebrew
|
|||||||
def self.pr_pull
|
def self.pr_pull
|
||||||
args = pr_pull_args.parse
|
args = pr_pull_args.parse
|
||||||
|
|
||||||
|
odeprecated "`brew pr-pull --no-autosquash`" if args.no_autosquash?
|
||||||
|
|
||||||
# Needed when extracting the CI artifact.
|
# Needed when extracting the CI artifact.
|
||||||
ensure_executable!("unzip", reason: "extracting CI artifacts")
|
ensure_executable!("unzip", reason: "extracting CI artifacts")
|
||||||
|
|
||||||
@ -465,7 +471,7 @@ module Homebrew
|
|||||||
|
|
||||||
unless args.no_commit?
|
unless args.no_commit?
|
||||||
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args) unless args.no_cherry_pick?
|
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args) unless args.no_cherry_pick?
|
||||||
if !args.no_autosquash? && !args.dry_run?
|
if args.autosquash? && !args.dry_run?
|
||||||
autosquash!(original_commit, tap: tap,
|
autosquash!(original_commit, tap: tap,
|
||||||
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
|
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user