"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/pr/view/view.go" between
gh-cli-1.10.3.tar.gz and gh-cli-1.11.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

view.go  (gh-cli-1.10.3):view.go  (gh-cli-1.11.0)
skipping to change at line 173 skipping to change at line 173
fmt.Fprintln(out, pr.Body) fmt.Fprintln(out, pr.Body)
return nil return nil
} }
func printHumanPrPreview(opts *ViewOptions, pr *api.PullRequest) error { func printHumanPrPreview(opts *ViewOptions, pr *api.PullRequest) error {
out := opts.IO.Out out := opts.IO.Out
cs := opts.IO.ColorScheme() cs := opts.IO.ColorScheme()
// Header (Title and State) // Header (Title and State)
fmt.Fprintln(out, cs.Bold(pr.Title)) fmt.Fprintf(out, "%s #%d\n", cs.Bold(pr.Title), pr.Number)
fmt.Fprintf(out, fmt.Fprintf(out,
"%s • %s wants to merge %s into %s from %s • %s %s \n", "%s • %s wants to merge %s into %s from %s • %s %s \n",
shared.StateTitleWithColor(cs, *pr), shared.StateTitleWithColor(cs, *pr),
pr.Author.Login, pr.Author.Login,
utils.Pluralize(pr.Commits.TotalCount, "commit"), utils.Pluralize(pr.Commits.TotalCount, "commit"),
pr.BaseRefName, pr.BaseRefName,
pr.HeadRefName, pr.HeadRefName,
cs.Green("+"+strconv.Itoa(pr.Additions)), cs.Green("+"+strconv.Itoa(pr.Additions)),
cs.Red("-"+strconv.Itoa(pr.Deletions)), cs.Red("-"+strconv.Itoa(pr.Deletions)),
) )
skipping to change at line 297 skipping to change at line 297
for _, reviewer := range reviewerStates { for _, reviewer := range reviewerStates {
reviewers = append(reviewers, formattedReviewerState(cs, reviewer )) reviewers = append(reviewers, formattedReviewerState(cs, reviewer ))
} }
reviewerList := strings.Join(reviewers, ", ") reviewerList := strings.Join(reviewers, ", ")
return reviewerList return reviewerList
} }
const teamTypeName = "Team"
const ghostName = "ghost" const ghostName = "ghost"
// parseReviewers parses given Reviews and ReviewRequests // parseReviewers parses given Reviews and ReviewRequests
func parseReviewers(pr api.PullRequest) []*reviewerState { func parseReviewers(pr api.PullRequest) []*reviewerState {
reviewerStates := make(map[string]*reviewerState) reviewerStates := make(map[string]*reviewerState)
for _, review := range pr.Reviews.Nodes { for _, review := range pr.Reviews.Nodes {
if review.Author.Login != pr.Author.Login { if review.Author.Login != pr.Author.Login {
name := review.Author.Login name := review.Author.Login
if name == "" { if name == "" {
skipping to change at line 320 skipping to change at line 318
} }
reviewerStates[name] = &reviewerState{ reviewerStates[name] = &reviewerState{
Name: name, Name: name,
State: review.State, State: review.State,
} }
} }
} }
// Overwrite reviewer's state if a review request for the same reviewer e xists. // Overwrite reviewer's state if a review request for the same reviewer e xists.
for _, reviewRequest := range pr.ReviewRequests.Nodes { for _, reviewRequest := range pr.ReviewRequests.Nodes {
name := reviewRequest.RequestedReviewer.Login name := reviewRequest.RequestedReviewer.LoginOrSlug()
if reviewRequest.RequestedReviewer.TypeName == teamTypeName {
name = reviewRequest.RequestedReviewer.Name
}
reviewerStates[name] = &reviewerState{ reviewerStates[name] = &reviewerState{
Name: name, Name: name,
State: requestedReviewState, State: requestedReviewState,
} }
} }
// Convert map to slice for ease of sort // Convert map to slice for ease of sort
result := make([]*reviewerState, 0, len(reviewerStates)) result := make([]*reviewerState, 0, len(reviewerStates))
for _, reviewer := range reviewerStates { for _, reviewer := range reviewerStates {
if reviewer.State == pendingReviewState { if reviewer.State == pendingReviewState {
 End of changes. 3 change blocks. 
7 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)