diff --git a/pkg/cmd/pr/view/fixtures/prView.json b/pkg/cmd/pr/view/fixtures/prView.json index 826f10100..c15a828a6 100644 --- a/pkg/cmd/pr/view/fixtures/prView.json +++ b/pkg/cmd/pr/view/fixtures/prView.json @@ -14,6 +14,8 @@ "headRepositoryOwner": { "login": "hubot" }, + "additions": 100, + "deletions": 10, "commits": { "totalCount": 12 }, @@ -34,6 +36,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "headRepositoryOwner": { "login": "OWNER" }, diff --git a/pkg/cmd/pr/view/fixtures/prViewPreview.json b/pkg/cmd/pr/view/fixtures/prViewPreview.json index f660eaa6c..b8409262f 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreview.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreview.json @@ -10,6 +10,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "assignees": { "nodes": [], "totalcount": 0 diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewClosedState.json b/pkg/cmd/pr/view/fixtures/prViewPreviewClosedState.json index 9df2c1038..fb8d6520d 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewClosedState.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewClosedState.json @@ -10,6 +10,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "commits": { "totalCount": 12 }, diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewDraftState.json b/pkg/cmd/pr/view/fixtures/prViewPreviewDraftState.json index 69ab57b11..4fa9a2c70 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewDraftState.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewDraftState.json @@ -13,6 +13,8 @@ "commits": { "totalCount": 12 }, + "additions": 100, + "deletions": 10, "baseRefName": "master", "headRefName": "blueberries", "headRepositoryOwner": { diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewDraftStatebyBranch.json b/pkg/cmd/pr/view/fixtures/prViewPreviewDraftStatebyBranch.json index c9d0eef59..03a55dbc5 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewDraftStatebyBranch.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewDraftStatebyBranch.json @@ -14,6 +14,8 @@ "headRepositoryOwner": { "login": "hubot" }, + "additions": 100, + "deletions": 10, "commits": { "totalCount": 12 }, @@ -37,6 +39,8 @@ "headRepositoryOwner": { "login": "OWNER" }, + "additions": 100, + "deletions": 10, "commits": { "totalCount": 8 }, diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewMergedState.json b/pkg/cmd/pr/view/fixtures/prViewPreviewMergedState.json index d62449092..6dcff7125 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewMergedState.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewMergedState.json @@ -13,6 +13,8 @@ "commits": { "totalCount": 12 }, + "additions": 100, + "deletions": 10, "baseRefName": "master", "headRefName": "blueberries", "headRepositoryOwner": { diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewSingleComment.json b/pkg/cmd/pr/view/fixtures/prViewPreviewSingleComment.json index c0ab1afbd..6462dcd01 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewSingleComment.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewSingleComment.json @@ -10,6 +10,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "assignees": { "nodes": [], "totalcount": 0 diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByBranch.json b/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByBranch.json index 15842a7b9..9893ac523 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByBranch.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByBranch.json @@ -12,6 +12,8 @@ "url": "https://github.com/OWNER/REPO/pull/12", "headRefName": "blueberries", "baseRefName": "master", + "additions": 100, + "deletions": 10, "headRepositoryOwner": { "login": "hubot" }, @@ -49,6 +51,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "assignees": { "nodes": [ { diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByNumber.json b/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByNumber.json index c6f801477..00f768f17 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByNumber.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewWithMetadataByNumber.json @@ -10,6 +10,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "reviewRequests": { "nodes": [ { diff --git a/pkg/cmd/pr/view/fixtures/prViewPreviewWithReviewersByNumber.json b/pkg/cmd/pr/view/fixtures/prViewPreviewWithReviewersByNumber.json index 6ff594fec..59b1ed1a7 100644 --- a/pkg/cmd/pr/view/fixtures/prViewPreviewWithReviewersByNumber.json +++ b/pkg/cmd/pr/view/fixtures/prViewPreviewWithReviewersByNumber.json @@ -10,6 +10,8 @@ "author": { "login": "nobody" }, + "additions": 100, + "deletions": 10, "reviewRequests": { "nodes": [ { diff --git a/pkg/cmd/pr/view/fixtures/prView_EmptyBody.json b/pkg/cmd/pr/view/fixtures/prView_EmptyBody.json index 36fdc308b..dcc2be64b 100644 --- a/pkg/cmd/pr/view/fixtures/prView_EmptyBody.json +++ b/pkg/cmd/pr/view/fixtures/prView_EmptyBody.json @@ -14,6 +14,8 @@ "headRepositoryOwner": { "login": "hubot" }, + "additions": 100, + "deletions": 10, "commits": { "totalCount": 12 }, @@ -30,6 +32,8 @@ "url": "https://github.com/OWNER/REPO/pull/10", "baseRefName": "master", "headRefName": "blueberries", + "additions": 100, + "deletions": 10, "author": { "login": "nobody" }, diff --git a/pkg/cmd/pr/view/view.go b/pkg/cmd/pr/view/view.go index 0eb8c9e73..e10772107 100644 --- a/pkg/cmd/pr/view/view.go +++ b/pkg/cmd/pr/view/view.go @@ -138,8 +138,8 @@ func printRawPrPreview(io *iostreams.IOStreams, pr *api.PullRequest) error { fmt.Fprintf(out, "milestone:\t%s\n", pr.Milestone.Title) fmt.Fprintf(out, "number:\t%d\n", pr.Number) fmt.Fprintf(out, "url:\t%s\n", pr.URL) - fmt.Fprintf(out, "additions:\t+%s\n", cs.Green(strconv.Itoa(pr.Additions))) - fmt.Fprintf(out, "deletions:\t-%s\n", cs.Red(strconv.Itoa(pr.Deletions))) + fmt.Fprintf(out, "additions:\t%s\n", cs.Green(strconv.Itoa(pr.Additions))) + fmt.Fprintf(out, "deletions:\t%s\n", cs.Red(strconv.Itoa(pr.Deletions))) fmt.Fprintln(out, "--") fmt.Fprintln(out, pr.Body) diff --git a/pkg/cmd/pr/view/view_test.go b/pkg/cmd/pr/view/view_test.go index cc73e84f6..509d1cf68 100644 --- a/pkg/cmd/pr/view/view_test.go +++ b/pkg/cmd/pr/view/view_test.go @@ -185,6 +185,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `projects:\t\n`, `milestone:\t\n`, `url:\thttps://github.com/OWNER/REPO/pull/12\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `number:\t12\n`, `blueberries taste good`, }, @@ -221,6 +223,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `assignees:\t\n`, `projects:\t\n`, `milestone:\t\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `reviewers:\tDEF \(Commented\), def \(Changes requested\), ghost \(Approved\), hubot \(Commented\), xyz \(Approved\), 123 \(Requested\), Team 1 \(Requested\), abc \(Requested\)\n`, `\*\*blueberries taste good\*\*`, }, @@ -241,6 +245,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `labels:\tone, two, three, four, five\n`, `projects:\tProject 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`, `milestone:\tuluru\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `blueberries taste good`, }, }, @@ -260,6 +266,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `labels:\t\n`, `projects:\t\n`, `milestone:\t\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `\*\*blueberries taste good\*\*`, }, }, @@ -279,6 +287,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `labels:\t\n`, `projects:\t\n`, `milestone:\t\n`, + `additions:\t100\n`, + `deletions:\t10\n`, }, }, "Closed PR": { @@ -296,6 +306,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `reviewers:\t\n`, `projects:\t\n`, `milestone:\t\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `\*\*blueberries taste good\*\*`, }, }, @@ -314,6 +326,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `reviewers:\t\n`, `projects:\t\n`, `milestone:\t\n`, + `additions:\t100\n`, + `deletions:\t10\n`, `\*\*blueberries taste good\*\*`, }, }, @@ -333,6 +347,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `reviewers:`, `projects:`, `milestone:`, + `additions:\t100\n`, + `deletions:\t10\n`, `\*\*blueberries taste good\*\*`, }, }, @@ -352,6 +368,8 @@ func TestPRView_Preview_nontty(t *testing.T) { `reviewers:`, `projects:`, `milestone:`, + `additions:\t100\n`, + `deletions:\t10\n`, `\*\*blueberries taste good\*\*`, }, }, @@ -395,7 +413,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are from a fork`, - `Open.*nobody wants to merge 12 commits into master from blueberries`, + `Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`, }, @@ -409,7 +427,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are from a fork`, - `Open.*nobody wants to merge 12 commits into master from blueberries`, + `Open.*nobody wants to merge 12 commits into master from blueberries.+100.-10`, `Reviewers:.*1 \(.*Requested.*\)\n`, `Assignees:.*marseilles, monaco\n`, `Labels:.*one, two, three, four, five\n`, @@ -442,7 +460,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are a good fruit`, - `Open.*nobody wants to merge 8 commits into master from blueberries`, + `Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`, `Assignees:.*marseilles, monaco\n`, `Labels:.*one, two, three, four, five\n`, `Projects:.*Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`, @@ -460,7 +478,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are a good fruit`, - `Open.*nobody wants to merge 8 commits into master from blueberries`, + `Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`, }, @@ -474,7 +492,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are a good fruit`, - `Open.*nobody wants to merge 8 commits into master from blueberries`, + `Open.*nobody wants to merge 8 commits into master from blueberries.+100.-10`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`, }, }, @@ -487,7 +505,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are from a fork`, - `Closed.*nobody wants to merge 12 commits into master from blueberries`, + `Closed.*nobody wants to merge 12 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`, }, @@ -501,7 +519,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are from a fork`, - `Merged.*nobody wants to merge 12 commits into master from blueberries`, + `Merged.*nobody wants to merge 12 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`, }, @@ -515,7 +533,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are from a fork`, - `Draft.*nobody wants to merge 12 commits into master from blueberries`, + `Draft.*nobody wants to merge 12 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12`, }, @@ -529,7 +547,7 @@ func TestPRView_Preview(t *testing.T) { }, expectedOutputs: []string{ `Blueberries are a good fruit`, - `Draft.*nobody wants to merge 8 commits into master from blueberries`, + `Draft.*nobody wants to merge 8 commits into master from blueberries.+100.-10`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10`, },