Skip to content

Add machete.github.retrieveByAuthor and machete.gitlab.retrieveByAuthor git config keys - #1746

Merged
PawelLipski merged 5 commits into
developfrom
feature/fetch-only-my-prs
Sep 18, 2026
Merged

PawelLipski merged 5 commits into
developfrom
feature/fetch-only-my-prs

Conversation

@PawelLipski

@PawelLipski PawelLipski commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

Based on PR #1784

Chain of upstream PRs as of 2026-09-17

Summary

  • Add machete.github.retrieveByAuthor / machete.gitlab.retrieveByAuthor: when set, PR/MR-listing commands download open PRs/MRs by author (GitHub GraphQL search / GitLab author_username filter) instead of every open PR/MR in the repository.
  • By default (and with --mine) that author is the current user; --by=<user> selects a different author, and chain reconstruction walks that author's PRs rather than the current user's.
  • --all still downloads every open PR/MR regardless of the key.

This makes annotating and traversing one's own PRs feasible in repositories with hundreds or thousands of open PRs, at the cost of not discovering PRs opened by other users when traversing mixed-author chains.

Test plan

@PawelLipski PawelLipski self-assigned this Jul 7, 2026
@PawelLipski PawelLipski added feature New feature or request performance Something works too slow github Relates to integration with GitHub gitlab Relates to integration with GitLab labels Jul 7, 2026
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch 2 times, most recently from 0085281 to ddc3f53 Compare July 7, 2026 19:07
@codecov-commenter

codecov-commenter commented Jul 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.66%. Comparing base (8dbf058) to head (ff7d0ca).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1746      +/-   ##
===========================================
- Coverage    98.66%   98.66%   -0.01%     
===========================================
  Files           45       45              
  Lines         5390     5458      +68     
  Branches       980      992      +12     
===========================================
+ Hits          5318     5385      +67     
  Misses          43       43              
- Partials        29       30       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PawelLipski PawelLipski changed the title Add machete.{github.fetchOnlyMyPullRequests,gitlab.fetchOnlyMyMergeRequests} git config keys Add machete.github.fetchOnlyMyPullRequests and machete.gitlab.fetchOnlyMyMergeRequests git config keys Jul 7, 2026
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch 4 times, most recently from c0b4a66 to 78ce323 Compare July 8, 2026 14:05
@PawelLipski PawelLipski changed the title Add machete.github.fetchOnlyMyPullRequests and machete.gitlab.fetchOnlyMyMergeRequests git config keys Add machete.github.retrieveOnlyMyPullRequests and machete.gitlab.retrieveOnlyMyMergeRequests git config keys Jul 8, 2026
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from 78ce323 to d0f2146 Compare July 8, 2026 14:35
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from d0f2146 to 95a8572 Compare July 28, 2026 16:30
@sjbarag

sjbarag commented Sep 2, 2026

Copy link
Copy Markdown

Thanks for implementing this @PawelLipski - it'll be super helpful for $dayjob use. Is there anything I can do to help this get closer to merging?

@PawelLipski

PawelLipski commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for implementing this @PawelLipski - it'll be super helpful for $dayjob use. Is there anything I can do to help this get closer to merging?

For clarity, what's $dayjob here? 😅 are you a human? 🧐
Also, could you describe your specific case where this will be useful? I'm on the fence whether to actually add this feature 🤔

@sjbarag

sjbarag commented Sep 4, 2026 •

Copy link
Copy Markdown

Thanks for implementing this @PawelLipski - it'll be super helpful for $dayjob use. Is there anything I can do to help this get closer to merging?

For clarity, what's $dayjob here? 😅 are you a human? 🧐 Also, could you describe your specific case where this will be useful? I'm on the fence whether to actually add this feature 🤔

Hehe, sorry, old-internet habits. I work at Netflix. The monorepo I do most of my work in has 932 PRs open right now1, and git machete github anno-prs takes ~17 seconds. Not the end of the world, but a bit of a flow-breaker to wait that long. At peak, my open PR count was probably… 6? 10? 🤷

To be more specific: I'm using git machete for some manual PR stacking and as a running ledger of which PRs I've got open, which I've merged, etc. Obv gh pr list --author '@me' does that too, but machete makes the bulk-rebasing process easier. Especially for shallow PR trees (think 3-4 independent changes that can merge in any order).

All that's to say: a machete.github.retrieveOnlyMyPullRequests toggle would be nice, but I recognize it's edge-casey and maybe not worth the maintenance cost long-term!

Footnotes

  1. Most of those PRs are old. I suspect listing PRs created in the last 30-60 days would cut the number of required pages to < 3, but haven't checked. ↩

@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from 95a8572 to 2395dfb Compare September 8, 2026 16:40
@PawelLipski PawelLipski changed the title Add machete.github.retrieveOnlyMyPullRequests and machete.gitlab.retrieveOnlyMyMergeRequests git config keys Add machete.github.retrieveByAuthor and machete.gitlab.retrieveByAuthor git config keys Sep 9, 2026
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch 2 times, most recently from cabe821 to 3663659 Compare September 9, 2026 14:02
@PawelLipski

Copy link
Copy Markdown
Collaborator Author

Okay! I'll probably get that shipped then - I'll use retrieveByAuthor key name instead (as we need to handle --by case cleanly as well - only retrieve PRs/MRs by that author)

@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from de32e37 to c0940ea Compare September 9, 2026 14:37
@sjbarag

sjbarag commented Sep 16, 2026

Copy link
Copy Markdown

Okay! I'll probably get that shipped then - I'll use retrieveByAuthor key name instead (as we need to handle --by case cleanly as well - only retrieve PRs/MRs by that author)

omgosh thanks so much! That makes sense to me :)

@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from 4d2b5e6 to 80b723d Compare September 17, 2026 13:06
When set, commands that list open PRs/MRs download those authored by a given user
(via GitHub GraphQL search / GitLab author_username filter) instead of every open PR/MR in the repository.
By default (and with `--mine`) that author is the current user; `--by=<user>` selects a different author,
and chain reconstruction walks that same author's PRs.
This makes annotating and traversing one's own PRs feasible in repositories with hundreds or thousands of open PRs,
at the cost of not discovering PRs opened by other users when traversing mixed-author chains.
The `--all` flag still downloads every open PR/MR regardless of the key.
…by number.

Checkout of specific PR/MR numbers now downloads that first PR's author's open PRs
and reconstructs the stack from them, rather than from the current user's.
@PawelLipski
PawelLipski marked this pull request as draft September 17, 2026 13:41
@PawelLipski
PawelLipski changed the base branch from develop to refactor/rename-get-all-open-pull-requests September 17, 2026 13:41
@PawelLipski
PawelLipski force-pushed the feature/fetch-only-my-prs branch from 07c230c to 54a43a9 Compare September 17, 2026 13:41
@PawelLipski
PawelLipski marked this pull request as ready for review September 17, 2026 13:41
Base automatically changed from refactor/rename-get-all-open-pull-requests to develop September 17, 2026 13:45
@PawelLipski
PawelLipski merged commit cb21e10 into develop Sep 18, 2026
12 checks passed
@PawelLipski
PawelLipski deleted the feature/fetch-only-my-prs branch September 18, 2026 13:00
@PawelLipski

Copy link
Copy Markdown
Collaborator Author

@sjbarag merged, I'll get that released soon as v3.46.0 - pls test at your convenience

@sjbarag

sjbarag commented Sep 18, 2026 via email

Copy link
Copy Markdown

@sjbarag

sjbarag commented Sep 24, 2026 •

Copy link
Copy Markdown

Heya @PawelLipski! Just upgrade to 3.46.0 and tried out git machete github anno-prs --by=sbarag, and it seems to only be available in the checkout-prsandupdate-pr-descriptions` subcommands. Is that intentional?

CleanShot 2026-09-24 at 1 53 28 PM@2x

When I set machete.github.retrieveByAuthor, I don't see a difference in wall-clock time either though 🤔 maybe I'm just doing something wrong?

CleanShot 2026-09-24 at 1 58 02 PM@2x

@PawelLipski

PawelLipski commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Hey, --by on anno-prs is intentional - that flag only exists on checkout-prs and update-pr-descriptions. With retrieveByAuthor enabled, anno-prs always fetches the current user (from the API token).

The other bit: machete.github.retrieveByAuthor is a boolean, not a login - so git -c machete.github.retrieveByAuthor=sbarag was silently treated as false, which is why the wall-clock time didn't change.

Try:

git -c machete.github.retrieveByAuthor=true machete github anno-prs

You should see Checking for open GitHub PRs by <your-github-login>... rather than Checking for open GitHub PRs...

I'll also ship a follow-up (#1791) so invalid boolean values fail loudly instead of being treated as false.

@sjbarag

sjbarag commented Sep 25, 2026

Copy link
Copy Markdown

OH! Ohhhhhh that makes more sense. Confirmed working on my end, this is a massive time-save. Down from ~12s to ~1s 🤩

CleanShot 2026-09-25 at 10 01 01 AM@2x

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request github Relates to integration with GitHub gitlab Relates to integration with GitLab performance Something works too slow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize github anno-prs and github checkout-prs for the case of 500+ PRs in a repo

3 participants