Merge pull request #12850 from carlocab/no-autosquash

pr-{publish,pull}: autosquash by default
This commit is contained in:
Carlo Cabrera 2022-02-09 20:07:39 +08:00 committed by GitHub
commit 2e6b225a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -26,13 +26,14 @@ module Homebrew
flag "--branch=",
description: "Branch to publish to (default: `master`)."
flag "--message=",
depends_on: "--autosquash",
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
flag "--tap=",
description: "Target tap repository (default: `homebrew/core`)."
flag "--workflow=",
description: "Target workflow filename (default: `publish-commit-bottles.yml`)."
conflicts "--no-autosquash", "--message"
named_args :pull_request, min: 1
end
end
@ -45,7 +46,7 @@ module Homebrew
ref = args.branch || "master"
extra_args = []
extra_args << "--autosquash" unless args.no_autosquash?
extra_args << "--no-autosquash" if args.no_autosquash?
extra_args << "--message='#{args.message}'" if args.message.presence
dispatch_args = extra_args.join " "

View File

@ -27,12 +27,17 @@ module Homebrew
switch "-n", "--dry-run",
description: "Print what would be done rather than doing it."
switch "--clean",
depends_on: "--no-autosquash",
description: "Do not amend the commits from pull requests."
switch "--keep-old",
description: "If the formula specifies a rebuild version, " \
"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.",
replacement: "`--no-autosquash` to opt out"
switch "--no-autosquash",
description: "Skip automatically reformatting and rewording commits in the pull request to our "\
"preferred format."
switch "--branch-okay",
description: "Do not warn if pulling to a branch besides the repository default (useful for testing)."
@ -45,7 +50,6 @@ module Homebrew
flag "--committer=",
description: "Specify a committer name and email in `git`'s standard author format."
flag "--message=",
depends_on: "--autosquash",
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds."
flag "--artifact=",
description: "Download artifacts with the specified name (default: `bottles`)."
@ -62,7 +66,7 @@ module Homebrew
comma_array "--ignore-missing-artifacts=",
description: "Comma-separated list of workflows which can be ignored if they have not been run."
conflicts "--clean", "--autosquash"
conflicts "--no-autosquash", "--message"
named_args :pull_request, min: 1
end
@ -366,7 +370,7 @@ module Homebrew
unless args.no_commit?
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args)
if args.autosquash? && !args.dry_run?
if !args.no_autosquash? && !args.dry_run?
autosquash!(original_commit, path: tap.path,
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
end