Detect references to commits (#833)
Now that #832 gave us logic to parse references to commits, we have the RelationalView find and add these references. The actual change is a simple extension of existing reference detection logic. Test plan: Observe that the snapshots are updated with references to commits from the example-github repository. Progress on #815.
This commit is contained in:
parent
c616ec82fb
commit
aecf64b026
|
@ -1,6 +1,7 @@
|
|||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
- Detect references to commits (#833)
|
||||
- Detect references in commit messages (#829)
|
||||
- Add commit authorship to the graph (#826)
|
||||
- Add `MentionsAuthor` edges to the graph (#808)
|
||||
|
|
|
@ -1669,6 +1669,48 @@ Array [
|
|||
"dstIndex": 30,
|
||||
"srcIndex": 26,
|
||||
},
|
||||
Object {
|
||||
"address": Array [
|
||||
"sourcecred",
|
||||
"github",
|
||||
"REFERENCES",
|
||||
"6",
|
||||
"sourcecred",
|
||||
"github",
|
||||
"ISSUE",
|
||||
"sourcecred",
|
||||
"example-github",
|
||||
"12",
|
||||
"4",
|
||||
"sourcecred",
|
||||
"git",
|
||||
"COMMIT",
|
||||
"ec91adb718a6045b492303f00d8e8beb957dc780",
|
||||
],
|
||||
"dstIndex": 4,
|
||||
"srcIndex": 28,
|
||||
},
|
||||
Object {
|
||||
"address": Array [
|
||||
"sourcecred",
|
||||
"github",
|
||||
"REFERENCES",
|
||||
"6",
|
||||
"sourcecred",
|
||||
"github",
|
||||
"ISSUE",
|
||||
"sourcecred",
|
||||
"example-github",
|
||||
"12",
|
||||
"4",
|
||||
"sourcecred",
|
||||
"git",
|
||||
"COMMIT",
|
||||
"ecc889dc94cf6da17ae6eab5bb7b7155f577519d",
|
||||
],
|
||||
"dstIndex": 5,
|
||||
"srcIndex": 28,
|
||||
},
|
||||
Object {
|
||||
"address": Array [
|
||||
"sourcecred",
|
||||
|
|
|
@ -299,6 +299,14 @@ Array [
|
|||
"from": "https://github.com/sourcecred/example-github/issues/10",
|
||||
"to": "https://github.com/sourcecred/example-github/issues/2",
|
||||
},
|
||||
Object {
|
||||
"from": "https://github.com/sourcecred/example-github/issues/12",
|
||||
"to": "https://github.com/sourcecred/example-github/commit/ec91adb718a6045b492303f00d8e8beb957dc780",
|
||||
},
|
||||
Object {
|
||||
"from": "https://github.com/sourcecred/example-github/issues/12",
|
||||
"to": "https://github.com/sourcecred/example-github/commit/ecc889dc94cf6da17ae6eab5bb7b7155f577519d",
|
||||
},
|
||||
Object {
|
||||
"from": "https://github.com/sourcecred/example-github/pull/5",
|
||||
"to": "https://github.com/wchargin",
|
||||
|
|
|
@ -217,6 +217,7 @@ export class GraphView {
|
|||
GN.Prefix.review,
|
||||
GN.Prefix.comment,
|
||||
GN.Prefix.userlike,
|
||||
GitNode.Prefix.commit,
|
||||
]
|
||||
),
|
||||
srcAccessor: (x) => GN.toRaw((x: any).referrer),
|
||||
|
|
|
@ -102,6 +102,7 @@ export type ReferentAddress =
|
|||
| PullAddress
|
||||
| ReviewAddress
|
||||
| CommentAddress
|
||||
| GitNode.CommitAddress
|
||||
| UserlikeAddress;
|
||||
|
||||
// Each of these types is structurally the child of some
|
||||
|
|
|
@ -211,6 +211,7 @@ export class RelationalView {
|
|||
yield* this.pulls();
|
||||
yield* this.reviews();
|
||||
yield* this.comments();
|
||||
yield* this.commits();
|
||||
yield* this.userlikes();
|
||||
}
|
||||
|
||||
|
@ -463,6 +464,9 @@ export class RelationalView {
|
|||
a
|
||||
);
|
||||
}
|
||||
if (e instanceof Commit) {
|
||||
refToAddress.set(e.address().hash, a);
|
||||
}
|
||||
}
|
||||
for (const e of this.textContentEntities()) {
|
||||
const srcAddress = e.address();
|
||||
|
@ -589,6 +593,9 @@ export class RelationalView {
|
|||
case "COMMENT":
|
||||
entity = this.comment(address);
|
||||
break;
|
||||
case "COMMIT":
|
||||
entity = this.commit(address);
|
||||
break;
|
||||
case "USERLIKE":
|
||||
entity = this.userlike(address);
|
||||
break;
|
||||
|
@ -882,6 +889,9 @@ export class Commit extends _Entity<CommitEntry> {
|
|||
references(): Iterator<ReferentEntity> {
|
||||
return this._view._references(this);
|
||||
}
|
||||
referencedBy(): Iterator<TextContentEntity> {
|
||||
return this._view._referencedBy(this);
|
||||
}
|
||||
}
|
||||
|
||||
type UserlikeEntry = {|
|
||||
|
@ -959,7 +969,14 @@ export type AuthoredEntity = Issue | Pull | Review | Comment | Commit;
|
|||
export type TextContentEntity = Issue | Pull | Review | Comment | Commit;
|
||||
export type ParentEntity = Repo | Issue | Pull | Review;
|
||||
export type ChildEntity = Issue | Pull | Review | Comment;
|
||||
export type ReferentEntity = Repo | Issue | Pull | Review | Comment | Userlike;
|
||||
export type ReferentEntity =
|
||||
| Repo
|
||||
| Issue
|
||||
| Pull
|
||||
| Review
|
||||
| Comment
|
||||
| Commit
|
||||
| Userlike;
|
||||
|
||||
export opaque type AddressEntryMapJSON<T> = {[N.RawAddress]: T};
|
||||
export opaque type RelationalViewJSON = Compatible<{|
|
||||
|
|
Loading…
Reference in New Issue