git ssb

30+

cel / git-ssb-web



Commit 2ad0196e8b9972306535f04ebe1f9821a913c758

Compute diffs for existing PRs using common ancestor

Charles Lehner committed on 7/26/2016, 3:29:59 AM
Parent: a282c43eb17a12a9a7d49e9c95560668ec1f08b7

Files changed

lib/repos/pulls.jschanged
package.jsonchanged
lib/repos/pulls.jsView
@@ -90,26 +90,36 @@
9090 P.renderPullReqCommits = function (req, pr, baseRepo, headRepo, cb) {
9191 var self = this
9292 self.web.pullReqs.getRevs(pr.id, function (err, revs) {
9393 if (err) return cb(null, self.web.renderError(err))
94- cb(null, cat([
95- pull.once('<section>'),
96- self.renderCommitLog(req, baseRepo, revs.base, headRepo, revs.head),
97- pull.once('</section>')
98- ]))
94+ GitRepo.getMergeBase(baseRepo, revs.base, headRepo, revs.head,
95+ function (err, mergeBase) {
96+ if (err) return cb(null, self.web.renderError(err))
97+ cb(null, cat([
98+ pull.once('<section>'),
99+ self.renderCommitLog(req, baseRepo, mergeBase, headRepo, revs.head),
100+ pull.once('</section>')
101+ ]))
102+ }
103+ )
99104 })
100105 }
101106
102107 P.renderPullReqFiles = function (req, pr, baseRepo, headRepo, cb) {
103108 var self = this
104109 self.web.pullReqs.getRevs(pr.id, function (err, revs) {
105110 if (err) return cb(null, self.web.renderError(err))
106- cb(null, cat([
107- pull.once('<section>'),
108- self.repo.renderDiffStat(req,
109- [baseRepo, headRepo], [revs.base, revs.head]),
110- pull.once('</section>')
111- ]))
111+ GitRepo.getMergeBase(baseRepo, revs.base, headRepo, revs.head,
112+ function (err, mergeBase) {
113+ if (err) return cb(null, self.web.renderError(err))
114+ cb(null, cat([
115+ pull.once('<section>'),
116+ self.repo.renderDiffStat(req,
117+ [baseRepo, headRepo], [mergeBase, revs.head]),
118+ pull.once('</section>')
119+ ]))
120+ }
121+ )
112122 })
113123 }
114124
115125 P.renderPullReqActivity = function (req, pr, repo, headRepo, authorLink, postId) {
package.jsonView
@@ -24,9 +24,9 @@
2424 "ssb-keys": "^5.0.0",
2525 "ssb-marked": "^0.6.0",
2626 "ssb-mentions": "^0.1.0",
2727 "ssb-msg-schemas": "^6.1.0",
28- "ssb-pull-requests": "^0.1.0",
28+ "ssb-pull-requests": "^0.1.1",
2929 "ssb-reconnect": "^0.1.0",
3030 "ssb-ref": "^2.2.2",
3131 "stream-to-pull-stream": "^1.7.0"
3232 },

Built with git-ssb-web