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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Options:
- `-d, --draft`: Submit PRs in draft mode (default: false)
- `--draft-bitmask`: Bitmask for setting draft status per PR
- `--reviewer`: List of reviewers for the PRs (default: from $STACK_PR_DEFAULT_REVIEWER or config)
- `-s, --stash`: Stash all uncommitted changes before submitting the PR

#### land

Expand Down Expand Up @@ -297,6 +298,7 @@ verbose=True
hyperlinks=True
draft=False
keep_body=False
stash=False
[repo]
remote=origin
target=main
Expand Down
13 changes: 13 additions & 0 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,13 @@ def create_argparser(
),
help="List of reviewers for the PR",
)
parser_submit.add_argument(
"-s",
"--stash",
action="store_true",
default=config.getboolean("common", "stash", fallback=False),
help="Stash all uncommited changes before submitting the PR",
)

subparsers.add_parser(
"land",
Expand Down Expand Up @@ -1363,6 +1370,9 @@ def main():
current_branch = get_current_branch_name()
get_branch_name_base(common_args.branch_name_template)
try:
if args.stash:
run_shell_command(["git", "stash", "save"], quiet=not common_args.verbose)

if args.command != "view" and not is_repo_clean():
error(ERROR_REPO_DIRTY)
return
Expand Down Expand Up @@ -1392,6 +1402,9 @@ def main():
if isinstance(exc, SubprocessError):
print_cmd_failure_details(exc)
raise
finally:
if args.stash:
run_shell_command(["git", "stash", "pop"], quiet=not common_args.verbose)


if __name__ == "__main__":
Expand Down