Add the work_in_progress option to the revert and revertSubmission endpoints

Sometimes bots want to validate whether a change break a build/tests by
creating a revert of a change and validating it. Unless the revert fixes
the breakage, it won't need to notify the author of the original change
and/or get reviewed. This notification can cause panic to the former
author.

This change adds a work in progress (WIP) field to the RevertInput that
can be used for testing purposes where reviewers get notified only if we
determine we want to move forward with the revert.

CherryPickChange was also modified with a WIP parameter. Cherry picking
is used by revert submission (the first revert is created normally on
top of the branch tip, subsequent reverts are cherry picked). The
modifications done to CherryPickChange in this change are only used by
RevertSubmission and do not affect the serving path of the cherry pick
endpoint.

Bug: Issue 13357
Change-Id: Ida96151e1bed8d62f19510681154f8940df8e58d
This commit is contained in:
Youssef Elghareeb
2020-09-03 21:56:30 +02:00
parent a59037bda9
commit fd02daeb35
6 changed files with 128 additions and 13 deletions

View File

@@ -17,6 +17,10 @@ package com.google.gerrit.extensions.api.changes;
import com.google.gerrit.extensions.restapi.DefaultInput;
import java.util.Map;
/**
* Input passed to {@code POST /changes/[change-id]/revert} and {@code POST
* /changes/[change-id]/revert_submission}
*/
public class RevertInput {
@DefaultInput public String message;
@@ -26,4 +30,10 @@ public class RevertInput {
public Map<RecipientType, NotifyInfo> notifyDetails;
public String topic;
/**
* Mark the change as work-in-progress. This will also override the {@link #notify} value to
* {@link NotifyHandling#OWNER}
*/
public boolean workInProgress;
}