Skip to content

Commit

Permalink
feat(gitlab): add flag on ensure_mr to keep-source-branch
Browse files Browse the repository at this point in the history
Add a flag on `ensure_mr` cmd to allow user to `keep-source-branch`.
By default, the option to delete the source branch when MR is merged is
pass to the API
  • Loading branch information
ryshu committed Oct 7, 2022
1 parent 380e259 commit 40177ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gitflow_toolbox/ensure_mr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@click.command()
@click.option("--remote/--current", default=False)
@click.option("--keep-source-branch", is_flag=True)
@click.argument("source_branch", type=str)
@click.argument("target_branch", type=str)
@click.argument("title", type=str)
Expand All @@ -15,6 +16,7 @@
def ensure_mr(
ctx: click.Context,
remote: bool,
keep_source_branch: bool,
source_branch: str,
target_branch: str,
title: str,
Expand All @@ -25,6 +27,7 @@ def ensure_mr(
Args:
remote (bool): whether to check on the current gitlab or remote gitlab (True=remote)
keep_source_branch (bool): if you want to keep source branch or not
source_branch (str): branch to create
target_branch (str): branch reference to create branch from
title (str): MR title
Expand All @@ -46,6 +49,7 @@ def ensure_mr(
"title": title,
"description": description,
"labels": list(labels),
"remove_source_branch": not keep_source_branch,
}
)
click.echo(f"✨ Successfully created MR #{created_mr.iid} : {created_mr.web_url}")

0 comments on commit 40177ef

Please sign in to comment.