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
This commit is contained in:
@@ -37,7 +37,9 @@ public class ConfigInfo {
|
||||
public InheritedBooleanInfo matchAuthorToCommitterDate;
|
||||
|
||||
public MaxObjectSizeLimitInfo maxObjectSizeLimit;
|
||||
@Deprecated // Equivalent to defaultSubmitType.value
|
||||
public SubmitType submitType;
|
||||
public SubmitTypeInfo defaultSubmitType;
|
||||
public ProjectState state;
|
||||
public Map<String, Map<String, ConfigParameterInfo>> pluginConfig;
|
||||
public Map<String, ActionInfo> actions;
|
||||
@@ -72,4 +74,10 @@ public class ConfigInfo {
|
||||
public List<String> permittedValues;
|
||||
public List<String> values;
|
||||
}
|
||||
|
||||
public static class SubmitTypeInfo {
|
||||
public SubmitType value;
|
||||
public SubmitType configuredValue;
|
||||
public SubmitType inheritedValue;
|
||||
}
|
||||
}
|
||||
|
@@ -15,10 +15,11 @@
|
||||
package com.google.gerrit.extensions.client;
|
||||
|
||||
public enum SubmitType {
|
||||
INHERIT,
|
||||
FAST_FORWARD_ONLY,
|
||||
MERGE_IF_NECESSARY,
|
||||
REBASE_IF_NECESSARY,
|
||||
REBASE_ALWAYS,
|
||||
MERGE_ALWAYS,
|
||||
CHERRY_PICK
|
||||
CHERRY_PICK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user