diff --git a/README.md b/README.md index 9fcedfd..0c80789 100644 --- a/README.md +++ b/README.md @@ -361,11 +361,7 @@ Options: Land the bottom-most PR in the current stack. -Options: - -- `--land-style`: Style of landing PRs. Choices: `disable`, `bottom-only` (default: `bottom-only` or from config) - - `bottom-only`: Land one PR at a time (bottom-most in the stack) - - `disable`: Disable the land command entirely, requiring PRs to be merged through GitHub web interface +If the `land.style` config option has the `disable` value, this command is not available. #### abandon diff --git a/src/stack_pr/cli.py b/src/stack_pr/cli.py index 86a3c77..a43d2ed 100755 --- a/src/stack_pr/cli.py +++ b/src/stack_pr/cli.py @@ -199,16 +199,6 @@ Make sure the branch exists or specify a different target with --target option. """ -ERROR_LAND_DISABLED = """The 'land' command is disabled. - -Please merge your PRs through the GitHub web interface instead. - -To override this setting for a single command: - stack-pr land --land-style=bottom-only - -Or to re-enable it permanently: - stack-pr config land.style=bottom-only -""" UPDATE_STACK_TIP = """ If you'd like to push your local changes first, you can use the following command to update the stack: $ stack-pr export -B {top_commit}~{stack_size} -H {top_commit}""" @@ -892,7 +882,6 @@ class CommonArgs: hyperlinks: bool verbose: bool branch_name_template: str - land_style: str @classmethod def from_args(cls, args: argparse.Namespace) -> CommonArgs: @@ -904,7 +893,6 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs: args.hyperlinks, args.verbose, args.branch_name_template, - args.land_style, ) @@ -985,7 +973,6 @@ def deduce_base(args: CommonArgs) -> CommonArgs: args.hyperlinks, args.verbose, args.branch_name_template, - args.land_style, ) @@ -1224,11 +1211,6 @@ def delete_remote_branches( def command_land(args: CommonArgs) -> None: log(h("LAND"), level=1) - # Check if land command is disabled - if args.land_style == "disable": - error(ERROR_LAND_DISABLED) - sys.exit(1) - current_branch = get_current_branch_name() if should_update_local_base( @@ -1537,12 +1519,6 @@ def create_argparser( default=config.get("repo", "branch_name_template", fallback="$USERNAME/stack"), help="A template for names of the branches stack-pr would use.", ) - common_parser.add_argument( - "--land-style", - default=config.get("land", "style", fallback="bottom-only"), - choices=["disable", "bottom-only"], - help="Style of landing PRs: 'bottom-only' lands one PR per invocation, 'disable' disables the land command.", - ) parser_submit = subparsers.add_parser( "submit", @@ -1585,11 +1561,13 @@ def create_argparser( help="Stash all uncommited changes before submitting the PR", ) - subparsers.add_parser( - "land", - help="Land the current stack", - parents=[common_parser], - ) + land_style = config.get("land", "style", fallback="bottom-only") + if land_style == "bottom-only": + subparsers.add_parser( + "land", + help="Land the bottom-most PR in the current stack", + parents=[common_parser], + ) subparsers.add_parser( "abandon", help="Abandon the current stack",