detached 35fc113

feat(proto): add merge request auto-merge setting, state, RPCs and events

commit
35fc1135ade38f29ee8f79a25d8ca0337fb9c2c4
author
brice · · 2026-10-20 15:43 UTC
committer
brice · · 2026-10-20 16:24 UTC
parent
b97dc86
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
11 files · +1037 -307
M docs/services.md +1 -1
@@ -5,7 +5,7 @@
55 | `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask, merge settings), `DeleteRepo` |
66 | `GitService` | `ListRefs`, `GetTree`, `ListPaths`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` |
77 | `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`) |
99 | `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 |
1010 | `SessionService` | `CreateLoginLink`, `SignOutEverywhere` (owner only) |
1111 | `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 +96 -0
@@ -62,6 +62,12 @@ const (
6262 // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the
6363 // MergeRequestService's MergeMergeRequest RPC.
6464 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"
6571 // MergeRequestServiceMarkReadProcedure is the fully-qualified name of the MergeRequestService's
6672 // MarkRead RPC.
6773 MergeRequestServiceMarkReadProcedure = "/ermite.MergeRequestService/MarkRead"
@@ -137,6 +143,27 @@ type MergeRequestServiceClient interface {
137143 // failed_precondition (not open). On success the server publishes
138144 // MergeRequestMerged then Pushed for the target branch.
139145 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 current head; 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,
156+ // and with failed_precondition if the merge request is not open, is a draft,
157+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
158+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
159+ // Publishes MergeRequestAutoMergeEnabled. Needs the
160+ // "merge_requests.auto_merge" feature.
161+ EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error)
162+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
163+ // Needs the mr:merge scope and, for a token limited to branches, write access
164+ // to the target branch. Fails with failed_precondition if auto-merge is not
165+ // enabled. Publishes MergeRequestAutoMergeCancelled.
166+ CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error)
140167 // MarkRead records the head the caller has reviewed, for the since_last_read
141168 // option of GetMergeRequest. There is one read position per merge request,
142169 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -209,6 +236,18 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string,
209236 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),
210237 connect.WithClientOptions(opts...),
211238 ),
239+ enableAutoMerge: connect.NewClient[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse](
240+ httpClient,
241+ baseURL+MergeRequestServiceEnableAutoMergeProcedure,
242+ connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")),
243+ connect.WithClientOptions(opts...),
244+ ),
245+ cancelAutoMerge: connect.NewClient[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse](
246+ httpClient,
247+ baseURL+MergeRequestServiceCancelAutoMergeProcedure,
248+ connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")),
249+ connect.WithClientOptions(opts...),
250+ ),
212251 markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse](
213252 httpClient,
214253 baseURL+MergeRequestServiceMarkReadProcedure,
@@ -229,6 +268,8 @@ type mergeRequestServiceClient struct {
229268 resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse]
230269 closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse]
231270 mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]
271+ enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse]
272+ cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse]
232273 markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse]
233274 }
234275
@@ -277,6 +318,16 @@ func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *
277318 return c.mergeMergeRequest.CallUnary(ctx, req)
278319 }
279320
321+// EnableAutoMerge calls ermite.MergeRequestService.EnableAutoMerge.
322+func (c *mergeRequestServiceClient) EnableAutoMerge(ctx context.Context, req *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) {
323+ return c.enableAutoMerge.CallUnary(ctx, req)
324+}
325+
326+// CancelAutoMerge calls ermite.MergeRequestService.CancelAutoMerge.
327+func (c *mergeRequestServiceClient) CancelAutoMerge(ctx context.Context, req *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) {
328+ return c.cancelAutoMerge.CallUnary(ctx, req)
329+}
330+
280331 // MarkRead calls ermite.MergeRequestService.MarkRead.
281332 func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) {
282333 return c.markRead.CallUnary(ctx, req)
@@ -352,6 +403,27 @@ type MergeRequestServiceHandler interface {
352403 // failed_precondition (not open). On success the server publishes
353404 // MergeRequestMerged then Pushed for the target branch.
354405 MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error)
406+ // EnableAutoMerge asks the server to merge an open merge request by itself
407+ // once at least one check passed on its head, every run created on that head
408+ // is complete, and the merge would be accepted whatever
409+ // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a
410+ // token limited to branches, write access to the target branch
411+ // (permission_denied otherwise). The server records the caller, the mode and
412+ // the current head; it merges as the caller, after resolving the caller
413+ // again, and cancels the auto-merge if the caller can no longer merge, if the
414+ // mode is no longer allowed, if the source branch moves or if the setting is
415+ // turned off. Fails with invalid_argument if the mode is not a merge mode,
416+ // and with failed_precondition if the merge request is not open, is a draft,
417+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
418+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
419+ // Publishes MergeRequestAutoMergeEnabled. Needs the
420+ // "merge_requests.auto_merge" feature.
421+ EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error)
422+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
423+ // Needs the mr:merge scope and, for a token limited to branches, write access
424+ // to the target branch. Fails with failed_precondition if auto-merge is not
425+ // enabled. Publishes MergeRequestAutoMergeCancelled.
426+ CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error)
355427 // MarkRead records the head the caller has reviewed, for the since_last_read
356428 // option of GetMergeRequest. There is one read position per merge request,
357429 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -420,6 +492,18 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne
420492 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),
421493 connect.WithHandlerOptions(opts...),
422494 )
495+ mergeRequestServiceEnableAutoMergeHandler := connect.NewUnaryHandler(
496+ MergeRequestServiceEnableAutoMergeProcedure,
497+ svc.EnableAutoMerge,
498+ connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")),
499+ connect.WithHandlerOptions(opts...),
500+ )
501+ mergeRequestServiceCancelAutoMergeHandler := connect.NewUnaryHandler(
502+ MergeRequestServiceCancelAutoMergeProcedure,
503+ svc.CancelAutoMerge,
504+ connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")),
505+ connect.WithHandlerOptions(opts...),
506+ )
423507 mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler(
424508 MergeRequestServiceMarkReadProcedure,
425509 svc.MarkRead,
@@ -446,6 +530,10 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne
446530 mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r)
447531 case MergeRequestServiceMergeMergeRequestProcedure:
448532 mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r)
533+ case MergeRequestServiceEnableAutoMergeProcedure:
534+ mergeRequestServiceEnableAutoMergeHandler.ServeHTTP(w, r)
535+ case MergeRequestServiceCancelAutoMergeProcedure:
536+ mergeRequestServiceCancelAutoMergeHandler.ServeHTTP(w, r)
449537 case MergeRequestServiceMarkReadProcedure:
450538 mergeRequestServiceMarkReadHandler.ServeHTTP(w, r)
451539 default:
@@ -493,6 +581,14 @@ func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context
493581 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented"))
494582 }
495583
584+func (UnimplementedMergeRequestServiceHandler) EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) {
585+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.EnableAutoMerge is not implemented"))
586+}
587+
588+func (UnimplementedMergeRequestServiceHandler) CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) {
589+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CancelAutoMerge is not implemented"))
590+}
591+
496592 func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) {
497593 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented"))
498594 }
@@ -62,6 +62,12 @@ const (
62 // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the62 // 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's71 // 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,27 @@ type MergeRequestServiceClient interface {
137 // failed_precondition (not open). On success the server publishes143 // 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 current head; 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,
156+ // and with failed_precondition if the merge request is not open, is a draft,
157+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
158+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
159+ // Publishes MergeRequestAutoMergeEnabled. Needs the
160+ // "merge_requests.auto_merge" feature.
161+ EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error)
162+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
163+ // Needs the mr:merge scope and, for a token limited to branches, write access
164+ // to the target branch. Fails with failed_precondition if auto-merge is not
165+ // enabled. Publishes MergeRequestAutoMergeCancelled.
166+ 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_read167 // 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,168 // 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 not169 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -209,6 +236,18 @@ func NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string,
209 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),236 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),
210 connect.WithClientOptions(opts...),237 connect.WithClientOptions(opts...),
211 ),238 ),
239+ enableAutoMerge: connect.NewClient[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse](
240+ httpClient,
241+ baseURL+MergeRequestServiceEnableAutoMergeProcedure,
242+ connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")),
243+ connect.WithClientOptions(opts...),
244+ ),
245+ cancelAutoMerge: connect.NewClient[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse](
246+ httpClient,
247+ baseURL+MergeRequestServiceCancelAutoMergeProcedure,
248+ connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")),
249+ connect.WithClientOptions(opts...),
250+ ),
212 markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse](251 markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse](
213 httpClient,252 httpClient,
214 baseURL+MergeRequestServiceMarkReadProcedure,253 baseURL+MergeRequestServiceMarkReadProcedure,
@@ -229,6 +268,8 @@ type mergeRequestServiceClient struct {
229 resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse]268 resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse]
230 closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse]269 closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse]
231 mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]270 mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]
271+ enableAutoMerge *connect.Client[ermite.EnableAutoMergeRequest, ermite.EnableAutoMergeResponse]
272+ cancelAutoMerge *connect.Client[ermite.CancelAutoMergeRequest, ermite.CancelAutoMergeResponse]
232 markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse]273 markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse]
233 }274 }
234 275
@@ -277,6 +318,16 @@ func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *
277 return c.mergeMergeRequest.CallUnary(ctx, req)318 return c.mergeMergeRequest.CallUnary(ctx, req)
278 }319 }
279 320
321+// EnableAutoMerge calls ermite.MergeRequestService.EnableAutoMerge.
322+func (c *mergeRequestServiceClient) EnableAutoMerge(ctx context.Context, req *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) {
323+ return c.enableAutoMerge.CallUnary(ctx, req)
324+}
325+
326+// CancelAutoMerge calls ermite.MergeRequestService.CancelAutoMerge.
327+func (c *mergeRequestServiceClient) CancelAutoMerge(ctx context.Context, req *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) {
328+ return c.cancelAutoMerge.CallUnary(ctx, req)
329+}
330+
280 // MarkRead calls ermite.MergeRequestService.MarkRead.331 // MarkRead calls ermite.MergeRequestService.MarkRead.
281 func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) {332 func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) {
282 return c.markRead.CallUnary(ctx, req)333 return c.markRead.CallUnary(ctx, req)
@@ -352,6 +403,27 @@ type MergeRequestServiceHandler interface {
352 // failed_precondition (not open). On success the server publishes403 // failed_precondition (not open). On success the server publishes
353 // MergeRequestMerged then Pushed for the target branch.404 // MergeRequestMerged then Pushed for the target branch.
354 MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error)405 MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error)
406+ // EnableAutoMerge asks the server to merge an open merge request by itself
407+ // once at least one check passed on its head, every run created on that head
408+ // is complete, and the merge would be accepted whatever
409+ // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a
410+ // token limited to branches, write access to the target branch
411+ // (permission_denied otherwise). The server records the caller, the mode and
412+ // the current head; it merges as the caller, after resolving the caller
413+ // again, and cancels the auto-merge if the caller can no longer merge, if the
414+ // mode is no longer allowed, if the source branch moves or if the setting is
415+ // turned off. Fails with invalid_argument if the mode is not a merge mode,
416+ // and with failed_precondition if the merge request is not open, is a draft,
417+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
418+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
419+ // Publishes MergeRequestAutoMergeEnabled. Needs the
420+ // "merge_requests.auto_merge" feature.
421+ EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error)
422+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
423+ // Needs the mr:merge scope and, for a token limited to branches, write access
424+ // to the target branch. Fails with failed_precondition if auto-merge is not
425+ // enabled. Publishes MergeRequestAutoMergeCancelled.
426+ 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_read427 // 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,428 // 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 not429 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -420,6 +492,18 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne
420 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),492 connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")),
421 connect.WithHandlerOptions(opts...),493 connect.WithHandlerOptions(opts...),
422 )494 )
495+ mergeRequestServiceEnableAutoMergeHandler := connect.NewUnaryHandler(
496+ MergeRequestServiceEnableAutoMergeProcedure,
497+ svc.EnableAutoMerge,
498+ connect.WithSchema(mergeRequestServiceMethods.ByName("EnableAutoMerge")),
499+ connect.WithHandlerOptions(opts...),
500+ )
501+ mergeRequestServiceCancelAutoMergeHandler := connect.NewUnaryHandler(
502+ MergeRequestServiceCancelAutoMergeProcedure,
503+ svc.CancelAutoMerge,
504+ connect.WithSchema(mergeRequestServiceMethods.ByName("CancelAutoMerge")),
505+ connect.WithHandlerOptions(opts...),
506+ )
423 mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler(507 mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler(
424 MergeRequestServiceMarkReadProcedure,508 MergeRequestServiceMarkReadProcedure,
425 svc.MarkRead,509 svc.MarkRead,
@@ -446,6 +530,10 @@ func NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...conne
446 mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r)530 mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r)
447 case MergeRequestServiceMergeMergeRequestProcedure:531 case MergeRequestServiceMergeMergeRequestProcedure:
448 mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r)532 mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r)
533+ case MergeRequestServiceEnableAutoMergeProcedure:
534+ mergeRequestServiceEnableAutoMergeHandler.ServeHTTP(w, r)
535+ case MergeRequestServiceCancelAutoMergeProcedure:
536+ mergeRequestServiceCancelAutoMergeHandler.ServeHTTP(w, r)
449 case MergeRequestServiceMarkReadProcedure:537 case MergeRequestServiceMarkReadProcedure:
450 mergeRequestServiceMarkReadHandler.ServeHTTP(w, r)538 mergeRequestServiceMarkReadHandler.ServeHTTP(w, r)
451 default:539 default:
@@ -493,6 +581,14 @@ func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context
493 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented"))581 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented"))
494 }582 }
495 583
584+func (UnimplementedMergeRequestServiceHandler) EnableAutoMerge(context.Context, *connect.Request[ermite.EnableAutoMergeRequest]) (*connect.Response[ermite.EnableAutoMergeResponse], error) {
585+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.EnableAutoMerge is not implemented"))
586+}
587+
588+func (UnimplementedMergeRequestServiceHandler) CancelAutoMerge(context.Context, *connect.Request[ermite.CancelAutoMergeRequest]) (*connect.Response[ermite.CancelAutoMergeResponse], error) {
589+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CancelAutoMerge is not implemented"))
590+}
591+
496 func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) {592 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"))593 return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented"))
498 }594 }
M gen/ermite/event.pb.go +296 -133 generated file: collapsed
M gen/ermite/merge_request.pb.go +508 -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) {
5454 {ermiteconnect.MergeRequestServiceCloseMergeRequestProcedure, "/ermite.MergeRequestService/CloseMergeRequest"},
5555 {ermiteconnect.MergeRequestServiceMergeMergeRequestProcedure, "/ermite.MergeRequestService/MergeMergeRequest"},
5656 {ermiteconnect.MergeRequestServiceMarkReadProcedure, "/ermite.MergeRequestService/MarkRead"},
57+ {ermiteconnect.MergeRequestServiceEnableAutoMergeProcedure, "/ermite.MergeRequestService/EnableAutoMerge"},
58+ {ermiteconnect.MergeRequestServiceCancelAutoMergeProcedure, "/ermite.MergeRequestService/CancelAutoMerge"},
5759 {ermiteconnect.SessionServiceCreateLoginLinkProcedure, "/ermite.SessionService/CreateLoginLink"},
5860 {ermiteconnect.SessionServiceSignOutEverywhereProcedure, "/ermite.SessionService/SignOutEverywhere"},
5961 {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 {
140140 MirrorFailed mirror_failed = 23;
141141 // MirrorRecovered: a failing or paused mirror succeeded again.
142142 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;
143148 }
144149 }
145150
@@ -190,6 +195,24 @@ message MergeRequestOpened {
190195 message MergeRequestMerged {
191196 // MergeRequest is the merge request after the merge.
192197 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;
193216 }
194217
195218 // 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 +74 -0
@@ -88,6 +88,21 @@ message Mergeability {
8888 google.protobuf.Timestamp checked_at = 8;
8989 }
9090
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+
91106 // MergeRequest asks to merge one branch of a repository into another branch
92107 // of the same repository. It is about a branch, not about who wrote it.
93108 message MergeRequest {
@@ -138,6 +153,13 @@ message MergeRequest {
138153 // hint: MergeMergeRequest checks again. Set only by servers with the
139154 // "merge_requests.mergeability" feature.
140155 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;
141163 }
142164
143165 // Comment is a note on a merge request, either general or attached to a line
@@ -294,6 +316,27 @@ service MergeRequestService {
294316 // failed_precondition (not open). On success the server publishes
295317 // MergeRequestMerged then Pushed for the target branch.
296318 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 current head; 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,
329+ // and with failed_precondition if the merge request is not open, is a draft,
330+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
331+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
332+ // Publishes MergeRequestAutoMergeEnabled. Needs the
333+ // "merge_requests.auto_merge" feature.
334+ rpc EnableAutoMerge(EnableAutoMergeRequest) returns (EnableAutoMergeResponse);
335+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
336+ // Needs the mr:merge scope and, for a token limited to branches, write access
337+ // to the target branch. Fails with failed_precondition if auto-merge is not
338+ // enabled. Publishes MergeRequestAutoMergeCancelled.
339+ rpc CancelAutoMerge(CancelAutoMergeRequest) returns (CancelAutoMergeResponse);
297340 // MarkRead records the head the caller has reviewed, for the since_last_read
298341 // option of GetMergeRequest. There is one read position per merge request,
299342 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -539,6 +582,37 @@ message MergeMergeRequestResponse {
539582 bool source_branch_deleted = 2;
540583 }
541584
585+// EnableAutoMergeRequest describes the auto-merge to enable.
586+message EnableAutoMergeRequest {
587+ // Repo is the repository name.
588+ string repo = 1;
589+ // Number is the merge request number.
590+ int64 number = 2;
591+ // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode
592+ // must be in RepoSettings.allowed_merge_modes of the repository.
593+ MergeMode mode = 3;
594+}
595+
596+// EnableAutoMergeResponse holds the merge request with auto-merge enabled.
597+message EnableAutoMergeResponse {
598+ // MergeRequest is the merge request, with auto_merge set.
599+ MergeRequest merge_request = 1;
600+}
601+
602+// CancelAutoMergeRequest names the merge request whose auto-merge to cancel.
603+message CancelAutoMergeRequest {
604+ // Repo is the repository name.
605+ string repo = 1;
606+ // Number is the merge request number.
607+ int64 number = 2;
608+}
609+
610+// CancelAutoMergeResponse holds the merge request after the cancellation.
611+message CancelAutoMergeResponse {
612+ // MergeRequest is the merge request, with auto_merge unset.
613+ MergeRequest merge_request = 1;
614+}
615+
542616 // MarkReadRequest records a read position.
543617 message MarkReadRequest {
544618 // 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 branch106 // 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 the153 // 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 line165 // Comment is a note on a merge request, either general or attached to a line
@@ -294,6 +316,27 @@ service MergeRequestService {
294 // failed_precondition (not open). On success the server publishes316 // 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 current head; 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,
329+ // and with failed_precondition if the merge request is not open, is a draft,
330+ // RepoSettings.allow_auto_merge is off, the mode is not allowed by
331+ // RepoSettings, or the server has no CI. Enabling again replaces the mode.
332+ // Publishes MergeRequestAutoMergeEnabled. Needs the
333+ // "merge_requests.auto_merge" feature.
334+ rpc EnableAutoMerge(EnableAutoMergeRequest) returns (EnableAutoMergeResponse);
335+ // CancelAutoMerge cancels the pending auto-merge of an open merge request.
336+ // Needs the mr:merge scope and, for a token limited to branches, write access
337+ // to the target branch. Fails with failed_precondition if auto-merge is not
338+ // enabled. Publishes MergeRequestAutoMergeCancelled.
339+ rpc CancelAutoMerge(CancelAutoMergeRequest) returns (CancelAutoMergeResponse);
297 // MarkRead records the head the caller has reviewed, for the since_last_read340 // 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,341 // 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 not342 // the reviewer's. Needs the mr:write scope. Marking a commit that does not
@@ -539,6 +582,37 @@ message MergeMergeRequestResponse {
539 bool source_branch_deleted = 2;582 bool source_branch_deleted = 2;
540 }583 }
541 584
585+// EnableAutoMergeRequest describes the auto-merge to enable.
586+message EnableAutoMergeRequest {
587+ // Repo is the repository name.
588+ string repo = 1;
589+ // Number is the merge request number.
590+ int64 number = 2;
591+ // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode
592+ // must be in RepoSettings.allowed_merge_modes of the repository.
593+ MergeMode mode = 3;
594+}
595+
596+// EnableAutoMergeResponse holds the merge request with auto-merge enabled.
597+message EnableAutoMergeResponse {
598+ // MergeRequest is the merge request, with auto_merge set.
599+ MergeRequest merge_request = 1;
600+}
601+
602+// CancelAutoMergeRequest names the merge request whose auto-merge to cancel.
603+message CancelAutoMergeRequest {
604+ // Repo is the repository name.
605+ string repo = 1;
606+ // Number is the merge request number.
607+ int64 number = 2;
608+}
609+
610+// CancelAutoMergeResponse holds the merge request after the cancellation.
611+message CancelAutoMergeResponse {
612+ // MergeRequest is the merge request, with auto_merge unset.
613+ MergeRequest merge_request = 1;
614+}
615+
542 // MarkReadRequest records a read position.616 // MarkReadRequest records a read position.
543 message MarkReadRequest {617 message MarkReadRequest {
544 // Repo is the repository name.618 // Repo is the repository name.
M proto/ermite/repo.proto +7 -3
@@ -47,6 +47,10 @@ message RepoSettings {
4747 bool failing_checks_block = 2;
4848 // Issues is the issue participation mode of the repository.
4949 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;
5054 }
5155
5256 // Repo is the metadata of a repository. Git-owned state (refs, trees, history)
@@ -166,9 +170,9 @@ message UpdateRepoRequest {
166170 // the call fails with failed_precondition.
167171 string default_branch = 4;
168172 // 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
172176 // invalid_argument, including "settings.issues" and "issues": the issues
173177 // field is applied outside the mask.
174178 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/or173+ // "default_branch", "topics", "settings.allowed_merge_modes",
170- // "settings.failing_checks_block". "settings" stands for both merge settings174+ // "settings.failing_checks_block" and/or "settings.allow_auto_merge".
171- // paths. It must not be empty unless issues is set. Other paths are175+ // "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 issues176 // 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 {
6060 // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge
6161 // request identifier "merge_requests.mergeability" covers
6262 // 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.
6468 repeated string features = 2;
6569 }
6670
@@ -60,7 +60,11 @@ message GetVersionResponse {
60 // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge60 // and "ci.artifacts" (JobArtifactService and ArtifactService). The merge
61 // request identifier "merge_requests.mergeability" covers61 // request identifier "merge_requests.mergeability" covers
62 // MergeRequest.mergeability, the MergeRequestMergeability event and62 // 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

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 18

↑↓ moveenter openesc close