CreateChange: Allow create change on new branch
We currently disallow creating a new change through CreateChange
endpoint against a non-existent branch, but we don't really have a
problem with that (except for preventing typos).
In this change, we split ChangeInfo into ChangeInfo and ChangeInput.
Added a new new_branch field in ChangeInput, default to false to
protect against typos, and when it's set to true, allow new change
against a non-existent branch.
Currently it's only implemented in the API, but not in the UI.
Change-Id: I6e661f036b121a33de183c126b763d29b5f2bc93
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index a5dffd1..7a907ba 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -13,10 +13,8 @@
'POST /changes'
--
-The change info link:#change-info[ChangeInfo] entity must be provided in the
-request body. Only the following attributes are honored: `project`,
-`branch`, `subject`, `status` and `topic`. The first three attributes are
-mandatory. Valid values for status are: `DRAFT` and `NEW`.
+The change input link:#change-input[ChangeInput] entity must be provided in the
+request body.
.Request
----
@@ -4016,9 +4014,29 @@
|`problems` |optional|
A list of link:#problem-info[ProblemInfo] entities describing potential
problems with this change. Only set if link:#check[CHECK] is set.
+|==================================
+
+[[change-input]]
+=== ChangeInput
+The `ChangeInput` entity contains information about creating a new change.
+
+[options="header",cols="1,^1,5"]
+|==================================
+|Field Name ||Description
+|`project` ||The name of the project.
+|`branch` ||
+The name of the target branch. +
+The `refs/heads/` prefix is omitted.
+|`subject` ||
+The subject of the change (header line of the commit message).
+|`topic` |optional|The topic to which this change belongs.
+|`status` |optional, default to `NEW`|
+The status of the change (only `NEW` and `DRAFT` accepted here).
|`base_change` |optional|
A link:#change-id[\{change-id\}] that identifies the base change for a create
-change operation. Only used for the link:#create-change[CreateChange] endpoint.
+change operation.
+|`new_branch` |optional, default to `false`|
+Allow creating a new branch when set to `true`.
|==================================
[[change-message-info]]