Tools: Include commits to all branches in weekly report script
Currently the script only includes commits to "main" branches. Much of people's work is done in branches however, so developers either customized the script, or they would manually go through own history to find remaining commits (I asked some). Even if some people prefer to only list main branch commits, it's much easier to simply remove some commits than to add missing ones. To be able to tell which branch a commit was on, this adds a " on `branch-name`" after the commit hash. Personally I don't find this optimal, I'd rather group commits under their repository/branch, proposed separately in #138615. Pull Request: https://projects.blender.org/blender/blender/pulls/138612
This commit is contained in:
@@ -136,7 +136,7 @@ def report_personal_weekly_get(
|
|||||||
issues_duplicated: list[str] = []
|
issues_duplicated: list[str] = []
|
||||||
issues_archived: list[str] = []
|
issues_archived: list[str] = []
|
||||||
|
|
||||||
commits_main: list[str] = []
|
commits: list[str] = []
|
||||||
|
|
||||||
user_data: dict[str, Any] = gitea_user_get(username)
|
user_data: dict[str, Any] = gitea_user_get(username)
|
||||||
|
|
||||||
@@ -169,7 +169,6 @@ def report_personal_weekly_get(
|
|||||||
pulls_reviewed.append(fullname)
|
pulls_reviewed.append(fullname)
|
||||||
elif op_type == "commit_repo":
|
elif op_type == "commit_repo":
|
||||||
if (
|
if (
|
||||||
activity["ref_name"] == "refs/heads/main" and
|
|
||||||
activity["content"] and
|
activity["content"] and
|
||||||
activity["repo"]["name"] != ".profile"
|
activity["repo"]["name"] != ".profile"
|
||||||
):
|
):
|
||||||
@@ -177,13 +176,14 @@ def report_personal_weekly_get(
|
|||||||
assert isinstance(content_json, dict)
|
assert isinstance(content_json, dict)
|
||||||
repo_fullname = activity["repo"]["full_name"]
|
repo_fullname = activity["repo"]["full_name"]
|
||||||
content_json_commits: list[dict[str, Any]] = content_json["Commits"]
|
content_json_commits: list[dict[str, Any]] = content_json["Commits"]
|
||||||
for commits in content_json_commits:
|
for commit_json in content_json_commits:
|
||||||
# Skip commits that were not made by this user. Using email doesn't seem to
|
# Skip commits that were not made by this user. Using email doesn't seem to
|
||||||
# be possible unfortunately.
|
# be possible unfortunately.
|
||||||
if commits["AuthorName"] != user_data["full_name"]:
|
if commit_json["AuthorName"] != user_data["full_name"]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
title = commits["Message"].split('\n', 1)[0]
|
|
||||||
|
title = commit_json["Message"].split('\n', 1)[0]
|
||||||
|
|
||||||
if title.startswith("Merge branch "):
|
if title.startswith("Merge branch "):
|
||||||
continue
|
continue
|
||||||
@@ -191,10 +191,13 @@ def report_personal_weekly_get(
|
|||||||
# Substitute occurrences of "#\d+" with "repo#\d+"
|
# Substitute occurrences of "#\d+" with "repo#\d+"
|
||||||
title = re.sub(r"#(\d+)", rf"{repo_fullname}#\1", title)
|
title = re.sub(r"#(\d+)", rf"{repo_fullname}#\1", title)
|
||||||
|
|
||||||
hash_value = commits["Sha1"]
|
branch_name = activity["ref_name"].removeprefix("refs/heads/")
|
||||||
|
|
||||||
|
hash_value = commit_json["Sha1"]
|
||||||
if hash_length > 0:
|
if hash_length > 0:
|
||||||
hash_value = hash_value[:hash_length]
|
hash_value = hash_value[:hash_length]
|
||||||
commits_main.append(f"{title} ({repo_fullname}@{hash_value})")
|
branch_str = f" on `{branch_name}`" if branch_name != "main" else ""
|
||||||
|
commits.append(f"{title} ({repo_fullname}@{hash_value}{branch_str})")
|
||||||
|
|
||||||
date_end = date_curr
|
date_end = date_curr
|
||||||
len_total = len(issues_closed) + len(issues_commented) + len(pulls_commented)
|
len_total = len(issues_closed) + len(issues_commented) + len(pulls_commented)
|
||||||
@@ -299,7 +302,7 @@ def report_personal_weekly_get(
|
|||||||
|
|
||||||
# Print commits
|
# Print commits
|
||||||
print("**Commits:**")
|
print("**Commits:**")
|
||||||
for commit in commits_main:
|
for commit in commits:
|
||||||
print("*", commit)
|
print("*", commit)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user