CherryPick: Allow to specify options for the commit validation

When a change is created by pushing a commit for review it is possible
to specify push options. These push options are forwarded to the commit
validation listeners. This enables the commit validation listeners to
skip the validation if a certain push option was set (also see change
If9d82a37c). Push options to skip certain commit validations are for
example supported by the uploadvalidator plugin and the code-owners
plugin.

With this change we allow callers of the Cherry Pick Revision REST
endpoint to set validation options in the CherryPickInput that are
forwarded as push options to the commit validation listeners. This way
commit validation can also be skipped when creating a change / patch set
via the Cherry Pick Revision REST endpoint.

The same is already possible for the Create Change REST endpoint (see
change I936a8b6d6.

This is important when the Cherry Pick Revision REST endpoint is used to
create changes / patch sets with conflicts allowed. If conflicts are
allowed, commit validations that check the validity of files in the
commit will fail if these files contains conflicts (because the Git
conflict markers will be recognised as invalid input). In this case the
change / patch set creation fails due to the validation and so far it
was not possible to skip the validation and make the change / patch set
creation work. By allowing to specify validation options, commit
validations can be skipped now and the change / patch set can be created
with conflicts in the files.

Gerrit core doesn't support any validation options yet, but commit
validation listeners that are implemented in plugins may.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I66dc4cfda33b780125836af44df582355f43133f
Release-Notes: Add support for specifying validation options in Cherry Pick Revision REST endpoint
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index a9b31b0..2642e23 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -6754,28 +6754,28 @@
 
 [options="header",cols="1,^1,5"]
 |===========================
-|Field Name         ||Description
-|`message`          |optional|
+|Field Name          ||Description
+|`message`           |optional|
 Commit message for the cherry-pick change. If not set, the commit message of
 the cherry-picked commit is used.
-|`destination`      ||Destination branch
-|`base`             |optional|
+|`destination`       ||Destination branch
+|`base`              |optional|
 40-hex digit SHA-1 of the commit which will be the parent commit of the newly created change.
 If set, it must be a merged commit or a change revision on the destination branch.
-|`parent`           |optional, defaults to 1|
+|`parent`            |optional, defaults to 1|
 Number of the parent relative to which the cherry-pick should be considered.
-|`notify`           |optional|
+|`notify`            |optional|
 Notify handling that defines to whom email notifications should be sent
 after the cherry-pick. +
 Allowed values are `NONE`, `OWNER`, `OWNER_REVIEWERS` and `ALL`. +
 If not set, the default is `ALL`.
-|`notify_details`   |optional|
+|`notify_details`    |optional|
 Additional information about whom to notify about the update as a map
 of link:user-notify.html#recipient-types[recipient type] to
 link:#notify-info[NotifyInfo] entity.
-|`keep_reviewers`   |optional, defaults to false|
+|`keep_reviewers`    |optional, defaults to false|
 If `true`, carries reviewers and ccs over from original change to newly created one.
-|`allow_conflicts`  |optional, defaults to false|
+|`allow_conflicts`   |optional, defaults to false|
 If `true`, the cherry-pick uses content merge and succeeds also if
 there are conflicts. If there are conflicts the file contents of the
 created change contain git conflict markers to indicate the conflicts.
@@ -6783,7 +6783,7 @@
 `contains_git_conflicts` field in the link:#change-info[ChangeInfo]. If
 there are conflicts the cherry-pick change is marked as
 work-in-progress.
-|`topic`            |optional|
+|`topic`             |optional|
 The topic of the created cherry-picked change. If not set, the default depends
 on the source. If the source is a change with a topic, the resulting topic
 of the cherry-picked change will be {source_change_topic}-{destination_branch}.
@@ -6791,10 +6791,18 @@
 the created change will have no topic.
 If the change already exists, the topic will not change if not set. If set, the
 topic will be overridden.
-|`allow_empty`      |optional, defaults to false|
+|`allow_empty`       |optional, defaults to false|
 If `true`, the cherry-pick succeeds also if the created commit will be empty.
 If `false`, a cherry-pick that would create an empty commit fails without creating
 the commit.
+|`validation_options`|optional|
+Map with key-value pairs that are forwarded as options to the commit validation
+listeners (e.g. can be used to skip certain validations). Which validation
+options are supported depends on the installed commit validation listeners.
+Gerrit core doesn't support any validation options, but commit validation
+listeners that are implemented in plugins may. Please refer to the
+documentation of the installed plugins to learn whether they support validation
+options. Unknown validation options are silently ignored.
 |===========================
 
 [[comment-info]]