Commit 09a90c8c8dd420350b85fbb6d781b88a9786512f
Include pull request head repo in list of forks of base repo
This means that if a pull request is made to merge commits from repo A into repo B, repo A will subsequently appear in the "compare changes" suggestions list for repo BCharles Lehner committed on 7/24/2016, 4:12:03 PM
Parent: df526a703483cc221c20e8b4d0187de4bba7fd15
Files changed
lib/repos/index.js | changed |
lib/repos/index.js | ||
---|---|---|
@@ -862,19 +862,38 @@ | ||
862 | 862 | R.getForks = function (repo, includeSelf) { |
863 | 863 | var self = this |
864 | 864 | return pull( |
865 | 865 | cat([ |
866 | - includeSelf && u.readOnce(function (cb) { | |
867 | - self.web.getMsg(repo.id, function (err, value) { | |
868 | - cb(err, value && {key: repo.id, value: value}) | |
869 | - }) | |
870 | - }), | |
871 | - self.web.ssb.links({ | |
872 | - dest: repo.id, | |
873 | - values: true, | |
874 | - rel: 'upstream' | |
866 | + includeSelf && pull.once(repo.id), | |
867 | + // get downstream repos | |
868 | + pull( | |
869 | + self.web.ssb.links({ | |
870 | + dest: repo.id, | |
871 | + rel: 'upstream' | |
872 | + }), | |
873 | + pull.map('key') | |
874 | + ), | |
875 | + // look for other repos that previously had pull requests to this one | |
876 | + pull( | |
877 | + self.web.ssb.links({ | |
878 | + dest: repo.id, | |
879 | + values: true, | |
880 | + rel: 'project' | |
881 | + }), | |
882 | + pull.filter(function (msg) { | |
883 | + var c = msg && msg.value && msg.value.content | |
884 | + return c && c.type == 'pull-request' | |
885 | + }), | |
886 | + pull.map(function (msg) { return msg.value.content.head_repo }) | |
887 | + ) | |
888 | + ]), | |
889 | + pull.unique(), | |
890 | + paramap(function (key, cb) { | |
891 | + self.web.ssb.get(key, function (err, value) { | |
892 | + if (err) cb(err) | |
893 | + else cb(null, {key: key, value: value}) | |
875 | 894 | }) |
876 | - ]), | |
895 | + }, 4), | |
877 | 896 | pull.filter(function (msg) { |
878 | 897 | var c = msg && msg.value && msg.value.content |
879 | 898 | return c && c.type == 'git-repo' |
880 | 899 | }), |
Built with git-ssb-web