diff --git a/src/v3/plugins/github/__snapshots__/relationalView.test.js.snap b/src/v3/plugins/github/__snapshots__/relationalView.test.js.snap index 70390e4..4169623 100644 --- a/src/v3/plugins/github/__snapshots__/relationalView.test.js.snap +++ b/src/v3/plugins/github/__snapshots__/relationalView.test.js.snap @@ -71,6 +71,8 @@ Array [ ] `; +exports[`plugins/github/relationalView Pull has additions 1`] = `1`; + exports[`plugins/github/relationalView Pull has body 1`] = ` "@wchargin could you please do the following: - add a commit comment @@ -79,6 +81,8 @@ exports[`plugins/github/relationalView Pull has body 1`] = ` - then approve the pr" `; +exports[`plugins/github/relationalView Pull has deletions 1`] = `0`; + exports[`plugins/github/relationalView Pull has mergedAs 1`] = ` Object { "hash": "6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6", diff --git a/src/v3/plugins/github/__snapshots__/render.test.js.snap b/src/v3/plugins/github/__snapshots__/render.test.js.snap index 9d85e5f..15d4acc 100644 --- a/src/v3/plugins/github/__snapshots__/render.test.js.snap +++ b/src/v3/plugins/github/__snapshots__/render.test.js.snap @@ -2,11 +2,11 @@ exports[`plugins/github/render descriptions are as expected 1`] = ` Object { - "comment": "comment by @wchargin on review by @wchargin of #5: This pull request will be more contentious. I can feel it...", + "comment": "comment by @wchargin on review by @wchargin of #5 (+1/−0): This pull request will be more contentious. I can feel it...", "issue": "#2: A referencing issue.", - "pull": "#5: This pull request will be more contentious. I can feel it...", + "pull": "#5 (+1/−0): This pull request will be more contentious. I can feel it...", "repo": "sourcecred/example-github", - "review": "review by @wchargin of #5: This pull request will be more contentious. I can feel it...", + "review": "review by @wchargin of #5 (+1/−0): This pull request will be more contentious. I can feel it...", "userlike": "@wchargin", } `; diff --git a/src/v3/plugins/github/relationalView.js b/src/v3/plugins/github/relationalView.js index 4d5a428..34cab00 100644 --- a/src/v3/plugins/github/relationalView.js +++ b/src/v3/plugins/github/relationalView.js @@ -255,6 +255,8 @@ export class RelationalView { body: json.body, title: json.title, mergedAs, + additions: json.additions, + deletions: json.deletions, }; this._pulls.set(N.toRaw(address), entry); return address; @@ -565,6 +567,8 @@ type PullEntry = {| +reviews: ReviewAddress[], +mergedAs: ?GitNode.CommitAddress, +nominalAuthor: ?UserlikeAddress, + +additions: number, + +deletions: number, |}; export class Pull extends _Entity { @@ -585,6 +589,12 @@ export class Pull extends _Entity { body(): string { return this._entry.body; } + additions(): number { + return this._entry.additions; + } + deletions(): number { + return this._entry.deletions; + } mergedAs(): ?GitNode.CommitAddress { return this._entry.mergedAs; } diff --git a/src/v3/plugins/github/relationalView.test.js b/src/v3/plugins/github/relationalView.test.js index 62280ab..c2d089d 100644 --- a/src/v3/plugins/github/relationalView.test.js +++ b/src/v3/plugins/github/relationalView.test.js @@ -106,6 +106,8 @@ describe("plugins/github/relationalView", () => { has("url", () => entity.url()); has("parent", () => entity.parent()); has("mergedAs", () => entity.mergedAs()); + has("additions", () => entity.additions()); + has("deletions", () => entity.deletions()); hasEntities("reviews", () => entity.reviews()); hasEntities("comments", () => entity.comments()); hasEntities("authors", () => entity.authors()); diff --git a/src/v3/plugins/github/render.js b/src/v3/plugins/github/render.js index e9eae93..a41c18d 100644 --- a/src/v3/plugins/github/render.js +++ b/src/v3/plugins/github/render.js @@ -14,7 +14,10 @@ export function description(e: R.Entity) { const handlers = { repo: (x) => `${x.owner()}/${x.name()}`, issue: (x) => `#${x.number()}: ${x.title()}`, - pull: (x) => `#${x.number()}: ${x.title()}`, + pull: (x) => { + const diff = `+${x.additions()}/\u2212${x.deletions()}`; + return `#${x.number()} (${diff}): ${x.title()}`; + }, review: (x) => `review ${withAuthors(x)}of ${description(x.parent())}`, comment: (x) => `comment ${withAuthors(x)}on ${description(x.parent())}`, userlike: (x) => `@${x.login()}`,