|
2 | 2 |
|
3 | 3 | # *******************************************************************************
|
4 | 4 | # Copyright 2024 Arm Limited and affiliates.
|
| 5 | +# Copyright 2024 Intel Corporation |
5 | 6 | # SPDX-License-Identifier: Apache-2.0
|
6 | 7 | #
|
7 | 8 | # Licensed under the Apache License, Version 2.0 (the "License");
|
|
18 | 19 | # *******************************************************************************
|
19 | 20 |
|
20 | 21 | import argparse
|
21 |
| - |
| 22 | +import subprocess |
22 | 23 |
|
23 | 24 | # * Ensuring the scopes end in colon and same level scopes are comma delimited.
|
24 | 25 | # TODO: Limit scopes to an acceptable list of tags.
|
@@ -61,12 +62,20 @@ def __numCharacterCheck(msg: str):
|
61 | 62 |
|
62 | 63 | def main():
|
63 | 64 | parser = argparse.ArgumentParser()
|
64 |
| - parser.add_argument("msg", help="Commit message to check.") |
| 65 | + parser.add_argument("head", help="Head commit of PR branch") |
| 66 | + parser.add_argument("base", help="Base commit of PR branch") |
65 | 67 | args = parser.parse_args()
|
66 |
| - msg: str = args.msg |
67 |
| - print(f"msg: {msg}") |
68 |
| - __numCharacterCheck(msg) |
69 |
| - __scopeCheck(msg) |
| 68 | + base: str = args.base |
| 69 | + head: str = args.head |
| 70 | + |
| 71 | + commit_range = base + ".." + head |
| 72 | + messages = subprocess.run(["git", "rev-list", "--ancestry-path", commit_range, "--format=oneline"], capture_output=True, text=True).stdout |
| 73 | + |
| 74 | + for i in messages.splitlines(): |
| 75 | + commit_msg=i.split(' ', 1)[1] |
| 76 | + print(f"msg: {commit_msg}") |
| 77 | + __numCharacterCheck(commit_msg) |
| 78 | + __scopeCheck(commit_msg) |
70 | 79 |
|
71 | 80 |
|
72 | 81 | if __name__ == "__main__":
|
|
0 commit comments