feat(mr): support direct MR ID input in mr checkout command
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Description
-
test: extracting MR IDs from various URL formats and checkout tests for merge request URLs
-
feat: enhance checkout command to accept merge request URLs
The changes allow users to checkout merge requests using either a direct MR ID number or a full GitLab URL. Previously, using just the ID number would fail, requiring users to always provide the full URL.
Examples of supported formats:
glab mr checkout 123
glab mr checkout https://gitlab.com/org/repo/-/merge_requests/123
Related Issues
Resolves #7684 (closed)
How has this been tested?
- Added test cases in
mr_checkout_test.goto verify:- Direct MR ID input (e.g., "123")
- Full GitLab URL with merge_requests format
- Full GitLab URL with merge-requests format (hyphenated)
- Invalid URL formats
- Edge cases (empty input, non-numeric IDs)
- Tested manually with both formats to ensure proper checkout functionality
- Verified existing URL-based checkout functionality remains unchanged
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Edited by 🤖 GitLab Bot 🤖