diff --git a/scripts/pr_file_map.py b/scripts/pr_file_map.py index f9ea85012d4c..254972ed1a9a 100644 --- a/scripts/pr_file_map.py +++ b/scripts/pr_file_map.py @@ -15,7 +15,7 @@ deleted, renamed, or on a branch not checked out locally). `DIRECTORY.md` is treated specially and reported in its own section at the very -bottom. It is auto-generated, so nearly every PR touches it and it would +bottom. It is auto-generated, so nearly every PR touches it, and it would otherwise dominate the "possible merge conflicts" list and distract busy maintainers. A merge conflict caused only by `DIRECTORY.md` is trivial to clear: choose __accept both__ in the GitHub UI. The bottom section therefore separates @@ -37,8 +37,8 @@ Requirements: gh (GitHub CLI), authenticated (`gh auth login`) Usage: - ./pr_file_map.py - ./pr_file_map.py > report.md + scripts/pr_file_map.py + scripts/pr_file_map.py > report.md """ import json @@ -101,7 +101,7 @@ def git_root() -> Path | None: def script_display_path() -> Path: """This script's path relative to the git root (falls back to absolute).""" script_path = Path(__file__).resolve() - if (root := git_root()) is not None: + if root := git_root(): try: return script_path.relative_to(root.resolve()) except ValueError: @@ -179,7 +179,11 @@ def render_directory_section( f"### `{len(directory_only)}` PRs whose only overlap is " f"`{DIRECTORY_FILE}` (safe to accept both)\n" ) - print(" ".join(f"#{n}" for n in directory_only) if directory_only else "_None._") + print( + "- " + ", ".join(f"#{n}" for n in directory_only) + if directory_only + else "_None._" + ) print( f"\n### `{len(directory_plus_other)}` PRs that also overlap on other " "files (need a review or rebase)\n" @@ -253,7 +257,7 @@ def main() -> None: # --- Render GitHub-flavored Markdown --- print("# Open Pull Request File Map\n") print(f"- Script: `{script_display_path()}`") - print(f"- Generated (UTC): `{datetime.now(UTC).isoformat()}`") + print(f"- Generated: `{datetime.now(UTC):%d %b %Y at %H:%M} {UTC}`") print(f"- Number of PRs: `{pr_count}`") print(f"- File touches (PR x file): `{touch_count}`") print(f"- Distinct files touched: `{distinct_count}`")