Address the base repository in PR/MR-reading commands when base config keys are set#1748
Open
PawelLipski wants to merge 2 commits into
Open
Address the base repository in PR/MR-reading commands when base config keys are set#1748PawelLipski wants to merge 2 commits into
PawelLipski wants to merge 2 commits into
Conversation
…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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_init_code_hosting_clientalways 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-descriptionsand their GitLab counterparts) ignored themachete.{github,gitlab}.base*config keys, which until now only affectedcreate-{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 nobase*key is set the base repository resolves to the head one, so this is a no-op for the common non-fork case, andcreate-{pr,mr}'s stricter base resolution is left untouched.