Skip to content

Commit d02b8db

Browse files
committed
error handling
1 parent 6a4d3d8 commit d02b8db

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/python/compile_contributors.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,27 @@ def main():
381381
# 1. Fetch base branch PRs (scan depth controlled by scan_depth)
382382
log_event(f"Fetching base branch history for {branch_base} (last {scan_depth})...", log_file)
383383
log_base = run_command(["git", "log", branch_base, "-n", str(scan_depth), "--oneline"])
384+
if log_base is None:
385+
log_event(
386+
f"Error: Could not fetch history for base ref '{branch_base}'. Please check if the ref exists.",
387+
log_file,
388+
)
389+
return
390+
384391
prs_base_dict = get_prs_from_log(log_base, prs_base=None, log_file=log_file, scan_depth=scan_depth)
385392
prs_base = set(prs_base_dict.keys())
386393

387394
# 2. Fetch target branch PRs (only those not in base)
388395
log_event(f"Fetching target branch history: {branch_base}..{branch_target}...", log_file)
389396
# Using A..B syntax for git log
390397
log_target = run_command(["git", "log", f"{branch_base}..{branch_target}", "--oneline"])
398+
if log_target is None:
399+
log_event(
400+
f"Error: Could not fetch history for range '{branch_base}..{branch_target}'. Please check if the refs exist.",
401+
log_file,
402+
)
403+
return
404+
391405
prs_target = get_prs_from_log(log_target, prs_base=prs_base, log_file=log_file, scan_depth=scan_depth)
392406

393407
# All PRs in target but not in base (deduplicated by key)

0 commit comments

Comments
 (0)