git ssb

0+

cel / ssb-pull-requests



Commit 70d0b03772b4d50a59377d3674af0b56be1c6af7

Use latest head rev for open PRs

This makes sure that after a PR branch is updated, the getRevs returns the
updated head.
Charles Lehner committed on 7/26/2016, 2:23:34 AM
Parent: 7edcea263f1687fbf9f2c06e86045ffb8fe92bd3

Files changed

index.jschanged
index.jsView
@@ -66,21 +66,20 @@
6666 pull.filter(function (update) {
6767 return update.rev
6868 && (lte ? update.timestamp <= lte : true)
6969 }),
70- pull.take(1),
71- pull.collect(function (err, links) {
72- cb(err, links && links[0])
73- })
74- )
70+ pull.take(1)
71+ )(null, cb)
7572 })
7673 }
7774
7875 function getRevs(prId, cb) {
7976 getPullReq(prId, function (err, pr) {
8077 if (err) return cb(err)
81- // get the last rev of the head branch (before it was deleted)
82- getBranchLastUpdate(pr.headRepo, pr.headBranch, pr.updated_at,
78+ // get the latest rev of the head branch before it was deleted or the
79+ // PR closed
80+ var lastTime = pr.open ? null : pr.updated_at
81+ getBranchLastUpdate(pr.headRepo, pr.headBranch, lastTime,
8382 function (err, headUpdate) {
8483 if (err) return cb(err)
8584 // get the rev of base when head was last updated
8685 getBranchLastUpdate(pr.baseRepo, pr.baseBranch,

Built with git-ssb-web