Skip to content
Snippets Groups Projects
Unverified Commit ab12663b authored by Newbyte's avatar Newbyte :snowflake:
Browse files

mrhlpr.mr: Add more type hints (MR 38)

parent 2dac23a7
No related branches found
No related tags found
1 merge request!38mrhlpr: Allow skipping approval, reword comment request, add more type, improve auto merge robustness
......@@ -160,7 +160,7 @@ def get_artifacts_zip(mr_id, no_cache=False, origin=None):
def checkout(
mr_id: int, no_cache: bool = False, fetch: bool = False, overwrite_remote: bool = False
):
) -> None:
"""Add the MR's source repository as git remote, fetch it and checkout the
branch used in the merge request.
......@@ -292,7 +292,7 @@ def checkout(
mrdb.set(origin.host, origin.project_id, branch_local, mr_id)
def commits_have_mr_id(commits: list[str], mr_id: int):
def commits_have_mr_id(commits: list[str], mr_id: int) -> bool:
"""Check if all given commits have the MR-ID in the subject.
:param commits: return value from git.commits_on_top_of()
......@@ -369,7 +369,7 @@ def commits_follow_format(commits: list[str]) -> tuple[Optional[bool], list[Any]
return (result, subj_err)
def commits_are_signed(commits: list[str]):
def commits_are_signed(commits: list[str]) -> bool:
"""Check if all given commits are signed.
:param commits: return value from git.commits_on_top_of()
......@@ -414,7 +414,7 @@ def run_git_filter_branch(
def fixmsg(
mr_id: int, skip_build: bool = False, ignore_count: bool = False, skip_vercheck: bool = False
):
) -> None:
"""Add the MR-ID in each commit of the MR.
:param mr_id: merge request ID"""
......@@ -444,7 +444,9 @@ def fixmsg(
run_git_filter_branch("msg_filter_add_label.py", "HEAD~1", label="skip_vercheck")
def finish(mr_id: int, comment: str | None, no_cache: bool = False, skip_approve: bool = False):
def finish(
mr_id: int, comment: Optional[str], no_cache: bool = False, skip_approve: bool = False
) -> None:
if "gitlab" not in sys.modules:
logging.error("python-gitlab is needed to run 'finish'")
exit(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment