All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.bamboo.specs.builders.task.VcsCommitTask Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.builders.task;

import com.atlassian.bamboo.specs.model.task.VcsCommitTaskProperties;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

import static com.atlassian.bamboo.specs.api.validators.common.ImporterUtils.checkNotNull;

/**
 * This task will commit all local changes to a repository. For
 * DVCS repositories (which distinguish
 * between local and remote commits) this task will also push the commits to the remote repository.
 */
public class VcsCommitTask extends BaseVcsTask {
    @NotNull
    private String commitMessage;

    /**
     * Sets the message to be used for committing.
     */
    public VcsCommitTask commitMessage(@NotNull String commitMessage) {
        checkNotNull("commitMessage", commitMessage);
        this.commitMessage = commitMessage;
        return this;
    }

    @NotNull
    @Override
    protected VcsCommitTaskProperties build() {
        return new VcsCommitTaskProperties(
                description,
                taskEnabled,
                requirements,
                conditions,
                defaultRepository,
                repository,
                workingSubdirectory,
                commitMessage);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof VcsCommitTask)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        VcsCommitTask that = (VcsCommitTask) o;
        return commitMessage.equals(that.commitMessage);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), commitMessage);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy