Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 7 additions & 29 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"""
Expand Down Expand Up @@ -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:
Expand All @@ -904,7 +893,6 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs:
args.hyperlinks,
args.verbose,
args.branch_name_template,
args.land_style,
)


Expand Down Expand Up @@ -985,7 +973,6 @@ def deduce_base(args: CommonArgs) -> CommonArgs:
args.hyperlinks,
args.verbose,
args.branch_name_template,
args.land_style,
)


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading