This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
feat(commands/mr/mrutils): add OWNER:branch support #441
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.
Description
This adds support for querying Merge Requests via '[OWNER:]branch'.
Users can ask
mr view <branch>
, and it will look for a merge requestwith the source branch of .
If it finds none then error out.
If it finds only one then it returns the merge request to the user.
If it finds more than one it then prompts the user to pick one of the
merge requests and returns the picked one.
If the user passes the optional OWNER: field then it also tries to it to
the username of the creator of the merge request.
Example: The user passes profclems:foo
It will search all merge requests for ones with the source branch
foo
If it finds none then it errors out.
If it finds one it tries to match the Author.Username to
profclems
,returning it if it matches or erroring out if it doesn't.
If it finds more than one, it checks if any of the merge requests
matches the Author.Username field and if matched it returns it otherwise
it errors out.
This should affect all programs that uses
mrutils.GetOpenMRForBranch
, which while not directly used by any of the commands, it is always called when the functionsmrutils.MRsFromArgs
,mrutils.MRFromArgsWithOpts
andmrutils.MRFromArgs
are used.Users of
mrutils.MRFromArgs
:Users of
mrutils.MRsFromArgs
:Users of
mrutils.MRFromArgsWithOpts
:Related Issue
Resolves #440
How Has This Been Tested?
See screenshots for testing. Needs more extensive testing with other commands.
Screenshots (if appropriate):
Matching a number
Matching a branch name that matches a single MR (without and with OWNER: and failure to match due to bad OWNER:)
Matching branch with multiple MRs but filtering interactively
Matching branch with multiple MRs but filtering by OWNER:
Failure to match a branch with multiple MRs due to bad OWNER:
Types of changes