Support inheriting project submit type
Change Project to only expose the configured submit type for that
project, and modify all callers to call the equivalent method on
ProjectState which respects inheritance.
In the extension/REST API, expose the inherited submit type analogously
to the inherited boolean values, using an object containing configured
and inherited values. For backwards compatibility, leave the old
submit_type field as-is, but mark it deprecated, in the hopes that we
can eventually replace it.
Do not change the default of a project with no configured submit type,
leaving the default as MERGE_IF_NECESSARY. This avoids, for now, the
need for migrating existing projects that do not have a submit type set,
including those that were created outside of Gerrit and don't have
refs/meta/config at all.
After this change, the global `repository.<name>.defaultSubmitType`
configuration still takes effect when creating a new project. A later
change may remove support for defaultSubmitType, but the migration to
convert global config into appropriate inheritable config values is
nontrivial, so we're punting on it.
Change-Id: Ib5711baaa67b2c92239a1ff4564349a80d211c28
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index fec430f..949d2eb 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -494,7 +494,7 @@
{
"description": "This is a demo project.",
- "submit_type": "CHERRY_PICK",
+ "submit_type": "INHERIT",
"owners": [
"MyProject-Owners"
]
@@ -821,7 +821,12 @@
"configured_value": "15m",
"inherited_value": "20m"
},
- "submit_type": "MERGE_IF_NECESSARY",
+ "submit_type": "INHERIT",
+ "default_submit_type": {
+ "value": "MERGE_IF_NECESSARY",
+ "configured_value": "INHERIT",
+ "inherited_value": "MERGE_IF_NECESSARY"
+ },
"state": "ACTIVE",
"commentlinks": {},
"plugin_config": {
@@ -933,6 +938,11 @@
"inherited_value": "20m"
},
"submit_type": "REBASE_IF_NECESSARY",
+ "default_submit_type": {
+ "value": "REBASE_IF_NECESSARY",
+ "configured_value": "INHERIT",
+ "inherited_value": "REBASE_IF_NECESSARY"
+ },
"state": "ACTIVE",
"commentlinks": {}
}
@@ -2846,10 +2856,12 @@
The link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
limit] of this project as a link:#max-object-size-limit-info[
MaxObjectSizeLimitInfo] entity.
+|`default_submit_type` ||
+link:#submit-type-info[SubmitTypeInfo] that describes the default submit type of
+the project, when not overridden at the change level.
|`submit_type` ||
-The default submit type of the project, can be `MERGE_IF_NECESSARY`,
-`FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or
-`CHERRY_PICK`.
+Deprecated; equivalent to link:#submit-type-info[`value`] in
+`default_submit_type`.
|`match_author_to_committer_date` |optional|
link:#inherited-boolean-info[InheritedBooleanInfo] that indicates whether
a change's author date will be changed to match its submitter date upon submit.
@@ -3317,6 +3329,27 @@
|`size_of_packed_objects` |Size of packed objects in bytes.
|======================================
+[[submit-type-info]]
+=== SubmitTypeInfo
+Information about the link:project-configuration.html#submit_type[default submit
+type of a project], taking into account project inheritance.
+
+Valid values for each field are `MERGE_IF_NECESSARY`, `FAST_FORWARD_ONLY`,
+`REBASE_IF_NECESSARY`, `REBASE_ALWAYS`, `MERGE_ALWAYS` or `CHERRY_PICK`, plus
+`INHERIT` where applicable.
+
+[options="header",cols="1,6"]
+|===============================
+|Field Name |Description
+|`value` |
+The effective submit type value. Never `INHERIT`.
+|`configured_value` |
+The configured value, can be one of the submit types, or `INHERIT` to inherit
+from the parent project.
+|`inherited_value` |
+The effective value that would be inherited from the parent. Never `INHERIT`.
+|===============================
+
[[tag-info]]
=== TagInfo
The `TagInfo` entity contains information about a tag.