Skip to content

fix: #150 `mr for` 404 Not Found

John McAvoy requested to merge github/fork/j-mcavoy/trunk into trunk

Description

Allows users to create a MR for an issue. Basic usage:

$ glab mr for <issue_id>
$ ./bin/glab mr for -h
Create new merge request for existing issue

Usage:
  glab mr for <issue_id> [flags]

Aliases:
  for, new

Flags:
      --allow-collaboration    Allow commits from other members
  -a, --assignee string        Assign merge request to people by their IDs. Multiple values should be comma separated
      --closes-issue           This merge request closes the issue when it is merged or closed (default true)
      --draft                  Mark merge request as a draft (default true)
  -f, --fill                   Do not prompt for title/description and just use commit info
  -h, --help                   help for for
  -l, --label string           Add label by name. Multiple labels should be comma separated
  -m, --milestone int          add milestone by <id> for merge request (default -1)
      --no-editor              Don't open editor to enter description. If set to true, uses prompt. Default is false
      --remove-source-branch   Remove Source Branch on merge
  -b, --target-branch string   The target or base branch into which you want your code merged (default master)
      --target-project int     Add target project by id (default -1)
  -t, --title string           Supply a title for merge request
      --wip                    Mark merge request as a work in progress. Alternative to --draft

Global Flags:
  -R, --repo string   Select another repository using the OWNER/REPO format or the project ID. Supports group namespaces

Related Issue #149

Motivation and Context

Quickly creates a MR for an issue similar to the "Create Merge Request" button in the browser.

How Has This Been Tested?

I ran my test on a dummy repo

$ glab mr for 8
Creating related branch...
Branch created:  https://gitlab.com/j-mcavoy/glab-test/-/tree/8-
#31 Draft: Resolve:  (#8) (8-) less than a minute ago
https://gitlab.com/j-mcavoy/glab-test/-/merge_requests/31

Screenshots (if appropriate): image

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)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Merge request reports