Commit 82b56955 authored by Ladislav Kaiser's avatar Ladislav Kaiser
Browse files

added squashOption to Project

parent dbee5bad
...@@ -850,6 +850,29 @@ public interface Constants { ...@@ -850,6 +850,29 @@ public interface Constants {
} }
} }
/** Enum for the build_git_strategy of the project instance. */
enum SquashOption {
NEVER, ALWAYS, DEFAULT_ON, DEFAULT_OFF;
private static JacksonJsonEnumHelper<SquashOption> enumHelper = new JacksonJsonEnumHelper<>(SquashOption.class);
@JsonCreator
public static SquashOption forValue(String value) {
return enumHelper.forValue(value);
}
@JsonValue
public String toValue() {
return (enumHelper.toString(this));
}
@Override
public String toString() {
return (enumHelper.toString(this));
}
}
/** Enum for the build_git_strategy of the project instance. */ /** Enum for the build_git_strategy of the project instance. */
enum BuildGitStrategy { enum BuildGitStrategy {
......
...@@ -238,7 +238,8 @@ public class ImportExportApi extends AbstractApi { ...@@ -238,7 +238,8 @@ public class ImportExportApi extends AbstractApi {
.withParam("initialize_with_readme", overrideParams.getInitializeWithReadme()) .withParam("initialize_with_readme", overrideParams.getInitializeWithReadme())
.withParam("packages_enabled", overrideParams.getPackagesEnabled()) .withParam("packages_enabled", overrideParams.getPackagesEnabled())
.withParam("build_git_strategy", overrideParams.getBuildGitStrategy()) .withParam("build_git_strategy", overrideParams.getBuildGitStrategy())
.withParam("build_coverage_regex", overrideParams.getBuildCoverageRegex()); .withParam("build_coverage_regex", overrideParams.getBuildCoverageRegex())
.withParam("squash_option", overrideParams.getSquashOption());
} }
Response response = upload(Response.Status.CREATED, "file", exportFile, null, formData, url); Response response = upload(Response.Status.CREATED, "file", exportFile, null, formData, url);
......
...@@ -924,7 +924,7 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -924,7 +924,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @throws GitLabApiException if any exception occurs * @throws GitLabApiException if any exception occurs
*/ */
public Project createProject(String name, String path) throws GitLabApiException { public Project createProject(String name, String path) throws GitLabApiException {
if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) { if ((name == null || name.trim().isEmpty()) && (path == null || path.trim().isEmpty())) {
throw new RuntimeException("Either name or path must be specified."); throw new RuntimeException("Either name or path must be specified.");
} }
...@@ -976,6 +976,7 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -976,6 +976,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* packagesEnabled (optional) - Enable or disable mvn packages repository feature * packagesEnabled (optional) - Enable or disable mvn packages repository feature
* buildGitStrategy (optional) - set the build git strategy * buildGitStrategy (optional) - set the build git strategy
* buildCoverageRegex (optional) - set build coverage regex * buildCoverageRegex (optional) - set build coverage regex
* squashOption (optional) - set squash option for merge requests
* *
* @param project the Project instance with the configuration for the new project * @param project the Project instance with the configuration for the new project
* @param importUrl the URL to import the repository from * @param importUrl the URL to import the repository from
...@@ -1024,7 +1025,8 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -1024,7 +1025,8 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("build_git_strategy", project.getBuildGitStrategy()) .withParam("build_git_strategy", project.getBuildGitStrategy())
.withParam("build_coverage_regex", project.getBuildCoverageRegex()) .withParam("build_coverage_regex", project.getBuildCoverageRegex())
.withParam("suggestion_commit_message", project.getSuggestionCommitMessage()) .withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
.withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge()); .withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge())
.withParam("squash_option", project.getSquashOption());
Namespace namespace = project.getNamespace(); Namespace namespace = project.getNamespace();
if (namespace != null && namespace.getId() != null) { if (namespace != null && namespace.getId() != null) {
...@@ -1222,6 +1224,7 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -1222,6 +1224,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* packagesEnabled (optional) - Enable or disable mvn packages repository feature * packagesEnabled (optional) - Enable or disable mvn packages repository feature
* buildGitStrategy (optional) - set the build git strategy * buildGitStrategy (optional) - set the build git strategy
* buildCoverageRegex (optional) - set build coverage regex * buildCoverageRegex (optional) - set build coverage regex
* squashOption (optional) - set squash option for merge requests
* *
* NOTE: The following parameters specified by the GitLab API edit project are not supported: * NOTE: The following parameters specified by the GitLab API edit project are not supported:
* import_url * import_url
...@@ -1270,7 +1273,8 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -1270,7 +1273,8 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("build_coverage_regex", project.getBuildCoverageRegex()) .withParam("build_coverage_regex", project.getBuildCoverageRegex())
.withParam("merge_method", project.getMergeMethod()) .withParam("merge_method", project.getMergeMethod())
.withParam("suggestion_commit_message", project.getSuggestionCommitMessage()) .withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
.withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge()); .withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge())
.withParam("squash_option", project.getSquashOption());
if (isApiVersion(ApiVersion.V3)) { if (isApiVersion(ApiVersion.V3)) {
formData.withParam("visibility_level", project.getVisibilityLevel()); formData.withParam("visibility_level", project.getVisibilityLevel());
......
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import org.gitlab4j.api.Constants.AutoDevopsDeployStrategy; import org.gitlab4j.api.Constants.AutoDevopsDeployStrategy;
import org.gitlab4j.api.Constants.BuildGitStrategy; import org.gitlab4j.api.Constants.BuildGitStrategy;
import org.gitlab4j.api.Constants.SquashOption;
import org.gitlab4j.api.ProjectLicense; import org.gitlab4j.api.ProjectLicense;
import org.gitlab4j.api.models.ImportStatus.Status; import org.gitlab4j.api.models.ImportStatus.Status;
import org.gitlab4j.api.utils.JacksonJson; import org.gitlab4j.api.utils.JacksonJson;
...@@ -105,6 +106,7 @@ public class Project { ...@@ -105,6 +106,7 @@ public class Project {
private Boolean autocloseReferencedIssues; private Boolean autocloseReferencedIssues;
private Boolean emailsDisabled; private Boolean emailsDisabled;
private String suggestionCommitMessage; private String suggestionCommitMessage;
private SquashOption squashOption;
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class) @JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date markedForDeletionOn; private Date markedForDeletionOn;
...@@ -842,4 +844,17 @@ public class Project { ...@@ -842,4 +844,17 @@ public class Project {
public void setSuggestionCommitMessage(String suggestionCommitMessage) { public void setSuggestionCommitMessage(String suggestionCommitMessage) {
this.suggestionCommitMessage = suggestionCommitMessage; this.suggestionCommitMessage = suggestionCommitMessage;
} }
public SquashOption getSquashOption() {
return squashOption;
}
public void setSquashOption(SquashOption squashOption) {
this.squashOption = squashOption;
}
public Project withSquashOption(SquashOption squashOption) {
this.squashOption = squashOption;
return this;
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment