Skip to content
Open
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
9 changes: 7 additions & 2 deletions revup/amend.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ async def parse_ref_or_topic(
async def build_commit_template(
topic_name: str,
relative: bool | str,
include_draft: bool,
commit: str,
git_ctx: git.Git,
topics: topic_stack.TopicStack,
Expand All @@ -233,6 +234,7 @@ async def build_commit_template(
Args:
topic_name: The topic name for the new commit
relative: False to skip, True to auto-detect, or a string topic name to use explicitly
include_draft: add a draft label
commit: The commit being inserted after (used for auto-detection)
git_ctx: Git context
topics: Topic stack for looking up topics
Expand Down Expand Up @@ -262,6 +264,9 @@ async def build_commit_template(
continue
break

if include_draft:
template_lines.append("Label: draft")

return "\n".join(template_lines)


Expand Down Expand Up @@ -321,7 +326,7 @@ async def prepare_insert_commit(
staged_files = await get_staged_files(git_ctx)
commit_msg = run_commit_message_script(
script_path=args.commit_message_script, topic=args.topic,
relative=args.relative,
relative=args.relative, args=args.draft,
commit_type=getattr(args, "type", None), scope=getattr(args, "scope", None),
staged_files=staged_files, repo_root=git_ctx.repo_root,
)
Expand Down Expand Up @@ -586,7 +591,7 @@ async def get_has_unstaged() -> bool:
# Build commit message template if --topic was provided
if args.topic:
stack[0].commit_msg = await build_commit_template(
args.topic, args.relative, commit, git_ctx, topics
args.topic, args.relative, args.draft, commit, git_ctx, topics
)
else:
stack[0].commit_msg = ""
Expand Down
10 changes: 10 additions & 0 deletions revup/revup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,16 @@ async def main() -> int:
"--relative", "-r", nargs="?", const=True, default=False,
help="Add Relative: tag. Auto-detects if no topic given, or specify explicitly."
)
amend_parser.add_argument(
"--type", help="Conventional commit type (feat, fix, chore, etc.)"
)
amend_parser.add_argument(
"--scope", help="Conventional commit scope"
)
amend_parser.add_argument(
"--draft", action="store_true", help="Add Label: draft tag (requires --topic)"
)
amend_parser.add_argument("--commit-message-script")

cherry_pick_parser.add_argument("--help", "-h", action=HelpAction, nargs=0)
cherry_pick_parser.add_argument("branch", nargs=1)
Expand Down