diff options
author | lovetox <philipp@hoerist.com> | 2022-03-27 19:18:30 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2022-03-27 19:18:30 +0300 |
commit | ba31782c7582fe67fb6c3db32ddc50fb7d7a3aac (patch) | |
tree | 3139e885ccd6ed1f065f8928b75c620ae86c2808 /.githooks | |
parent | f605d77edb52313b16a8ed6d79423f255fee1082 (diff) |
other: Update git update hook
Fix syntax errors, this needs to run with python 3.7
Diffstat (limited to '.githooks')
-rwxr-xr-x | .githooks/update | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/.githooks/update b/.githooks/update index 64ff8d057..8be62f7ca 100755 --- a/.githooks/update +++ b/.githooks/update @@ -1,5 +1,10 @@ #!/usr/bin/env python +from __future__ import annotations + +from typing import List +from typing import Tuple + import sys import subprocess @@ -7,7 +12,7 @@ import subprocess ALLOWED_TAGS = ['ci', 'feat', 'fix', 'perf', 'refactor', 'chore', 'other'] -def parse_args() -> tuple[str, str]: +def parse_args() -> Tuple[str, str]: old_ref = sys.argv[2] new_ref = sys.argv[3] return old_ref, new_ref @@ -19,7 +24,7 @@ def get_commit_subject(sha: str) -> str: return data.decode() -def get_commit_shas(start_ref: str, end_ref: str) -> list[str]: +def get_commit_shas(start_ref: str, end_ref: str) -> List[str]: arg = f'{start_ref}..{end_ref}' data = subprocess.check_output(['git', 'rev-list', arg]) text = data.decode() @@ -38,7 +43,7 @@ def enforce_message_rules(subject: str) -> None: sys.exit(1) -def main(args: tuple[str, str]) -> None: +def main(args: Tuple[str, str]) -> None: shas = get_commit_shas(*args) for sha in shas: subject = get_commit_subject(sha) |