feat(proto): expose issue to merge request references and closed_by_merge_request on issues
3 files · +269 -129
M docs/services.md +1 -1
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | |
| 7 | 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | |
| 8 | 8 | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`. Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | |
| 9 | - | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Feature `issues`. Issues share numbers with merge requests | | |
| 9 | + | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments, merge requests naming the issue, `closed_by_merge_request`), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Features `issues`, `issues.links`. Issues share numbers with merge requests | | |
| 10 | 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | |
| 11 | 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | |
| 12 | 12 | | `ServerService` | `GetVersion` (version and features), `GetSigningKey`, `RotateOIDCKey` (owner only) | | |
| @@ -6,7 +6,7 @@ | |||||
| 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | ||
| 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | 7 | | `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` | | ||
| 8 | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`. Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | 8 | | `MergeRequestService` | `CreateMergeRequest`, `ListMergeRequests`, `GetMergeRequest` (commits, diff, comments), `AddComment`, `EditComment`, `DeleteComment`, `ResolveComment`, `CloseMergeRequest`, `MergeMergeRequest` (modes fast-forward, squash, merge commit), `MarkRead`. Open merge requests carry `mergeability` (up to date, behind, conflict, or checking) and `Watch` publishes `MergeRequestMergeability` each time a result is settled for new branch tips (feature `merge_requests.mergeability`) | | ||
| 9 | - | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Feature `issues`. Issues share numbers with merge requests | | 9 | + | | `IssueService` | `CreateIssue`, `ListIssues`, `GetIssue` (comments, merge requests naming the issue, `closed_by_merge_request`), `AddIssueComment`, `CloseIssue`, `ReopenIssue`; owner only: `ListPendingIssues`, `ApproveIssue`, `RejectIssue`. Features `issues`, `issues.links`. Issues share numbers with merge requests | |
| 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | 10 | | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) | | ||
| 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | 11 | | `EventService` | `Watch` (streamed, resumable). Topics `home`, `repo:<name>` and `owner` (owner rights only). Events 17–21: `issue_opened`, `issue_closed`, `issue_reopened`, `issue_commented`, and `issue_submitted` (only on `owner`, no content). Event 22: `merge_request_mergeability` | | ||
| 12 | | `ServerService` | `GetVersion` (version and features), `GetSigningKey`, `RotateOIDCKey` (owner only) | | 12 | | `ServerService` | `GetVersion` (version and features), `GetSigningKey`, `RotateOIDCKey` (owner only) | | ||
M gen/ermite/issue.pb.go +239 -128 generated file: collapsed
M proto/ermite/issue.proto +29 -0
| @@ -4,6 +4,7 @@ syntax = "proto3"; | |||
| 4 | 4 | ||
| 5 | 5 | package ermite; | |
| 6 | 6 | ||
| 7 | + | import "ermite/merge_request.proto"; | |
| 7 | 8 | import "google/protobuf/timestamp.proto"; | |
| 8 | 9 | ||
| 9 | 10 | // IssueState is where an issue is in its life. | |
| @@ -44,6 +45,24 @@ message Issue { | |||
| 44 | 45 | google.protobuf.Timestamp updated_at = 8; | |
| 45 | 46 | // CommentCount is the number of comments on the issue. | |
| 46 | 47 | int32 comment_count = 9; | |
| 48 | + | // ClosedByMergeRequest is the number of the merge request whose merge closed | |
| 49 | + | // the issue (a closing reference such as "Fixes #N"); 0 when the issue was | |
| 50 | + | // closed by hand or is open. Reset when the issue is reopened. | |
| 51 | + | int64 closed_by_merge_request = 10; | |
| 52 | + | } | |
| 53 | + | ||
| 54 | + | // IssueReference is a merge request of the same repository that names the | |
| 55 | + | // issue ("#N") in its title, description, notes or commit messages. | |
| 56 | + | message IssueReference { | |
| 57 | + | // Number is the number of the merge request. | |
| 58 | + | int64 number = 1; | |
| 59 | + | // Title is the title of the merge request. | |
| 60 | + | string title = 2; | |
| 61 | + | // State is where the merge request is in its life. | |
| 62 | + | MergeRequestState state = 3; | |
| 63 | + | // Closes says that a closing reference ("Fixes #N") names the issue: | |
| 64 | + | // merging the request closes it. | |
| 65 | + | bool closes = 4; | |
| 47 | 66 | } | |
| 48 | 67 | ||
| 49 | 68 | // IssueComment is a note on an issue. | |
| @@ -73,6 +92,13 @@ message IssueComment { | |||
| 73 | 92 | // unauthenticated, one with an insufficient scope gets permission_denied, and | |
| 74 | 93 | // one that cannot read the repository gets not_found. | |
| 75 | 94 | // | |
| 95 | + | // A closing reference ("Fixes #N", "Closes #N", "Resolves #N") in the title, | |
| 96 | + | // description or commit messages of a merge request closes the issue when the | |
| 97 | + | // request is merged, and only then; the issue.closed event and Issue carry | |
| 98 | + | // closed_by_merge_request. Servers that report these links (GetIssueResponse. | |
| 99 | + | // references, Issue.closed_by_merge_request) list "issues.links" in | |
| 100 | + | // GetVersionResponse.features; older servers leave them empty. | |
| 101 | + | // | |
| 76 | 102 | // Text fields are normalized to NFC and stripped of control and Unicode | |
| 77 | 103 | // bidirectional characters (line breaks and tabs stay in bodies and comments). | |
| 78 | 104 | // The title is one line of 1 to 120 code points; body and comment text are at | |
| @@ -167,6 +193,9 @@ message GetIssueResponse { | |||
| 167 | 193 | Issue issue = 1; | |
| 168 | 194 | // Comments are every comment of the issue, oldest first. | |
| 169 | 195 | repeated IssueComment comments = 2; | |
| 196 | + | // References are the merge requests naming the issue, ascending by number, | |
| 197 | + | // at most 100. | |
| 198 | + | repeated IssueReference references = 3; | |
| 170 | 199 | } | |
| 171 | 200 | ||
| 172 | 201 | // AddIssueCommentRequest describes the comment to add. | |
| @@ -4,6 +4,7 @@ syntax = "proto3"; | |||||
| 4 | 4 | ||||
| 5 | package ermite; | 5 | package ermite; | ||
| 6 | 6 | ||||
| 7 | + | import "ermite/merge_request.proto"; | |||
| 7 | import "google/protobuf/timestamp.proto"; | 8 | import "google/protobuf/timestamp.proto"; | ||
| 8 | 9 | ||||
| 9 | // IssueState is where an issue is in its life. | 10 | // IssueState is where an issue is in its life. | ||
| @@ -44,6 +45,24 @@ message Issue { | |||||
| 44 | google.protobuf.Timestamp updated_at = 8; | 45 | google.protobuf.Timestamp updated_at = 8; | ||
| 45 | // CommentCount is the number of comments on the issue. | 46 | // CommentCount is the number of comments on the issue. | ||
| 46 | int32 comment_count = 9; | 47 | int32 comment_count = 9; | ||
| 48 | + | // ClosedByMergeRequest is the number of the merge request whose merge closed | |||
| 49 | + | // the issue (a closing reference such as "Fixes #N"); 0 when the issue was | |||
| 50 | + | // closed by hand or is open. Reset when the issue is reopened. | |||
| 51 | + | int64 closed_by_merge_request = 10; | |||
| 52 | + | } | |||
| 53 | + | ||||
| 54 | + | // IssueReference is a merge request of the same repository that names the | |||
| 55 | + | // issue ("#N") in its title, description, notes or commit messages. | |||
| 56 | + | message IssueReference { | |||
| 57 | + | // Number is the number of the merge request. | |||
| 58 | + | int64 number = 1; | |||
| 59 | + | // Title is the title of the merge request. | |||
| 60 | + | string title = 2; | |||
| 61 | + | // State is where the merge request is in its life. | |||
| 62 | + | MergeRequestState state = 3; | |||
| 63 | + | // Closes says that a closing reference ("Fixes #N") names the issue: | |||
| 64 | + | // merging the request closes it. | |||
| 65 | + | bool closes = 4; | |||
| 47 | } | 66 | } | ||
| 48 | 67 | ||||
| 49 | // IssueComment is a note on an issue. | 68 | // IssueComment is a note on an issue. | ||
| @@ -73,6 +92,13 @@ message IssueComment { | |||||
| 73 | // unauthenticated, one with an insufficient scope gets permission_denied, and | 92 | // unauthenticated, one with an insufficient scope gets permission_denied, and | ||
| 74 | // one that cannot read the repository gets not_found. | 93 | // one that cannot read the repository gets not_found. | ||
| 75 | // | 94 | // | ||
| 95 | + | // A closing reference ("Fixes #N", "Closes #N", "Resolves #N") in the title, | |||
| 96 | + | // description or commit messages of a merge request closes the issue when the | |||
| 97 | + | // request is merged, and only then; the issue.closed event and Issue carry | |||
| 98 | + | // closed_by_merge_request. Servers that report these links (GetIssueResponse. | |||
| 99 | + | // references, Issue.closed_by_merge_request) list "issues.links" in | |||
| 100 | + | // GetVersionResponse.features; older servers leave them empty. | |||
| 101 | + | // | |||
| 76 | // Text fields are normalized to NFC and stripped of control and Unicode | 102 | // Text fields are normalized to NFC and stripped of control and Unicode | ||
| 77 | // bidirectional characters (line breaks and tabs stay in bodies and comments). | 103 | // bidirectional characters (line breaks and tabs stay in bodies and comments). | ||
| 78 | // The title is one line of 1 to 120 code points; body and comment text are at | 104 | // The title is one line of 1 to 120 code points; body and comment text are at | ||
| @@ -167,6 +193,9 @@ message GetIssueResponse { | |||||
| 167 | Issue issue = 1; | 193 | Issue issue = 1; | ||
| 168 | // Comments are every comment of the issue, oldest first. | 194 | // Comments are every comment of the issue, oldest first. | ||
| 169 | repeated IssueComment comments = 2; | 195 | repeated IssueComment comments = 2; | ||
| 196 | + | // References are the merge requests naming the issue, ascending by number, | |||
| 197 | + | // at most 100. | |||
| 198 | + | repeated IssueReference references = 3; | |||
| 170 | } | 199 | } | ||
| 171 | 200 | ||||
| 172 | // AddIssueCommentRequest describes the comment to add. | 201 | // AddIssueCommentRequest describes the comment to add. | ||