feat(proto): require the head the caller saw to enable auto-merge
3 files · +36 -12
M gen/ermite/ermiteconnect/merge_request.connect.go +10 -6
| @@ -149,11 +149,13 @@ type MergeRequestServiceClient interface { | |||
| 149 | 149 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 150 | 150 | // token limited to branches, write access to the target branch | |
| 151 | 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 | |
| 152 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 153 | 153 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 154 | 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, | |
| 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, | |
| 157 | 159 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 158 | 160 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 159 | 161 | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| @@ -409,11 +411,13 @@ type MergeRequestServiceHandler interface { | |||
| 409 | 411 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 410 | 412 | // token limited to branches, write access to the target branch | |
| 411 | 413 | // (permission_denied otherwise). The server records the caller, the mode and | |
| 412 | - | // the current head; it merges as the caller, after resolving the caller | |
| 414 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 413 | 415 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 414 | 416 | // 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 | + | // 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, | |
| 417 | 421 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 418 | 422 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 419 | 423 | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| @@ -149,11 +149,13 @@ type MergeRequestServiceClient interface { | |||||
| 149 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 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 | 150 | // token limited to branches, write access to the target branch | ||
| 151 | // (permission_denied otherwise). The server records the caller, the mode and | 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 | 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 | 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 | 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, | 155 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or |
| 156 | - | // and with failed_precondition if the merge request is not open, is a draft, | 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, | |||
| 157 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | 159 | // 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. | 160 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | ||
| 159 | // Publishes MergeRequestAutoMergeEnabled. Needs the | 161 | // Publishes MergeRequestAutoMergeEnabled. Needs the | ||
| @@ -409,11 +411,13 @@ type MergeRequestServiceHandler interface { | |||||
| 409 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 411 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | ||
| 410 | // token limited to branches, write access to the target branch | 412 | // token limited to branches, write access to the target branch | ||
| 411 | // (permission_denied otherwise). The server records the caller, the mode and | 413 | // (permission_denied otherwise). The server records the caller, the mode and | ||
| 412 | - | // the current head; it merges as the caller, after resolving the caller | 414 | + | // the head the caller saw; 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 | 415 | // 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 | 416 | // 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, | 417 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or |
| 416 | - | // and with failed_precondition if the merge request is not open, is a draft, | 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, | |||
| 417 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | 421 | // 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. | 422 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | ||
| 419 | // Publishes MergeRequestAutoMergeEnabled. Needs the | 423 | // Publishes MergeRequestAutoMergeEnabled. Needs the | ||
M gen/ermite/merge_request.pb.go +16 -3 generated file: collapsed
M proto/ermite/merge_request.proto +10 -3
| @@ -322,11 +322,13 @@ service MergeRequestService { | |||
| 322 | 322 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | |
| 323 | 323 | // token limited to branches, write access to the target branch | |
| 324 | 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 | |
| 325 | + | // the head the caller saw; it merges as the caller, after resolving the caller | |
| 326 | 326 | // again, and cancels the auto-merge if the caller can no longer merge, if the | |
| 327 | 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, | |
| 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, | |
| 330 | 332 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | |
| 331 | 333 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | |
| 332 | 334 | // Publishes MergeRequestAutoMergeEnabled. Needs the | |
| @@ -591,6 +593,11 @@ message EnableAutoMergeRequest { | |||
| 591 | 593 | // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode | |
| 592 | 594 | // must be in RepoSettings.allowed_merge_modes of the repository. | |
| 593 | 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; | |
| 594 | 601 | } | |
| 595 | 602 | ||
| 596 | 603 | // EnableAutoMergeResponse holds the merge request with auto-merge enabled. | |
| @@ -322,11 +322,13 @@ service MergeRequestService { | |||||
| 322 | // RepoSettings.failing_checks_block says. Needs the mr:merge scope and, for a | 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 | 323 | // token limited to branches, write access to the target branch | ||
| 324 | // (permission_denied otherwise). The server records the caller, the mode and | 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 | 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 | 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 | 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, | 328 | + | // turned off. Fails with invalid_argument if the mode is not a merge mode or |
| 329 | - | // and with failed_precondition if the merge request is not open, is a draft, | 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, | |||
| 330 | // RepoSettings.allow_auto_merge is off, the mode is not allowed by | 332 | // 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. | 333 | // RepoSettings, or the server has no CI. Enabling again replaces the mode. | ||
| 332 | // Publishes MergeRequestAutoMergeEnabled. Needs the | 334 | // Publishes MergeRequestAutoMergeEnabled. Needs the | ||
| @@ -591,6 +593,11 @@ message EnableAutoMergeRequest { | |||||
| 591 | // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode | 593 | // Mode is how to merge. MERGE_MODE_UNSPECIFIED means fast-forward. The mode | ||
| 592 | // must be in RepoSettings.allowed_merge_modes of the repository. | 594 | // must be in RepoSettings.allowed_merge_modes of the repository. | ||
| 593 | MergeMode mode = 3; | 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; | |||
| 594 | } | 601 | } | ||
| 595 | 602 | ||||
| 596 | // EnableAutoMergeResponse holds the merge request with auto-merge enabled. | 603 | // EnableAutoMergeResponse holds the merge request with auto-merge enabled. | ||