Skip to content

Commit eef9a4c

Browse files
committed
Adding get_last_finished_frid
1 parent 2d23644 commit eef9a4c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

git_utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import re
23
from configparser import NoOptionError, NoSectionError
34
from typing import Optional, Union
45

@@ -415,3 +416,15 @@ def get_repo_info(repo_path: Union[str, os.PathLike]) -> dict:
415416
info["remotes"] = remotes
416417

417418
return info
419+
420+
421+
def get_last_finished_frid(repo_path: Union[str, os.PathLike]) -> Optional[str]:
422+
repo = Repo(repo_path)
423+
commit_sha = repo.git.rev_list(
424+
repo.active_branch.name, "--grep", FUNCTIONAL_REQUIREMENT_FINISHED_COMMIT_MESSAGE.format(".*"), "-n", "1"
425+
)
426+
if not commit_sha:
427+
return None
428+
commit_message = repo.commit(commit_sha).message
429+
match = re.search(r"FRID\):(\S+) fully implemented", commit_message)
430+
return match.group(1) if match else None

0 commit comments

Comments
 (0)