From a2f9601332b33fcd72dc78495c85ec01a91e4b8a Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Sun, 25 Oct 2026 12:23:47 +0000 Subject: [PATCH] feat(tools): report pr_overlap's pull request count and fetch progress pr_overlap printed nothing until its report, which takes 54 to 81 s on Linux with about 1,300 open pull requests and took minutes on Windows, so a run looked stuck. Write progress lines to stderr: the number of open pull requests once they are listed, and the number of pull request heads fetched after each batch of 100. The report on stdout is unchanged. --- tools/pr_overlap.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/pr_overlap.py b/tools/pr_overlap.py index 1634affa97..ea4a83d7ab 100644 --- a/tools/pr_overlap.py +++ b/tools/pr_overlap.py @@ -21,6 +21,7 @@ PLAIN_DEPENDS = re.compile(r'Depends on[ \t]+(#\d+\b(?:(?:[ \t]*,[ \t]*(?:and[ \ HUNK = re.compile(r"^@@ -(\d+)(?:,(\d+))?", re.M) MARKER = "" FETCH_REFS = 100 +PROGRESS_EVERY = 100 _REPO_ROOTS = {} @@ -78,6 +79,10 @@ def depends_on(body): match = next((match for match in DEPENDS.finditer(body) if match.group(1).strip()), None) or PLAIN_DEPENDS.search(body) return {int(n) for n in re.findall(r"#(\d+)", match.group(1))} if match else set() +def progress(message): + print(f"pr_overlap: {message}", file=sys.stderr, flush=True) + + def open_prs(base): query = urlencode({"state": "open", "base": base, "per_page": 100}) out = gh("api", "--paginate", f"repos/{REPO}/pulls?{query}") @@ -106,6 +111,7 @@ def open_prs(base): "author": pr["user"]["login"], "depends": depends_on(pr["body"]), } + progress(f"{len(prs)} open pull requests against {base}") return prs @@ -113,6 +119,7 @@ def fetch(base, prs): refspecs = [f"+refs/heads/{base}:refs/pr/base"] + [f"+{pr['sha']}:{pr['ref']}" for pr in prs.values()] for start in range(0, len(refspecs), FETCH_REFS): git("fetch", "--no-tags", "-q", f"https://github.com/{REPO}.git", *refspecs[start:start + FETCH_REFS]) + progress(f"fetched {min(start + FETCH_REFS, len(refspecs)) - 1}/{len(prs)} pull request heads") def merge(*args):