Merge f9976e7ef950a413ab4cb985f1b850caf1c8c8cf into b97dc8626c51d183d4f3373be9b3fd8f6b155755
11 files · +1061 -307
M docs/services.md +1 -1
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | |
| 6 | 6 | | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` | | |
| 7 | 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`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). 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 | 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` | | |
| @@ -5,7 +5,7 @@ | |||||
| 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | 5 | | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` | | ||
| 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`, `EnableAutoMerge`, `CancelAutoMerge` (merge by itself once a check passed on the head and all its runs are complete; setting `allow_auto_merge`, `MergeRequest.auto_merge`, events `MergeRequestAutoMergeEnabled` and `MergeRequestAutoMergeCancelled`, `MergeRequestMerged.auto`; feature `merge_requests.auto_merge`). 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, 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 | | 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` | | ||
M gen/ermite/ermiteconnect/merge_request.connect.go +100 -0
| @@ -62,6 +62,12 @@ const ( | |||
| 62 | 62 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | |
| 63 | 63 | // MergeRequestService's MergeMergeRequest RPC. | |
| 64 | 64 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | |
| 65 | + | // MergeRequestServiceEnableAutoMergeProcedure is the fully-qualified name of the | |
| 66 | + | // MergeRequestService's EnableAutoMerge RPC. | |
| 67 | + | MergeRequestServiceEnableAutoMergeProcedure = "/ermite.MergeRequestService/EnableAutoMerge" | |
| 68 | + | // MergeRequestServiceCancelAutoMergeProcedure is the fully-qualified name of the | |
| 69 | + | // MergeRequestService's CancelAutoMerge RPC. | |
| 70 | + | MergeRequestServiceCancelAutoMergeProcedure = "/ermite.MergeRequestService/CancelAutoMerge" | |
| 65 | 71 | // MergeRequestServiceMarkReadProcedure is the fully-qualified name of the MergeRequestService's | |
| 66 | 72 | // MarkRead RPC. | |
| 67 | 73 | MergeRequestServiceMarkReadProcedure = "/ermite.MergeRequestService/MarkRead" | |
| @@ -137,6 +143,29 @@ type MergeRequestServiceClient interface { | |||
| 137 | 143 | // failed_precondition (not open). On success the server publishes | |
| 138 | 144 | // MergeRequestMerged then Pushed for the target branch. | |
| 139 | 145 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | |
| 146 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 147 | + | // once at least one check passed on its head, every run created on that head | |
| 148 | + | // is complete, and the merge would be accepted whatever | |
| 149 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 150 | + | // token limited to branches, write access to the target branch | |
| 151 | + | // (permission_denied otherwise). The server records the caller, the mode and | |
| 152 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 153 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 154 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |
| 155 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |
| 156 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |
| 157 | + | // merge request is not open, if the source branch no longer points to head_id | |
| 158 | + | // ("branch moved, read again"), is a draft, | |
| 159 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 160 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 161 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| 162 | + | // "merge_requests.auto_merge" feature. | |
| 163 | + | EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) | |
| 164 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |
| 165 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |
| 166 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |
| 167 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |
| 168 | + | CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) | |
| 140 | 169 | // MarkRead records the head the caller has reviewed, for the since_last_read | |
| 141 | 170 | // option of GetMergeRequest. There is one read position per merge request, | |
| 142 | 171 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | |
| @@ -209,6 +238,18 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string, | |||
| 209 | 238 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | |
| 210 | 239 | connect.WithClientOptions(opts...), | |
| 211 | 240 | ), | |
| 241 | + | enableAutoMerge: connect.NewClient[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse]( | |
| 242 | + | httpClient, | |
| 243 | + | baseURL+MergeRequestServiceEnableAutoMergeProcedure, | |
| 244 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")), | |
| 245 | + | connect.WithClientOptions(opts...), | |
| 246 | + | ), | |
| 247 | + | cancelAutoMerge: connect.NewClient[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse]( | |
| 248 | + | httpClient, | |
| 249 | + | baseURL+MergeRequestServiceCancelAutoMergeProcedure, | |
| 250 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")), | |
| 251 | + | connect.WithClientOptions(opts...), | |
| 252 | + | ), | |
| 212 | 253 | markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse]( | |
| 213 | 254 | httpClient, | |
| 214 | 255 | baseURL+MergeRequestServiceMarkReadProcedure, | |
| @@ -229,6 +270,8 @@ type mergeRequestServiceClient struct { | |||
| 229 | 270 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | |
| 230 | 271 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | |
| 231 | 272 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | |
| 273 | + | enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse] | |
| 274 | + | cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse] | |
| 232 | 275 | markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse] | |
| 233 | 276 | } | |
| 234 | 277 | ||
| @@ -277,6 +320,16 @@ func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req * | |||
| 277 | 320 | return c.mergeMergeRequest.CallUnary(ctx, req) | |
| 278 | 321 | } | |
| 279 | 322 | ||
| 323 | + | // EnableAutoMerge calls ermite.MergeRequestService.EnableAutoMerge. | |
| 324 | + | func (c *mergeRequestServiceClient) EnableAutoMerge(ctx context.Context, req *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) { | |
| 325 | + | return c.enableAutoMerge.CallUnary(ctx, req) | |
| 326 | + | } | |
| 327 | + | ||
| 328 | + | // CancelAutoMerge calls ermite.MergeRequestService.CancelAutoMerge. | |
| 329 | + | func (c *mergeRequestServiceClient) CancelAutoMerge(ctx context.Context, req *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) { | |
| 330 | + | return c.cancelAutoMerge.CallUnary(ctx, req) | |
| 331 | + | } | |
| 332 | + | ||
| 280 | 333 | // MarkRead calls ermite.MergeRequestService.MarkRead. | |
| 281 | 334 | func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | |
| 282 | 335 | return c.markRead.CallUnary(ctx, req) | |
| @@ -352,6 +405,29 @@ type MergeRequestServiceHandler interface { | |||
| 352 | 405 | // failed_precondition (not open). On success the server publishes | |
| 353 | 406 | // MergeRequestMerged then Pushed for the target branch. | |
| 354 | 407 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | |
| 408 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 409 | + | // once at least one check passed on its head, every run created on that head | |
| 410 | + | // is complete, and the merge would be accepted whatever | |
| 411 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 412 | + | // token limited to branches, write access to the target branch | |
| 413 | + | // (permission_denied otherwise). The server records the caller, the mode and | |
| 414 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 415 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 416 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |
| 417 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |
| 418 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |
| 419 | + | // merge request is not open, if the source branch no longer points to head_id | |
| 420 | + | // ("branch moved, read again"), is a draft, | |
| 421 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 422 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 423 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| 424 | + | // "merge_requests.auto_merge" feature. | |
| 425 | + | EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) | |
| 426 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |
| 427 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |
| 428 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |
| 429 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |
| 430 | + | CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) | |
| 355 | 431 | // MarkRead records the head the caller has reviewed, for the since_last_read | |
| 356 | 432 | // option of GetMergeRequest. There is one read position per merge request, | |
| 357 | 433 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | |
| @@ -420,6 +496,18 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||
| 420 | 496 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | |
| 421 | 497 | connect.WithHandlerOptions(opts...), | |
| 422 | 498 | ) | |
| 499 | + | mergeRequestServiceEnableAutoMergeHandler := connect.NewUnaryHandler( | |
| 500 | + | MergeRequestServiceEnableAutoMergeProcedure, | |
| 501 | + | svc.EnableAutoMerge, | |
| 502 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")), | |
| 503 | + | connect.WithHandlerOptions(opts...), | |
| 504 | + | ) | |
| 505 | + | mergeRequestServiceCancelAutoMergeHandler := connect.NewUnaryHandler( | |
| 506 | + | MergeRequestServiceCancelAutoMergeProcedure, | |
| 507 | + | svc.CancelAutoMerge, | |
| 508 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")), | |
| 509 | + | connect.WithHandlerOptions(opts...), | |
| 510 | + | ) | |
| 423 | 511 | mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler( | |
| 424 | 512 | MergeRequestServiceMarkReadProcedure, | |
| 425 | 513 | svc.MarkRead, | |
| @@ -446,6 +534,10 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||
| 446 | 534 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | |
| 447 | 535 | case MergeRequestServiceMergeMergeRequestProcedure: | |
| 448 | 536 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | |
| 537 | + | case MergeRequestServiceEnableAutoMergeProcedure: | |
| 538 | + | mergeRequestServiceEnableAutoMergeHandler.ServeHTTP(w, r) | |
| 539 | + | case MergeRequestServiceCancelAutoMergeProcedure: | |
| 540 | + | mergeRequestServiceCancelAutoMergeHandler.ServeHTTP(w, r) | |
| 449 | 541 | case MergeRequestServiceMarkReadProcedure: | |
| 450 | 542 | mergeRequestServiceMarkReadHandler.ServeHTTP(w, r) | |
| 451 | 543 | default: | |
| @@ -493,6 +585,14 @@ func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context | |||
| 493 | 585 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | |
| 494 | 586 | } | |
| 495 | 587 | ||
| 588 | + | func (UnimplementedMergeRequestServiceHandler) EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) { | |
| 589 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.EnableAutoMerge is not implemented")) | |
| 590 | + | } | |
| 591 | + | ||
| 592 | + | func (UnimplementedMergeRequestServiceHandler) CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) { | |
| 593 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CancelAutoMerge is not implemented")) | |
| 594 | + | } | |
| 595 | + | ||
| 496 | 596 | func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | |
| 497 | 597 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented")) | |
| 498 | 598 | } | |
| @@ -62,6 +62,12 @@ const ( | |||||
| 62 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | 62 | // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the | ||
| 63 | // MergeRequestService's MergeMergeRequest RPC. | 63 | // MergeRequestService's MergeMergeRequest RPC. | ||
| 64 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | 64 | MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" | ||
| 65 | + | // MergeRequestServiceEnableAutoMergeProcedure is the fully-qualified name of the | |||
| 66 | + | // MergeRequestService's EnableAutoMerge RPC. | |||
| 67 | + | MergeRequestServiceEnableAutoMergeProcedure = "/ermite.MergeRequestService/EnableAutoMerge" | |||
| 68 | + | // MergeRequestServiceCancelAutoMergeProcedure is the fully-qualified name of the | |||
| 69 | + | // MergeRequestService's CancelAutoMerge RPC. | |||
| 70 | + | MergeRequestServiceCancelAutoMergeProcedure = "/ermite.MergeRequestService/CancelAutoMerge" | |||
| 65 | // MergeRequestServiceMarkReadProcedure is the fully-qualified name of the MergeRequestService's | 71 | // MergeRequestServiceMarkReadProcedure is the fully-qualified name of the MergeRequestService's | ||
| 66 | // MarkRead RPC. | 72 | // MarkRead RPC. | ||
| 67 | MergeRequestServiceMarkReadProcedure = "/ermite.MergeRequestService/MarkRead" | 73 | MergeRequestServiceMarkReadProcedure = "/ermite.MergeRequestService/MarkRead" | ||
| @@ -137,6 +143,29 @@ type MergeRequestServiceClient interface { | |||||
| 137 | // failed_precondition (not open). On success the server publishes | 143 | // failed_precondition (not open). On success the server publishes | ||
| 138 | // MergeRequestMerged then Pushed for the target branch. | 144 | // MergeRequestMerged then Pushed for the target branch. | ||
| 139 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | 145 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | ||
| 146 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |||
| 147 | + | // once at least one check passed on its head, every run created on that head | |||
| 148 | + | // is complete, and the merge would be accepted whatever | |||
| 149 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |||
| 150 | + | // token limited to branches, write access to the target branch | |||
| 151 | + | // (permission_denied otherwise). The server records the caller, the mode and | |||
| 152 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |||
| 153 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |||
| 154 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |||
| 155 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |||
| 156 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |||
| 157 | + | // merge request is not open, if the source branch no longer points to head_id | |||
| 158 | + | // ("branch moved, read again"), is a draft, | |||
| 159 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |||
| 160 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |||
| 161 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |||
| 162 | + | // "merge_requests.auto_merge" feature. | |||
| 163 | + | EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) | |||
| 164 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |||
| 165 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |||
| 166 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |||
| 167 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |||
| 168 | + | CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) | |||
| 140 | // MarkRead records the head the caller has reviewed, for the since_last_read | 169 | // MarkRead records the head the caller has reviewed, for the since_last_read | ||
| 141 | // option of GetMergeRequest. There is one read position per merge request, | 170 | // option of GetMergeRequest. There is one read position per merge request, | ||
| 142 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | 171 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | ||
| @@ -209,6 +238,18 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string, | |||||
| 209 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | 238 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | ||
| 210 | connect.WithClientOptions(opts...), | 239 | connect.WithClientOptions(opts...), | ||
| 211 | ), | 240 | ), | ||
| 241 | + | enableAutoMerge: connect.NewClient[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse]( | |||
| 242 | + | httpClient, | |||
| 243 | + | baseURL+MergeRequestServiceEnableAutoMergeProcedure, | |||
| 244 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")), | |||
| 245 | + | connect.WithClientOptions(opts...), | |||
| 246 | + | ), | |||
| 247 | + | cancelAutoMerge: connect.NewClient[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse]( | |||
| 248 | + | httpClient, | |||
| 249 | + | baseURL+MergeRequestServiceCancelAutoMergeProcedure, | |||
| 250 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")), | |||
| 251 | + | connect.WithClientOptions(opts...), | |||
| 252 | + | ), | |||
| 212 | markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse]( | 253 | markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse]( | ||
| 213 | httpClient, | 254 | httpClient, | ||
| 214 | baseURL+MergeRequestServiceMarkReadProcedure, | 255 | baseURL+MergeRequestServiceMarkReadProcedure, | ||
| @@ -229,6 +270,8 @@ type mergeRequestServiceClient struct { | |||||
| 229 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | 270 | resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] | ||
| 230 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | 271 | closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] | ||
| 231 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | 272 | mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] | ||
| 273 | + | enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse] | |||
| 274 | + | cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse] | |||
| 232 | markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse] | 275 | markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse] | ||
| 233 | } | 276 | } | ||
| 234 | 277 | ||||
| @@ -277,6 +320,16 @@ func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req * | |||||
| 277 | return c.mergeMergeRequest.CallUnary(ctx, req) | 320 | return c.mergeMergeRequest.CallUnary(ctx, req) | ||
| 278 | } | 321 | } | ||
| 279 | 322 | ||||
| 323 | + | // EnableAutoMerge calls ermite.MergeRequestService.EnableAutoMerge. | |||
| 324 | + | func (c *mergeRequestServiceClient) EnableAutoMerge(ctx context.Context, req *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) { | |||
| 325 | + | return c.enableAutoMerge.CallUnary(ctx, req) | |||
| 326 | + | } | |||
| 327 | + | ||||
| 328 | + | // CancelAutoMerge calls ermite.MergeRequestService.CancelAutoMerge. | |||
| 329 | + | func (c *mergeRequestServiceClient) CancelAutoMerge(ctx context.Context, req *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) { | |||
| 330 | + | return c.cancelAutoMerge.CallUnary(ctx, req) | |||
| 331 | + | } | |||
| 332 | + | ||||
| 280 | // MarkRead calls ermite.MergeRequestService.MarkRead. | 333 | // MarkRead calls ermite.MergeRequestService.MarkRead. | ||
| 281 | func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | 334 | func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | ||
| 282 | return c.markRead.CallUnary(ctx, req) | 335 | return c.markRead.CallUnary(ctx, req) | ||
| @@ -352,6 +405,29 @@ type MergeRequestServiceHandler interface { | |||||
| 352 | // failed_precondition (not open). On success the server publishes | 405 | // failed_precondition (not open). On success the server publishes | ||
| 353 | // MergeRequestMerged then Pushed for the target branch. | 406 | // MergeRequestMerged then Pushed for the target branch. | ||
| 354 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | 407 | MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) | ||
| 408 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |||
| 409 | + | // once at least one check passed on its head, every run created on that head | |||
| 410 | + | // is complete, and the merge would be accepted whatever | |||
| 411 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |||
| 412 | + | // token limited to branches, write access to the target branch | |||
| 413 | + | // (permission_denied otherwise). The server records the caller, the mode and | |||
| 414 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |||
| 415 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |||
| 416 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |||
| 417 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |||
| 418 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |||
| 419 | + | // merge request is not open, if the source branch no longer points to head_id | |||
| 420 | + | // ("branch moved, read again"), is a draft, | |||
| 421 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |||
| 422 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |||
| 423 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |||
| 424 | + | // "merge_requests.auto_merge" feature. | |||
| 425 | + | EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) | |||
| 426 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |||
| 427 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |||
| 428 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |||
| 429 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |||
| 430 | + | CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) | |||
| 355 | // MarkRead records the head the caller has reviewed, for the since_last_read | 431 | // MarkRead records the head the caller has reviewed, for the since_last_read | ||
| 356 | // option of GetMergeRequest. There is one read position per merge request, | 432 | // option of GetMergeRequest. There is one read position per merge request, | ||
| 357 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | 433 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | ||
| @@ -420,6 +496,18 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||||
| 420 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | 496 | connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), | ||
| 421 | connect.WithHandlerOptions(opts...), | 497 | connect.WithHandlerOptions(opts...), | ||
| 422 | ) | 498 | ) | ||
| 499 | + | mergeRequestServiceEnableAutoMergeHandler := connect.NewUnaryHandler( | |||
| 500 | + | MergeRequestServiceEnableAutoMergeProcedure, | |||
| 501 | + | svc.EnableAutoMerge, | |||
| 502 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")), | |||
| 503 | + | connect.WithHandlerOptions(opts...), | |||
| 504 | + | ) | |||
| 505 | + | mergeRequestServiceCancelAutoMergeHandler := connect.NewUnaryHandler( | |||
| 506 | + | MergeRequestServiceCancelAutoMergeProcedure, | |||
| 507 | + | svc.CancelAutoMerge, | |||
| 508 | + | connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")), | |||
| 509 | + | connect.WithHandlerOptions(opts...), | |||
| 510 | + | ) | |||
| 423 | mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler( | 511 | mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler( | ||
| 424 | MergeRequestServiceMarkReadProcedure, | 512 | MergeRequestServiceMarkReadProcedure, | ||
| 425 | svc.MarkRead, | 513 | svc.MarkRead, | ||
| @@ -446,6 +534,10 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne | |||||
| 446 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | 534 | mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) | ||
| 447 | case MergeRequestServiceMergeMergeRequestProcedure: | 535 | case MergeRequestServiceMergeMergeRequestProcedure: | ||
| 448 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | 536 | mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) | ||
| 537 | + | case MergeRequestServiceEnableAutoMergeProcedure: | |||
| 538 | + | mergeRequestServiceEnableAutoMergeHandler.ServeHTTP(w, r) | |||
| 539 | + | case MergeRequestServiceCancelAutoMergeProcedure: | |||
| 540 | + | mergeRequestServiceCancelAutoMergeHandler.ServeHTTP(w, r) | |||
| 449 | case MergeRequestServiceMarkReadProcedure: | 541 | case MergeRequestServiceMarkReadProcedure: | ||
| 450 | mergeRequestServiceMarkReadHandler.ServeHTTP(w, r) | 542 | mergeRequestServiceMarkReadHandler.ServeHTTP(w, r) | ||
| 451 | default: | 543 | default: | ||
| @@ -493,6 +585,14 @@ func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context | |||||
| 493 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | 585 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) | ||
| 494 | } | 586 | } | ||
| 495 | 587 | ||||
| 588 | + | func (UnimplementedMergeRequestServiceHandler) EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) { | |||
| 589 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.EnableAutoMerge is not implemented")) | |||
| 590 | + | } | |||
| 591 | + | ||||
| 592 | + | func (UnimplementedMergeRequestServiceHandler) CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) { | |||
| 593 | + | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CancelAutoMerge is not implemented")) | |||
| 594 | + | } | |||
| 595 | + | ||||
| 496 | func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | 596 | func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { | ||
| 497 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented")) | 597 | return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented")) | ||
| 498 | } | 598 | } | ||
M gen/ermite/event.pb.go +296 -133 generated file: collapsed
M gen/ermite/merge_request.pb.go +521 -160 generated file: collapsed
M gen/ermite/repo.pb.go +20 -8 generated file: collapsed
M gen/ermite/server.pb.go +5 -1 generated file: collapsed
M gen_test.go +2 -0
| @@ -54,6 +54,8 @@ func TestProcedures(t *testing.T) { | |||
| 54 | 54 | {ermiteconnect.MergeRequestServiceCloseMergeRequestProcedure, "/ermite.MergeRequestService/CloseMergeRequest"}, | |
| 55 | 55 | {ermiteconnect.MergeRequestServiceMergeMergeRequestProcedure, "/ermite.MergeRequestService/MergeMergeRequest"}, | |
| 56 | 56 | {ermiteconnect.MergeRequestServiceMarkReadProcedure, "/ermite.MergeRequestService/MarkRead"}, | |
| 57 | + | {ermiteconnect.MergeRequestServiceEnableAutoMergeProcedure, "/ermite.MergeRequestService/EnableAutoMerge"}, | |
| 58 | + | {ermiteconnect.MergeRequestServiceCancelAutoMergeProcedure, "/ermite.MergeRequestService/CancelAutoMerge"}, | |
| 57 | 59 | {ermiteconnect.SessionServiceCreateLoginLinkProcedure, "/ermite.SessionService/CreateLoginLink"}, | |
| 58 | 60 | {ermiteconnect.SessionServiceSignOutEverywhereProcedure, "/ermite.SessionService/SignOutEverywhere"}, | |
| 59 | 61 | {ermiteconnect.ServerServiceGetVersionProcedure, "/ermite.ServerService/GetVersion"}, | |
| @@ -54,6 +54,8 @@ func TestProcedures(t *testing.T) { | |||||
| 54 | {ermiteconnect.MergeRequestServiceCloseMergeRequestProcedure, "/ermite.MergeRequestService/CloseMergeRequest"}, | 54 | {ermiteconnect.MergeRequestServiceCloseMergeRequestProcedure, "/ermite.MergeRequestService/CloseMergeRequest"}, | ||
| 55 | {ermiteconnect.MergeRequestServiceMergeMergeRequestProcedure, "/ermite.MergeRequestService/MergeMergeRequest"}, | 55 | {ermiteconnect.MergeRequestServiceMergeMergeRequestProcedure, "/ermite.MergeRequestService/MergeMergeRequest"}, | ||
| 56 | {ermiteconnect.MergeRequestServiceMarkReadProcedure, "/ermite.MergeRequestService/MarkRead"}, | 56 | {ermiteconnect.MergeRequestServiceMarkReadProcedure, "/ermite.MergeRequestService/MarkRead"}, | ||
| 57 | + | {ermiteconnect.MergeRequestServiceEnableAutoMergeProcedure, "/ermite.MergeRequestService/EnableAutoMerge"}, | |||
| 58 | + | {ermiteconnect.MergeRequestServiceCancelAutoMergeProcedure, "/ermite.MergeRequestService/CancelAutoMerge"}, | |||
| 57 | {ermiteconnect.SessionServiceCreateLoginLinkProcedure, "/ermite.SessionService/CreateLoginLink"}, | 59 | {ermiteconnect.SessionServiceCreateLoginLinkProcedure, "/ermite.SessionService/CreateLoginLink"}, | ||
| 58 | {ermiteconnect.SessionServiceSignOutEverywhereProcedure, "/ermite.SessionService/SignOutEverywhere"}, | 60 | {ermiteconnect.SessionServiceSignOutEverywhereProcedure, "/ermite.SessionService/SignOutEverywhere"}, | ||
| 59 | {ermiteconnect.ServerServiceGetVersionProcedure, "/ermite.ServerService/GetVersion"}, | 61 | {ermiteconnect.ServerServiceGetVersionProcedure, "/ermite.ServerService/GetVersion"}, | ||
M proto/ermite/event.proto +23 -0
| @@ -140,6 +140,11 @@ message Event { | |||
| 140 | 140 | MirrorFailed mirror_failed = 23; | |
| 141 | 141 | // MirrorRecovered: a failing or paused mirror succeeded again. | |
| 142 | 142 | MirrorRecovered mirror_recovered = 24; | |
| 143 | + | // MergeRequestAutoMergeEnabled: auto-merge was enabled on a merge request. | |
| 144 | + | MergeRequestAutoMergeEnabled merge_request_auto_merge_enabled = 25; | |
| 145 | + | // MergeRequestAutoMergeCancelled: the auto-merge of a merge request was | |
| 146 | + | // cancelled. | |
| 147 | + | MergeRequestAutoMergeCancelled merge_request_auto_merge_cancelled = 26; | |
| 143 | 148 | } | |
| 144 | 149 | } | |
| 145 | 150 | ||
| @@ -190,6 +195,24 @@ message MergeRequestOpened { | |||
| 190 | 195 | message MergeRequestMerged { | |
| 191 | 196 | // MergeRequest is the merge request after the merge. | |
| 192 | 197 | MergeRequest merge_request = 1; | |
| 198 | + | // Auto is true when the server merged it by auto-merge. | |
| 199 | + | bool auto = 2; | |
| 200 | + | } | |
| 201 | + | ||
| 202 | + | // MergeRequestAutoMergeEnabled reports auto-merge enabled on an open merge | |
| 203 | + | // request. It is published again when auto-merge is enabled again. | |
| 204 | + | message MergeRequestAutoMergeEnabled { | |
| 205 | + | // MergeRequest is the merge request, with auto_merge set. | |
| 206 | + | MergeRequest merge_request = 1; | |
| 207 | + | } | |
| 208 | + | ||
| 209 | + | // MergeRequestAutoMergeCancelled reports the auto-merge of a merge request | |
| 210 | + | // cancelled, by a caller or by the server. | |
| 211 | + | message MergeRequestAutoMergeCancelled { | |
| 212 | + | // MergeRequest is the merge request, with auto_merge unset. | |
| 213 | + | MergeRequest merge_request = 1; | |
| 214 | + | // Reason says in one line why it was cancelled. For display only. | |
| 215 | + | string reason = 2; | |
| 193 | 216 | } | |
| 194 | 217 | ||
| 195 | 218 | // MergeRequestMergeability reports the mergeability of an open merge request. | |
| @@ -140,6 +140,11 @@ message Event { | |||||
| 140 | MirrorFailed mirror_failed = 23; | 140 | MirrorFailed mirror_failed = 23; | ||
| 141 | // MirrorRecovered: a failing or paused mirror succeeded again. | 141 | // MirrorRecovered: a failing or paused mirror succeeded again. | ||
| 142 | MirrorRecovered mirror_recovered = 24; | 142 | MirrorRecovered mirror_recovered = 24; | ||
| 143 | + | // MergeRequestAutoMergeEnabled: auto-merge was enabled on a merge request. | |||
| 144 | + | MergeRequestAutoMergeEnabled merge_request_auto_merge_enabled = 25; | |||
| 145 | + | // MergeRequestAutoMergeCancelled: the auto-merge of a merge request was | |||
| 146 | + | // cancelled. | |||
| 147 | + | MergeRequestAutoMergeCancelled merge_request_auto_merge_cancelled = 26; | |||
| 143 | } | 148 | } | ||
| 144 | } | 149 | } | ||
| 145 | 150 | ||||
| @@ -190,6 +195,24 @@ message MergeRequestOpened { | |||||
| 190 | message MergeRequestMerged { | 195 | message MergeRequestMerged { | ||
| 191 | // MergeRequest is the merge request after the merge. | 196 | // MergeRequest is the merge request after the merge. | ||
| 192 | MergeRequest merge_request = 1; | 197 | MergeRequest merge_request = 1; | ||
| 198 | + | // Auto is true when the server merged it by auto-merge. | |||
| 199 | + | bool auto = 2; | |||
| 200 | + | } | |||
| 201 | + | ||||
| 202 | + | // MergeRequestAutoMergeEnabled reports auto-merge enabled on an open merge | |||
| 203 | + | // request. It is published again when auto-merge is enabled again. | |||
| 204 | + | message MergeRequestAutoMergeEnabled { | |||
| 205 | + | // MergeRequest is the merge request, with auto_merge set. | |||
| 206 | + | MergeRequest merge_request = 1; | |||
| 207 | + | } | |||
| 208 | + | ||||
| 209 | + | // MergeRequestAutoMergeCancelled reports the auto-merge of a merge request | |||
| 210 | + | // cancelled, by a caller or by the server. | |||
| 211 | + | message MergeRequestAutoMergeCancelled { | |||
| 212 | + | // MergeRequest is the merge request, with auto_merge unset. | |||
| 213 | + | MergeRequest merge_request = 1; | |||
| 214 | + | // Reason says in one line why it was cancelled. For display only. | |||
| 215 | + | string reason = 2; | |||
| 193 | } | 216 | } | ||
| 194 | 217 | ||||
| 195 | // MergeRequestMergeability reports the mergeability of an open merge request. | 218 | // MergeRequestMergeability reports the mergeability of an open merge request. | ||
M proto/ermite/merge_request.proto +81 -0
| @@ -88,6 +88,21 @@ message Mergeability { | |||
| 88 | 88 | google.protobuf.Timestamp checked_at = 8; | |
| 89 | 89 | } | |
| 90 | 90 | ||
| 91 | + | // AutoMerge is the pending auto-merge of an open merge request: the server | |
| 92 | + | // merges it by itself once its checks pass. Set only by servers with the | |
| 93 | + | // "merge_requests.auto_merge" feature. | |
| 94 | + | message AutoMerge { | |
| 95 | + | // Mode is the merge mode used. Never MERGE_MODE_UNSPECIFIED. | |
| 96 | + | MergeMode mode = 1; | |
| 97 | + | // HeadId is the head the auto-merge was enabled for. A new head cancels the | |
| 98 | + | // auto-merge. | |
| 99 | + | string head_id = 2; | |
| 100 | + | // EnabledBy names who enabled the auto-merge, like MergeRequest.author. | |
| 101 | + | string enabled_by = 3; | |
| 102 | + | // EnabledAt is when the auto-merge was enabled. | |
| 103 | + | google.protobuf.Timestamp enabled_at = 4; | |
| 104 | + | } | |
| 105 | + | ||
| 91 | 106 | // MergeRequest asks to merge one branch of a repository into another branch | |
| 92 | 107 | // of the same repository. It is about a branch, not about who wrote it. | |
| 93 | 108 | message MergeRequest { | |
| @@ -138,6 +153,13 @@ message MergeRequest { | |||
| 138 | 153 | // hint: MergeMergeRequest checks again. Set only by servers with the | |
| 139 | 154 | // "merge_requests.mergeability" feature. | |
| 140 | 155 | Mergeability mergeability = 14; | |
| 156 | + | // AutoMerge is the pending auto-merge. Set only while the merge request is | |
| 157 | + | // OPEN and auto-merge is enabled; unset once merged or closed. Set only by | |
| 158 | + | // servers with the "merge_requests.auto_merge" feature. | |
| 159 | + | AutoMerge auto_merge = 15; | |
| 160 | + | // AutoMerged is true when the server merged the merge request by auto-merge. | |
| 161 | + | // Always false unless state is MERGED. | |
| 162 | + | bool auto_merged = 16; | |
| 141 | 163 | } | |
| 142 | 164 | ||
| 143 | 165 | // Comment is a note on a merge request, either general or attached to a line | |
| @@ -294,6 +316,29 @@ service MergeRequestService { | |||
| 294 | 316 | // failed_precondition (not open). On success the server publishes | |
| 295 | 317 | // MergeRequestMerged then Pushed for the target branch. | |
| 296 | 318 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | |
| 319 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |
| 320 | + | // once at least one check passed on its head, every run created on that head | |
| 321 | + | // is complete, and the merge would be accepted whatever | |
| 322 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 323 | + | // token limited to branches, write access to the target branch | |
| 324 | + | // (permission_denied otherwise). The server records the caller, the mode and | |
| 325 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 326 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 327 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |
| 328 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |
| 329 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |
| 330 | + | // merge request is not open, if the source branch no longer points to head_id | |
| 331 | + | // ("branch moved, read again"), is a draft, | |
| 332 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 333 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 334 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| 335 | + | // "merge_requests.auto_merge" feature. | |
| 336 | + | rpc EnableAutoMerge(EnableAutoMergeRequest) returns (EnableAutoMergeResponse); | |
| 337 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |
| 338 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |
| 339 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |
| 340 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |
| 341 | + | rpc CancelAutoMerge(CancelAutoMergeRequest) returns (CancelAutoMergeResponse); | |
| 297 | 342 | // MarkRead records the head the caller has reviewed, for the since_last_read | |
| 298 | 343 | // option of GetMergeRequest. There is one read position per merge request, | |
| 299 | 344 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | |
| @@ -539,6 +584,42 @@ message MergeMergeRequestResponse { | |||
| 539 | 584 | bool source_branch_deleted = 2; | |
| 540 | 585 | } | |
| 541 | 586 | ||
| 587 | + | // EnableAutoMergeRequest describes the auto-merge to enable. | |
| 588 | + | message EnableAutoMergeRequest { | |
| 589 | + | // Repo is the repository name. | |
| 590 | + | string repo = 1; | |
| 591 | + | // Number is the merge request number. | |
| 592 | + | int64 number = 2; | |
| 593 | + | // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode | |
| 594 | + | // must be in RepoSettings.allowed_merge_modes of the repository. | |
| 595 | + | MergeMode mode = 3; | |
| 596 | + | // HeadId is the full id of the commit the caller reviewed, that is the | |
| 597 | + | // MergeRequest.head_id it was shown. Required. The auto-merge is enabled | |
| 598 | + | // only if the source branch still points to it; failed_precondition (branch | |
| 599 | + | // moved) otherwise. | |
| 600 | + | string head_id = 4; | |
| 601 | + | } | |
| 602 | + | ||
| 603 | + | // EnableAutoMergeResponse holds the merge request with auto-merge enabled. | |
| 604 | + | message EnableAutoMergeResponse { | |
| 605 | + | // MergeRequest is the merge request, with auto_merge set. | |
| 606 | + | MergeRequest merge_request = 1; | |
| 607 | + | } | |
| 608 | + | ||
| 609 | + | // CancelAutoMergeRequest names the merge request whose auto-merge to cancel. | |
| 610 | + | message CancelAutoMergeRequest { | |
| 611 | + | // Repo is the repository name. | |
| 612 | + | string repo = 1; | |
| 613 | + | // Number is the merge request number. | |
| 614 | + | int64 number = 2; | |
| 615 | + | } | |
| 616 | + | ||
| 617 | + | // CancelAutoMergeResponse holds the merge request after the cancellation. | |
| 618 | + | message CancelAutoMergeResponse { | |
| 619 | + | // MergeRequest is the merge request, with auto_merge unset. | |
| 620 | + | MergeRequest merge_request = 1; | |
| 621 | + | } | |
| 622 | + | ||
| 542 | 623 | // MarkReadRequest records a read position. | |
| 543 | 624 | message MarkReadRequest { | |
| 544 | 625 | // Repo is the repository name. | |
| @@ -88,6 +88,21 @@ message Mergeability { | |||||
| 88 | google.protobuf.Timestamp checked_at = 8; | 88 | google.protobuf.Timestamp checked_at = 8; | ||
| 89 | } | 89 | } | ||
| 90 | 90 | ||||
| 91 | + | // AutoMerge is the pending auto-merge of an open merge request: the server | |||
| 92 | + | // merges it by itself once its checks pass. Set only by servers with the | |||
| 93 | + | // "merge_requests.auto_merge" feature. | |||
| 94 | + | message AutoMerge { | |||
| 95 | + | // Mode is the merge mode used. Never MERGE_MODE_UNSPECIFIED. | |||
| 96 | + | MergeMode mode = 1; | |||
| 97 | + | // HeadId is the head the auto-merge was enabled for. A new head cancels the | |||
| 98 | + | // auto-merge. | |||
| 99 | + | string head_id = 2; | |||
| 100 | + | // EnabledBy names who enabled the auto-merge, like MergeRequest.author. | |||
| 101 | + | string enabled_by = 3; | |||
| 102 | + | // EnabledAt is when the auto-merge was enabled. | |||
| 103 | + | google.protobuf.Timestamp enabled_at = 4; | |||
| 104 | + | } | |||
| 105 | + | ||||
| 91 | // MergeRequest asks to merge one branch of a repository into another branch | 106 | // MergeRequest asks to merge one branch of a repository into another branch | ||
| 92 | // of the same repository. It is about a branch, not about who wrote it. | 107 | // of the same repository. It is about a branch, not about who wrote it. | ||
| 93 | message MergeRequest { | 108 | message MergeRequest { | ||
| @@ -138,6 +153,13 @@ message MergeRequest { | |||||
| 138 | // hint: MergeMergeRequest checks again. Set only by servers with the | 153 | // hint: MergeMergeRequest checks again. Set only by servers with the | ||
| 139 | // "merge_requests.mergeability" feature. | 154 | // "merge_requests.mergeability" feature. | ||
| 140 | Mergeability mergeability = 14; | 155 | Mergeability mergeability = 14; | ||
| 156 | + | // AutoMerge is the pending auto-merge. Set only while the merge request is | |||
| 157 | + | // OPEN and auto-merge is enabled; unset once merged or closed. Set only by | |||
| 158 | + | // servers with the "merge_requests.auto_merge" feature. | |||
| 159 | + | AutoMerge auto_merge = 15; | |||
| 160 | + | // AutoMerged is true when the server merged the merge request by auto-merge. | |||
| 161 | + | // Always false unless state is MERGED. | |||
| 162 | + | bool auto_merged = 16; | |||
| 141 | } | 163 | } | ||
| 142 | 164 | ||||
| 143 | // Comment is a note on a merge request, either general or attached to a line | 165 | // Comment is a note on a merge request, either general or attached to a line | ||
| @@ -294,6 +316,29 @@ service MergeRequestService { | |||||
| 294 | // failed_precondition (not open). On success the server publishes | 316 | // failed_precondition (not open). On success the server publishes | ||
| 295 | // MergeRequestMerged then Pushed for the target branch. | 317 | // MergeRequestMerged then Pushed for the target branch. | ||
| 296 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | 318 | rpc MergeMergeRequest(MergeMergeRequestRequest) returns (MergeMergeRequestResponse); | ||
| 319 | + | // EnableAutoMerge asks the server to merge an open merge request by itself | |||
| 320 | + | // once at least one check passed on its head, every run created on that head | |||
| 321 | + | // is complete, and the merge would be accepted whatever | |||
| 322 | + | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |||
| 323 | + | // token limited to branches, write access to the target branch | |||
| 324 | + | // (permission_denied otherwise). The server records the caller, the mode and | |||
| 325 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |||
| 326 | + | // again, and cancels the auto-merge if the caller can no longer merge, if the | |||
| 327 | + | // mode is no longer allowed, if the source branch moves or if the setting is | |||
| 328 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or | |||
| 329 | + | // if head_id is empty or not a commit id, and with failed_precondition if the | |||
| 330 | + | // merge request is not open, if the source branch no longer points to head_id | |||
| 331 | + | // ("branch moved, read again"), is a draft, | |||
| 332 | + | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |||
| 333 | + | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |||
| 334 | + | // Publishes MergeRequestAutoMergeEnabled. Needs the | |||
| 335 | + | // "merge_requests.auto_merge" feature. | |||
| 336 | + | rpc EnableAutoMerge(EnableAutoMergeRequest) returns (EnableAutoMergeResponse); | |||
| 337 | + | // CancelAutoMerge cancels the pending auto-merge of an open merge request. | |||
| 338 | + | // Needs the mr:merge scope and, for a token limited to branches, write access | |||
| 339 | + | // to the target branch. Fails with failed_precondition if auto-merge is not | |||
| 340 | + | // enabled. Publishes MergeRequestAutoMergeCancelled. | |||
| 341 | + | rpc CancelAutoMerge(CancelAutoMergeRequest) returns (CancelAutoMergeResponse); | |||
| 297 | // MarkRead records the head the caller has reviewed, for the since_last_read | 342 | // MarkRead records the head the caller has reviewed, for the since_last_read | ||
| 298 | // option of GetMergeRequest. There is one read position per merge request, | 343 | // option of GetMergeRequest. There is one read position per merge request, | ||
| 299 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | 344 | // the reviewer's. Needs the mr:write scope. Marking a commit that does not | ||
| @@ -539,6 +584,42 @@ message MergeMergeRequestResponse { | |||||
| 539 | bool source_branch_deleted = 2; | 584 | bool source_branch_deleted = 2; | ||
| 540 | } | 585 | } | ||
| 541 | 586 | ||||
| 587 | + | // EnableAutoMergeRequest describes the auto-merge to enable. | |||
| 588 | + | message EnableAutoMergeRequest { | |||
| 589 | + | // Repo is the repository name. | |||
| 590 | + | string repo = 1; | |||
| 591 | + | // Number is the merge request number. | |||
| 592 | + | int64 number = 2; | |||
| 593 | + | // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode | |||
| 594 | + | // must be in RepoSettings.allowed_merge_modes of the repository. | |||
| 595 | + | MergeMode mode = 3; | |||
| 596 | + | // HeadId is the full id of the commit the caller reviewed, that is the | |||
| 597 | + | // MergeRequest.head_id it was shown. Required. The auto-merge is enabled | |||
| 598 | + | // only if the source branch still points to it; failed_precondition (branch | |||
| 599 | + | // moved) otherwise. | |||
| 600 | + | string head_id = 4; | |||
| 601 | + | } | |||
| 602 | + | ||||
| 603 | + | // EnableAutoMergeResponse holds the merge request with auto-merge enabled. | |||
| 604 | + | message EnableAutoMergeResponse { | |||
| 605 | + | // MergeRequest is the merge request, with auto_merge set. | |||
| 606 | + | MergeRequest merge_request = 1; | |||
| 607 | + | } | |||
| 608 | + | ||||
| 609 | + | // CancelAutoMergeRequest names the merge request whose auto-merge to cancel. | |||
| 610 | + | message CancelAutoMergeRequest { | |||
| 611 | + | // Repo is the repository name. | |||
| 612 | + | string repo = 1; | |||
| 613 | + | // Number is the merge request number. | |||
| 614 | + | int64 number = 2; | |||
| 615 | + | } | |||
| 616 | + | ||||
| 617 | + | // CancelAutoMergeResponse holds the merge request after the cancellation. | |||
| 618 | + | message CancelAutoMergeResponse { | |||
| 619 | + | // MergeRequest is the merge request, with auto_merge unset. | |||
| 620 | + | MergeRequest merge_request = 1; | |||
| 621 | + | } | |||
| 622 | + | ||||
| 542 | // MarkReadRequest records a read position. | 623 | // MarkReadRequest records a read position. | ||
| 543 | message MarkReadRequest { | 624 | message MarkReadRequest { | ||
| 544 | // Repo is the repository name. | 625 | // Repo is the repository name. | ||
M proto/ermite/repo.proto +7 -3
| @@ -47,6 +47,10 @@ message RepoSettings { | |||
| 47 | 47 | bool failing_checks_block = 2; | |
| 48 | 48 | // Issues is the issue participation mode of the repository. | |
| 49 | 49 | IssuesMode issues = 3; | |
| 50 | + | // AllowAutoMerge says whether auto-merge can be enabled on the merge requests | |
| 51 | + | // of the repository (see MergeRequestService.EnableAutoMerge). It is false by | |
| 52 | + | // default. Set only by servers with the "merge_requests.auto_merge" feature. | |
| 53 | + | bool allow_auto_merge = 4; | |
| 50 | 54 | } | |
| 51 | 55 | ||
| 52 | 56 | // Repo is the metadata of a repository. Git-owned state (refs, trees, history) | |
| @@ -166,9 +170,9 @@ message UpdateRepoRequest { | |||
| 166 | 170 | // the call fails with failed_precondition. | |
| 167 | 171 | string default_branch = 4; | |
| 168 | 172 | // UpdateMask lists the fields to change: "description", "visibility", | |
| 169 | - | // "default_branch", "topics", "settings.allowed_merge_modes" and/or | |
| 170 | - | // "settings.failing_checks_block". "settings" stands for both merge settings | |
| 171 | - | // paths. It must not be empty unless issues is set. Other paths are | |
| 173 | + | // "default_branch", "topics", "settings.allowed_merge_modes", | |
| 174 | + | // "settings.failing_checks_block" and/or "settings.allow_auto_merge". | |
| 175 | + | // "settings" stands for the three merge settings paths. It must not be empty unless issues is set. Other paths are | |
| 172 | 176 | // invalid_argument, including "settings.issues" and "issues": the issues | |
| 173 | 177 | // field is applied outside the mask. | |
| 174 | 178 | google.protobuf.FieldMask update_mask = 5; | |
| @@ -47,6 +47,10 @@ message RepoSettings { | |||||
| 47 | bool failing_checks_block = 2; | 47 | bool failing_checks_block = 2; | ||
| 48 | // Issues is the issue participation mode of the repository. | 48 | // Issues is the issue participation mode of the repository. | ||
| 49 | IssuesMode issues = 3; | 49 | IssuesMode issues = 3; | ||
| 50 | + | // AllowAutoMerge says whether auto-merge can be enabled on the merge requests | |||
| 51 | + | // of the repository (see MergeRequestService.EnableAutoMerge). It is false by | |||
| 52 | + | // default. Set only by servers with the "merge_requests.auto_merge" feature. | |||
| 53 | + | bool allow_auto_merge = 4; | |||
| 50 | } | 54 | } | ||
| 51 | 55 | ||||
| 52 | // Repo is the metadata of a repository. Git-owned state (refs, trees, history) | 56 | // Repo is the metadata of a repository. Git-owned state (refs, trees, history) | ||
| @@ -166,9 +170,9 @@ message UpdateRepoRequest { | |||||
| 166 | // the call fails with failed_precondition. | 170 | // the call fails with failed_precondition. | ||
| 167 | string default_branch = 4; | 171 | string default_branch = 4; | ||
| 168 | // UpdateMask lists the fields to change: "description", "visibility", | 172 | // UpdateMask lists the fields to change: "description", "visibility", | ||
| 169 | - | // "default_branch", "topics", "settings.allowed_merge_modes" and/or | 173 | + | // "default_branch", "topics", "settings.allowed_merge_modes", |
| 170 | - | // "settings.failing_checks_block". "settings" stands for both merge settings | 174 | + | // "settings.failing_checks_block" and/or "settings.allow_auto_merge". |
| 171 | - | // paths. It must not be empty unless issues is set. Other paths are | 175 | + | // "settings" stands for the three merge settings paths. It must not be empty unless issues is set. Other paths are |
| 172 | // invalid_argument, including "settings.issues" and "issues": the issues | 176 | // invalid_argument, including "settings.issues" and "issues": the issues | ||
| 173 | // field is applied outside the mask. | 177 | // field is applied outside the mask. | ||
| 174 | google.protobuf.FieldMask update_mask = 5; | 178 | google.protobuf.FieldMask update_mask = 5; | ||
M proto/ermite/server.proto +5 -1
| @@ -60,7 +60,11 @@ message GetVersionResponse { | |||
| 60 | 60 | // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge | |
| 61 | 61 | // request identifier "merge_requests.mergeability" covers | |
| 62 | 62 | // MergeRequest.mergeability, the MergeRequestMergeability event and | |
| 63 | - | // MERGE_MODE_MERGE_COMMIT. | |
| 63 | + | // MERGE_MODE_MERGE_COMMIT. "merge_requests.auto_merge" covers | |
| 64 | + | // RepoSettings.allow_auto_merge, MergeRequest.auto_merge and auto_merged, | |
| 65 | + | // the EnableAutoMerge and CancelAutoMerge RPCs, the | |
| 66 | + | // MergeRequestAutoMergeEnabled and MergeRequestAutoMergeCancelled events | |
| 67 | + | // and MergeRequestMerged.auto. | |
| 64 | 68 | repeated string features = 2; | |
| 65 | 69 | } | |
| 66 | 70 | ||
| @@ -60,7 +60,11 @@ message GetVersionResponse { | |||||
| 60 | // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge | 60 | // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge | ||
| 61 | // request identifier "merge_requests.mergeability" covers | 61 | // request identifier "merge_requests.mergeability" covers | ||
| 62 | // MergeRequest.mergeability, the MergeRequestMergeability event and | 62 | // MergeRequest.mergeability, the MergeRequestMergeability event and | ||
| 63 | - | // MERGE_MODE_MERGE_COMMIT. | 63 | + | // MERGE_MODE_MERGE_COMMIT. "merge_requests.auto_merge" covers |
| 64 | + | // RepoSettings.allow_auto_merge, MergeRequest.auto_merge and auto_merged, | |||
| 65 | + | // the EnableAutoMerge and CancelAutoMerge RPCs, the | |||
| 66 | + | // MergeRequestAutoMergeEnabled and MergeRequestAutoMergeCancelled events | |||
| 67 | + | // and MergeRequestMerged.auto. | |||
| 64 | repeated string features = 2; | 68 | repeated string features = 2; | ||
| 65 | } | 69 | } | ||
| 66 | 70 | ||||