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

com.atlassian.bamboo.specs.builders.task.VcsBranchTask 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.VcsBranchTaskProperties;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

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

/**
 * Task which creates a new branch in a repository. For
 * DVCS repositories (which distinguish
 * between local and remote commits) this task will push the newly created branch to the remote
 * repository.
 */
public class VcsBranchTask extends BaseVcsTask {
    @NotNull
    private String branchName;

    /**
     * Sets the name of the branch to create.
     */
    public VcsBranchTask branchName(@NotNull String branchName) {
        checkNotNull("branchName", branchName);
        this.branchName = branchName;
        return this;
    }

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy