Skip to content

Address the base repository in PR/MR-reading commands when base config keys are set#1748

Open
PawelLipski wants to merge 2 commits into
developfrom
fix/read-prs-from-base-repo
Open

Address the base repository in PR/MR-reading commands when base config keys are set#1748
PawelLipski wants to merge 2 commits into
developfrom
fix/read-prs-from-base-repo

Conversation

@PawelLipski

Copy link
Copy Markdown
Collaborator

_init_code_hosting_client always resolved the code-hosting client from the head remote, so the PR/MR-reading and -modifying commands (anno-prs, checkout-prs, retarget-pr, restack-pr, update-pr-descriptions and their GitLab counterparts) ignored the machete.{github,gitlab}.base* config keys, which until now only affected create-{pr,mr}.
In a fork workflow (head = fork, base = upstream) those commands therefore queried the fork - where the PRs/MRs don't live - and found nothing.
The client is now created against the base repository whenever any base* key is set, while the returned head remote is kept for fetching/pushing branches; when no base* key is set the base repository resolves to the head one, so this is a no-op for the common non-fork case, and create-{pr,mr}'s stricter base resolution is left untouched.

…g keys are set

`_init_code_hosting_client` always resolved the code-hosting client from the head remote, so the PR/MR-reading and -modifying commands (`anno-prs`, `checkout-prs`, `retarget-pr`, `restack-pr`, `update-pr-descriptions` and their GitLab counterparts) ignored the `machete.{github,gitlab}.base*` config keys, which until now only affected `create-{pr,mr}`.
In a fork workflow (head = fork, base = upstream) those commands therefore queried the fork - where the PRs/MRs don't live - and found nothing.
The client is now created against the base repository whenever any `base*` key is set, while the returned head remote is kept for fetching/pushing branches; when no `base*` key is set the base repository resolves to the head one, so this is a no-op for the common non-fork case, and `create-{pr,mr}`'s stricter base resolution is left untouched.
@PawelLipski PawelLipski self-assigned this Jul 8, 2026
@PawelLipski PawelLipski added bug Something isn't working github Relates to integration with GitHub gitlab Relates to integration with GitLab labels Jul 8, 2026
@codecov-commenter

codecov-commenter commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.77%. Comparing base (1c007c1) to head (1a82807).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1748   +/-   ##
========================================
  Coverage    98.77%   98.77%           
========================================
  Files           45       45           
  Lines         5372     5375    +3     
  Branches       981      981           
========================================
+ Hits          5306     5309    +3     
  Misses          41       41           
  Partials        25       25           

☔ 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.

Document that the base* config keys are what make the PR/MR-reading and
-modifying commands (anno-prs, checkout-prs, retarget-pr, restack-pr,
update-pr-descriptions and their MR counterparts) address a base repository
that differs from the head one. Only create-pr/create-mr infers the base
repository/target project from the base branch's tracking remote, so it can
target a fork/upstream base even with no config; the other commands are
initialized without a base branch to infer from and therefore need the keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github Relates to integration with GitHub gitlab Relates to integration with GitLab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants