Add CONTAINS edges from Repositories to Issues/PRs (#253)
Also updates the GitHub porcelain. Existing observable behavior is unchanged, except that performance may be improved for issueOrPrByNumber. A bug that would afflict a multi-repository graph (namely, that calling `repo.issues()` would get all issues for all repositories) is pre-emptively removed. No test cases were added as we do not yet support multi-repository graphs. Test plan: existing unit test coverage is sufficient.
This commit is contained in:
parent
9d24190c03
commit
04390e5609
|
@ -16,6 +16,19 @@ Object {
|
||||||
"type": "ISSUE",
|
"type": "ISSUE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/1\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/1",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"nodes": Object {
|
"nodes": Object {
|
||||||
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
||||||
|
@ -138,6 +151,19 @@ Object {
|
||||||
"type": "ISSUE",
|
"type": "ISSUE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/6\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/6",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"nodes": Object {
|
"nodes": Object {
|
||||||
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
||||||
|
@ -267,6 +293,19 @@ Object {
|
||||||
"type": "PULL_REQUEST",
|
"type": "PULL_REQUEST",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/pull/5",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "PULL_REQUEST",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/wchargin\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"AUTHOR\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5#discussion_r171460198\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST_REVIEW_COMMENT\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHORS\\"}": Object {
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/wchargin\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"AUTHOR\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5#discussion_r171460198\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST_REVIEW_COMMENT\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHORS\\"}": Object {
|
||||||
"dst": Object {
|
"dst": Object {
|
||||||
"id": "https://github.com/wchargin",
|
"id": "https://github.com/wchargin",
|
||||||
|
@ -422,6 +461,19 @@ Object {
|
||||||
"type": "PULL_REQUEST",
|
"type": "PULL_REQUEST",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/3\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/pull/3",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "PULL_REQUEST",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"nodes": Object {
|
"nodes": Object {
|
||||||
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
||||||
|
@ -862,6 +914,45 @@ Object {
|
||||||
"type": "ISSUE",
|
"type": "ISSUE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/1\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/1",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/2\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/2",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/6\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/6",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"nodes": Object {
|
"nodes": Object {
|
||||||
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
||||||
|
@ -1217,6 +1308,19 @@ Object {
|
||||||
"type": "ISSUE",
|
"type": "ISSUE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/2\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/2",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"nodes": Object {
|
"nodes": Object {
|
||||||
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
"{\\"id\\":\\"https://github.com/decentralion\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHOR\\"}": Object {
|
||||||
|
@ -2010,6 +2114,123 @@ Object {
|
||||||
"type": "PULL_REQUEST",
|
"type": "PULL_REQUEST",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/1\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/1",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/2\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/2",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/4\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/4",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/6\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/6",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/7\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/7",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/issues/8\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"ISSUE\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/issues/8",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "ISSUE",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/3\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/pull/3",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "PULL_REQUEST",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/pull/5",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "PULL_REQUEST",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"REPOSITORY\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/9\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"CONTAINS\\"}": Object {
|
||||||
|
"dst": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github/pull/9",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "PULL_REQUEST",
|
||||||
|
},
|
||||||
|
"payload": Object {},
|
||||||
|
"src": Object {
|
||||||
|
"id": "https://github.com/sourcecred/example-github",
|
||||||
|
"pluginName": "sourcecred/github-beta",
|
||||||
|
"type": "REPOSITORY",
|
||||||
|
},
|
||||||
|
},
|
||||||
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/wchargin\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"AUTHOR\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5#discussion_r171460198\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST_REVIEW_COMMENT\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHORS\\"}": Object {
|
"{\\"id\\":\\"[{\\\\\\"id\\\\\\":\\\\\\"https://github.com/wchargin\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"AUTHOR\\\\\\"},{\\\\\\"id\\\\\\":\\\\\\"https://github.com/sourcecred/example-github/pull/5#discussion_r171460198\\\\\\",\\\\\\"pluginName\\\\\\":\\\\\\"sourcecred/github-beta\\\\\\",\\\\\\"type\\\\\\":\\\\\\"PULL_REQUEST_REVIEW_COMMENT\\\\\\"}]\\",\\"pluginName\\":\\"sourcecred/github-beta\\",\\"type\\":\\"AUTHORS\\"}": Object {
|
||||||
"dst": Object {
|
"dst": Object {
|
||||||
"id": "https://github.com/wchargin",
|
"id": "https://github.com/wchargin",
|
||||||
|
|
|
@ -166,9 +166,14 @@ class GithubParser {
|
||||||
|
|
||||||
addContainment(
|
addContainment(
|
||||||
parentNode: Node<
|
parentNode: Node<
|
||||||
IssueNodePayload | PullRequestNodePayload | PullRequestReviewNodePayload
|
| IssueNodePayload
|
||||||
|
| PullRequestNodePayload
|
||||||
|
| PullRequestReviewNodePayload
|
||||||
|
| RepositoryNodePayload
|
||||||
>,
|
>,
|
||||||
childNode: Node<
|
childNode: Node<
|
||||||
|
| IssueNodePayload
|
||||||
|
| PullRequestNodePayload
|
||||||
| CommentNodePayload
|
| CommentNodePayload
|
||||||
| PullRequestReviewCommentNodePayload
|
| PullRequestReviewCommentNodePayload
|
||||||
| PullRequestReviewNodePayload
|
| PullRequestReviewNodePayload
|
||||||
|
@ -187,7 +192,7 @@ class GithubParser {
|
||||||
this.graph.addEdge(containsEdge);
|
this.graph.addEdge(containsEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
addIssue(issueJson: IssueJSON) {
|
addIssue(repoNode: Node<RepositoryNodePayload>, issueJson: IssueJSON) {
|
||||||
const issuePayload: IssueNodePayload = {
|
const issuePayload: IssueNodePayload = {
|
||||||
url: issueJson.url,
|
url: issueJson.url,
|
||||||
number: issueJson.number,
|
number: issueJson.number,
|
||||||
|
@ -201,11 +206,15 @@ class GithubParser {
|
||||||
this.graph.addNode(issueNode);
|
this.graph.addNode(issueNode);
|
||||||
|
|
||||||
this.addAuthorship(issueNode, issueJson.author);
|
this.addAuthorship(issueNode, issueJson.author);
|
||||||
|
this.addContainment(repoNode, issueNode);
|
||||||
|
|
||||||
issueJson.comments.nodes.forEach((c) => this.addComment(issueNode, c));
|
issueJson.comments.nodes.forEach((c) => this.addComment(issueNode, c));
|
||||||
}
|
}
|
||||||
|
|
||||||
addPullRequest(prJson: PullRequestJSON) {
|
addPullRequest(
|
||||||
|
repoNode: Node<RepositoryNodePayload>,
|
||||||
|
prJson: PullRequestJSON
|
||||||
|
) {
|
||||||
const pullRequestPayload: PullRequestNodePayload = {
|
const pullRequestPayload: PullRequestNodePayload = {
|
||||||
url: prJson.url,
|
url: prJson.url,
|
||||||
number: prJson.number,
|
number: prJson.number,
|
||||||
|
@ -219,6 +228,7 @@ class GithubParser {
|
||||||
this.graph.addNode(pullRequestNode);
|
this.graph.addNode(pullRequestNode);
|
||||||
|
|
||||||
this.addAuthorship(pullRequestNode, prJson.author);
|
this.addAuthorship(pullRequestNode, prJson.author);
|
||||||
|
this.addContainment(repoNode, pullRequestNode);
|
||||||
prJson.comments.nodes.forEach((c) => this.addComment(pullRequestNode, c));
|
prJson.comments.nodes.forEach((c) => this.addComment(pullRequestNode, c));
|
||||||
|
|
||||||
prJson.reviews.nodes.forEach((r) =>
|
prJson.reviews.nodes.forEach((r) =>
|
||||||
|
@ -338,8 +348,12 @@ class GithubParser {
|
||||||
payload: repositoryPayload,
|
payload: repositoryPayload,
|
||||||
};
|
};
|
||||||
this.graph.addNode(repositoryNode);
|
this.graph.addNode(repositoryNode);
|
||||||
repositoryJSON.issues.nodes.forEach((i) => this.addIssue(i));
|
repositoryJSON.issues.nodes.forEach((issue) =>
|
||||||
repositoryJSON.pullRequests.nodes.forEach((pr) => this.addPullRequest(pr));
|
this.addIssue(repositoryNode, issue)
|
||||||
|
);
|
||||||
|
repositoryJSON.pullRequests.nodes.forEach((pr) =>
|
||||||
|
this.addPullRequest(repositoryNode, pr)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addData(dataJson: GithubResponseJSON) {
|
addData(dataJson: GithubResponseJSON) {
|
||||||
|
|
|
@ -172,22 +172,19 @@ export class Repository extends GithubEntity<RepositoryNodePayload> {
|
||||||
assertEntityType(e, REPOSITORY_NODE_TYPE);
|
assertEntityType(e, REPOSITORY_NODE_TYPE);
|
||||||
return (e: any);
|
return (e: any);
|
||||||
}
|
}
|
||||||
// TODO: Now that the Repository is a node in the graph, re-write methods
|
|
||||||
// that find issues and PRs to find neighbors of the repository rather than
|
|
||||||
// any matching nodes in the graph. Then, behavior will be correct in the
|
|
||||||
// case where we have multiple repositories in the same graph.
|
|
||||||
issueOrPRByNumber(number: number): ?(Issue | PullRequest) {
|
issueOrPRByNumber(number: number): ?(Issue | PullRequest) {
|
||||||
let result: Issue | PullRequest;
|
let result: Issue | PullRequest;
|
||||||
this.graph.nodes({type: ISSUE_NODE_TYPE}).forEach((n) => {
|
this.graph
|
||||||
if (n.payload.number === number) {
|
.neighborhood(this.nodeAddress, {
|
||||||
result = new Issue(this.graph, n.address);
|
edgeType: CONTAINS_EDGE_TYPE,
|
||||||
}
|
})
|
||||||
});
|
.forEach(({neighbor}) => {
|
||||||
this.graph.nodes({type: PULL_REQUEST_NODE_TYPE}).forEach((n) => {
|
const payload = this.graph.node(neighbor).payload;
|
||||||
if (n.payload.number === number) {
|
if (payload.number === number) {
|
||||||
result = new PullRequest(this.graph, n.address);
|
result = (asEntity(this.graph, neighbor): any);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,14 +198,22 @@ export class Repository extends GithubEntity<RepositoryNodePayload> {
|
||||||
|
|
||||||
issues(): Issue[] {
|
issues(): Issue[] {
|
||||||
return this.graph
|
return this.graph
|
||||||
.nodes({type: ISSUE_NODE_TYPE})
|
.neighborhood(this.nodeAddress, {
|
||||||
.map((n) => new Issue(this.graph, n.address));
|
direction: "OUT",
|
||||||
|
edgeType: CONTAINS_EDGE_TYPE,
|
||||||
|
nodeType: ISSUE_NODE_TYPE,
|
||||||
|
})
|
||||||
|
.map(({neighbor}) => new Issue(this.graph, neighbor));
|
||||||
}
|
}
|
||||||
|
|
||||||
pullRequests(): PullRequest[] {
|
pullRequests(): PullRequest[] {
|
||||||
return this.graph
|
return this.graph
|
||||||
.nodes({type: PULL_REQUEST_NODE_TYPE})
|
.neighborhood(this.nodeAddress, {
|
||||||
.map((n) => new PullRequest(this.graph, n.address));
|
direction: "OUT",
|
||||||
|
edgeType: CONTAINS_EDGE_TYPE,
|
||||||
|
nodeType: PULL_REQUEST_NODE_TYPE,
|
||||||
|
})
|
||||||
|
.map(({neighbor}) => new PullRequest(this.graph, neighbor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue