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.js | changed |
index.js | ||
---|---|---|
@@ -66,21 +66,20 @@ | ||
66 | 66 | pull.filter(function (update) { |
67 | 67 | return update.rev |
68 | 68 | && (lte ? update.timestamp <= lte : true) |
69 | 69 | }), |
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) | |
75 | 72 | }) |
76 | 73 | } |
77 | 74 | |
78 | 75 | function getRevs(prId, cb) { |
79 | 76 | getPullReq(prId, function (err, pr) { |
80 | 77 | 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, | |
83 | 82 | function (err, headUpdate) { |
84 | 83 | if (err) return cb(err) |
85 | 84 | // get the rev of base when head was last updated |
86 | 85 | getBranchLastUpdate(pr.baseRepo, pr.baseBranch, |
Built with git-ssb-web