diff --git a/.gitignore b/.gitignore index 8e6e411..ead052a 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,4 @@ venv.bak/ pixi.lock .stack-pr.cfg +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 86a9321..6d7e3ff 100644 --- a/README.md +++ b/README.md @@ -258,5 +258,5 @@ keep_body=False remote=origin target=main reviewer=GithubHandle1,GithubHandle2 -branch_name_template=$USERNAME/stack +branch_name_template=$USERNAME/$BRANCH ``` diff --git a/src/stack_pr/cli.py b/src/stack_pr/cli.py index 0e7b83e..1a9e3c1 100755 --- a/src/stack_pr/cli.py +++ b/src/stack_pr/cli.py @@ -54,6 +54,7 @@ import re from functools import cache from subprocess import SubprocessError +from typing import List, NamedTuple, Optional, Pattern from stack_pr.git import ( branch_exists, @@ -67,7 +68,6 @@ run_shell_command, set_show_commands, ) -from typing import List, NamedTuple, Optional, Pattern # A bunch of regexps for parsing commit messages and PR descriptions RE_RAW_COMMIT_ID = re.compile(r"^(?P[a-f0-9]+)$", re.MULTILINE) @@ -565,7 +565,9 @@ def add_or_update_metadata( @cache def get_branch_name_base(branch_name_template: str): username = get_gh_username() + current_branch_name = get_current_branch_name() branch_name_base = branch_name_template.replace("$USERNAME", username) + branch_name_base = branch_name_template.replace("$BRANCH",current_branch_name) return branch_name_base @@ -1388,6 +1390,7 @@ def main(): check_gh_installed() current_branch = get_current_branch_name() + get_branch_name_base(common_args.branch_name_template) try: if args.command != "view" and not is_repo_clean(): error(ERROR_REPO_DIRTY)