Skip to content

Commit 0dd623a

Browse files
pr_file_map.py: Use a human-readable date format (#15357)
* pr_file_map.py: Use a human-readable date format Use a human-readable date format. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c536588 commit 0dd623a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

scripts/pr_file_map.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
deleted, renamed, or on a branch not checked out locally).
1616
1717
`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
1919
otherwise dominate the "possible merge conflicts" list and distract busy
2020
maintainers. A merge conflict caused only by `DIRECTORY.md` is trivial to clear:
2121
choose __accept both__ in the GitHub UI. The bottom section therefore separates
@@ -37,8 +37,8 @@
3737
Requirements: gh (GitHub CLI), authenticated (`gh auth login`)
3838
3939
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
4242
"""
4343

4444
import json
@@ -101,7 +101,7 @@ def git_root() -> Path | None:
101101
def script_display_path() -> Path:
102102
"""This script's path relative to the git root (falls back to absolute)."""
103103
script_path = Path(__file__).resolve()
104-
if (root := git_root()) is not None:
104+
if root := git_root():
105105
try:
106106
return script_path.relative_to(root.resolve())
107107
except ValueError:
@@ -179,7 +179,11 @@ def render_directory_section(
179179
f"### `{len(directory_only)}` PRs whose only overlap is "
180180
f"`{DIRECTORY_FILE}` (safe to accept both)\n"
181181
)
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+
)
183187
print(
184188
f"\n### `{len(directory_plus_other)}` PRs that also overlap on other "
185189
"files (need a review or rebase)\n"
@@ -253,7 +257,7 @@ def main() -> None:
253257
# --- Render GitHub-flavored Markdown ---
254258
print("# Open Pull Request File Map\n")
255259
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}`")
257261
print(f"- Number of PRs: `{pr_count}`")
258262
print(f"- File touches (PR x file): `{touch_count}`")
259263
print(f"- Distinct files touched: `{distinct_count}`")

0 commit comments

Comments
 (0)