|
15 | 15 | deleted, renamed, or on a branch not checked out locally). |
16 | 16 |
|
17 | 17 | `DIRECTORY.md` is treated specially and reported in its own section at the very |
18 | | -bottom. It is auto-generated, so nearly every PR touches it and it would |
| 18 | +bottom. It is auto-generated, so nearly every PR touches it, and it would |
19 | 19 | otherwise dominate the "possible merge conflicts" list and distract busy |
20 | 20 | maintainers. A merge conflict caused only by `DIRECTORY.md` is trivial to clear: |
21 | 21 | choose __accept both__ in the GitHub UI. The bottom section therefore separates |
|
37 | 37 | Requirements: gh (GitHub CLI), authenticated (`gh auth login`) |
38 | 38 |
|
39 | 39 | Usage: |
40 | | - ./pr_file_map.py |
41 | | - ./pr_file_map.py > report.md |
| 40 | + scripts/pr_file_map.py |
| 41 | + scripts/pr_file_map.py > report.md |
42 | 42 | """ |
43 | 43 |
|
44 | 44 | import json |
@@ -101,7 +101,7 @@ def git_root() -> Path | None: |
101 | 101 | def script_display_path() -> Path: |
102 | 102 | """This script's path relative to the git root (falls back to absolute).""" |
103 | 103 | script_path = Path(__file__).resolve() |
104 | | - if (root := git_root()) is not None: |
| 104 | + if root := git_root(): |
105 | 105 | try: |
106 | 106 | return script_path.relative_to(root.resolve()) |
107 | 107 | except ValueError: |
@@ -179,7 +179,11 @@ def render_directory_section( |
179 | 179 | f"### `{len(directory_only)}` PRs whose only overlap is " |
180 | 180 | f"`{DIRECTORY_FILE}` (safe to accept both)\n" |
181 | 181 | ) |
182 | | - print(" ".join(f"#{n}" for n in directory_only) if directory_only else "_None._") |
| 182 | + print( |
| 183 | + "- " + ", ".join(f"#{n}" for n in directory_only) |
| 184 | + if directory_only |
| 185 | + else "_None._" |
| 186 | + ) |
183 | 187 | print( |
184 | 188 | f"\n### `{len(directory_plus_other)}` PRs that also overlap on other " |
185 | 189 | "files (need a review or rebase)\n" |
@@ -253,7 +257,7 @@ def main() -> None: |
253 | 257 | # --- Render GitHub-flavored Markdown --- |
254 | 258 | print("# Open Pull Request File Map\n") |
255 | 259 | print(f"- Script: `{script_display_path()}`") |
256 | | - print(f"- Generated (UTC): `{datetime.now(UTC).isoformat()}`") |
| 260 | + print(f"- Generated: `{datetime.now(UTC):%d %b %Y at %H:%M} {UTC}`") |
257 | 261 | print(f"- Number of PRs: `{pr_count}`") |
258 | 262 | print(f"- File touches (PR x file): `{touch_count}`") |
259 | 263 | print(f"- Distinct files touched: `{distinct_count}`") |
|
0 commit comments