Add an option to keep votes when moving the change to another branch.

The intention of this change is to support master -> main migration.

Today, only the veto votes that are blocking the change from submission
are moved to the destination branch. Adding an option allows admin to
decide what to do with the votes when moving open changes, using a
simple script.

Added 'keepAllVotes' option so it is possible to move all votes. The
option is only allowed to be used by admins at their own risk, because
it affects the submission behavior of the change depending on the label
access configuration and submission rules.

We could squash the user votes to the allowed permission range:
* In that case the original votes would be lost when moving back
to the original branch.
* It is expensive to call permission backend
* The votes are often granted in the context of a specific branch

Other options and considerations in the original discussion:
Iae0443b16151

Change-Id: Ia197a779f93e928604a0d0ea3360825dcfbeb6d9
This commit is contained in:
Marija Savtchouk
2020-12-03 12:58:04 +00:00
parent de50d7ea24
commit cee6a8fed1
4 changed files with 275 additions and 3 deletions

View File

@@ -17,4 +17,14 @@ package com.google.gerrit.extensions.api.changes;
public class MoveInput {
public String message;
public String destinationBranch;
/**
* Whether or not to keep all votes in the destination branch. Keeping the votes can be confusing
* in the context of the destination branch, see
* https://gerrit-review.googlesource.com/c/gerrit/+/129171. That is why only the users with
* {@link com.google.gerrit.server.permissions.GlobalPermission#ADMINISTRATE_SERVER} permissions
* can use this option.
*
* <p>By default, only the veto votes that are blocking the change from submission are moved.
*/
public boolean keepAllVotes;
}