Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #585 from profclems/feat-view-details
Browse files Browse the repository at this point in the history
Include more details to mr view
  • Loading branch information
profclems authored Jan 26, 2021
2 parents 7cbbb95 + 2f4e7f3 commit d1770b5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions commands/mr/view/mr_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,31 @@ func printTTYMRPreview(out io.Writer, mr *gitlab.MergeRequest, notes []*gitlab.N
if mr.State == "closed" {
fmt.Fprintf(out, "Closed By: %s %s\n", mr.ClosedBy.Username, mrTimeAgo)
}
if mr.Pipeline != nil {
fmt.Fprint(out, utils.Bold("Pipeline Status: "))
var status string
switch s := mr.Pipeline.Status; s {
case "failed":
status = utils.Red(s)
case "success":
status = utils.Green(s)
default:
status = utils.Gray(s)
}
fmt.Fprintln(out, status)

if mr.MergeWhenPipelineSucceeds && mr.Pipeline.Status != "success" {
fmt.Fprintf(out, "%s Requires pipeline to succeed before merging\n", utils.WarnIcon())
}
}
fmt.Fprintf(out, "%s This merge request has %s changes\n", utils.GreenCheck(), utils.Yellow(mr.ChangesCount))
if mr.State == "merged" && mr.MergedBy != nil {
fmt.Fprintf(out, "%s The changes were merged into %s by %s %s\n", utils.GreenCheck(), mr.TargetBranch, mr.MergedBy.Name, utils.TimeToPrettyTimeAgo(*mr.MergedAt))
}

if mr.HasConflicts {
fmt.Fprintf(out, utils.Red("%s This branch has conflicts that must be resolved\n"), utils.FailedIcon())
}

// Comments
if opts.ShowComments {
Expand Down

0 comments on commit d1770b5

Please sign in to comment.