From aa8f9d8c009f5203b0c4375abbe8038ff8772daf Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 27 Apr 2026 17:27:12 -0700 Subject: [PATCH] For a dependent PR, include a link to changes to review. (#7124) Instead of linking to the first commit to be reviewed, link to the complete series of commits to review. Include a warning if not all the commits in that range should be reviewed due to non-linear history. Assisted-by: Gemini via Antigravity --- github_tools/check_dependent_pr.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/github_tools/check_dependent_pr.py b/github_tools/check_dependent_pr.py index 179bda0d0ab4..d26fc6c581d4 100755 --- a/github_tools/check_dependent_pr.py +++ b/github_tools/check_dependent_pr.py @@ -359,6 +359,13 @@ def _process_pr( first_independent_commit_oid = oid break + any_later_dependent_oids = False + if first_independent_commit_oid: + idx = current_oids.index(first_independent_commit_oid) + any_later_dependent_oids = any( + oid in dependent_oids for oid in current_oids[idx + 1 :] + ) + if ( open_deps == parsed_open_deps and merged_deps == parsed_merged_deps @@ -382,14 +389,20 @@ def _process_pr( if open_deps: pr_list_str = ", ".join([f"#{num}" for num in open_deps]) if first_independent_commit_oid: - short_hash = first_independent_commit_oid[:8] - first_commit_linked = ( - f"[{short_hash}]({pr_number}/commits/{short_hash})" + changes_url = ( + "https://github.com/carbon-language/carbon-lang/pull/" + f"{pr_number}/changes/{first_independent_commit_oid}..HEAD" ) comment_body += ( - f"Depends on {pr_list_str}, start review at " - f"{first_commit_linked}" + f"Depends on {pr_list_str}, start review with " + f"[these changes]({changes_url})" ) + if any_later_dependent_oids: + comment_body += ( + "\n\n> [!WARNING]\n" + "> Also contains changes from dependent PRs due to " + "non-linear history." + ) else: comment_body += ( f"Depends on {pr_list_str}, unable to identify starting review "