You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by rb...@apache.org on 2026/03/30 13:30:56 UTC
(comdev) 03/03: Adds a thread link to the active threads table
This is an automated email from the ASF dual-hosted git repository.
rbowen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/comdev.git
commit 06fa57573b3bf2ac8ae968f3f43deb78beb25208
Author: Rich Bowen <rb...@rcbowen.com>
AuthorDate: Fri Mar 13 12:03:41 2026 +0000
Adds a thread link to the active threads table
---
project-activity/project_activity.py | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/project-activity/project_activity.py b/project-activity/project_activity.py
index 5a5c94b..205b55a 100755
--- a/project-activity/project_activity.py
+++ b/project-activity/project_activity.py
@@ -161,9 +161,10 @@ def fetch_repos(project, repos):
def analyze_mbox_threads(project, list_name, months):
- """Analyze mbox files and return top threads."""
+ """Analyze mbox files and return top threads with first message ID."""
now = datetime.now()
- threads = defaultdict(int) # subject -> message count
+ threads = defaultdict(int) # normalized subject -> message count
+ thread_msgid = {} # normalized subject -> first Message-ID seen
for i in range(months + 1):
d = now - timedelta(days=30 * i)
@@ -196,12 +197,18 @@ def analyze_mbox_threads(project, list_name, months):
s = s[s.index("]") + 1:].lstrip()
else:
break
- threads[s.strip()] += 1
+ key = s.strip()
+ threads[key] += 1
+ if key not in thread_msgid:
+ mid = msg.get("Message-ID", "")
+ if mid:
+ thread_msgid[key] = mid.strip("<>")
except Exception:
continue
# Sort by count, top 5
- top = sorted(threads.items(), key=lambda x: -x[1])[:5]
+ top = [(subj, count, thread_msgid.get(subj, "")) for subj, count in
+ sorted(threads.items(), key=lambda x: -x[1])[:5]]
total = sum(threads.values())
return top, total
@@ -247,10 +254,15 @@ def report(project, active_lists, repos, months):
section = []
section.append(f"### {ln}@ ({total} messages)")
section.append("")
- section.append("| Messages | Thread |")
- section.append("|-------:|--------|")
- for subject, count in top_threads:
- section.append(f"| {count} | {subject} |")
+ list_id = f"{ln}.{project}.apache.org"
+ section.append("| Messages | Thread | Link |")
+ section.append("|-------:|--------|------|")
+ for subject, count, msgid in top_threads:
+ if msgid:
+ link = f"[thread](https://lists.apache.org/thread/<{msgid}>?<{list_id}>)"
+ else:
+ link = ""
+ section.append(f"| {count} | {subject} | {link} |")
section.append("")
list_sections.append("\n".join(section))