Skip to content

Commit

Permalink
mr_show: Add MR status "open (needs rebase)"
Browse files Browse the repository at this point in the history
I noticed that 'lab mr show' shows Merge Requests that need a rebase as
status "open" with no further information.

The MergeRequest struct has a MergeStatus field that returns
"can_be_merged" or "cannot_be_merged".  The "cannot_be_merged" state can
be used to return better status information to the user.

Add an "open (needs rebase)" status.

Signed-off-by: Prarit Bhargava <[email protected]>
  • Loading branch information
prarit committed Jan 21, 2021
1 parent 881fd1e commit f7019fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/mr_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ func printMR(mr *gitlab.MergeRequest, project string, renderMarkdown bool) {
"merged": "Merged",
}[mr.State]

if state == "Open" && mr.MergeStatus == "cannot_be_merged" {
state = "Open (Needs Rebase)"
}

if mr.Assignee != nil && mr.Assignee.Username != "" {
assignee = mr.Assignee.Username
}
Expand Down

0 comments on commit f7019fe

Please sign in to comment.