view mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java @ 275:13f3e7d0c42c

Implement VersionCommand
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Mon, 01 Aug 2011 16:38:05 +0400
parents
children 8c10f5cec37d
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial;

import jetbrains.buildServer.vcs.impl.VcsRootImpl;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

/**
 * @author dmitry.neverov
 */
public class VcsRootBuilder {

  private String myRepository;
  private String myUsername;
  private String myPassword;
  private long myRootId = 1L;

  public VcsRootImpl build() throws IOException {
    VcsRootImpl vcsRoot = new VcsRootImpl(1, Constants.VCS_NAME);
    vcsRoot.addProperty(Constants.REPOSITORY_PROP, myRepository);
    vcsRoot.addProperty(Constants.HG_COMMAND_PATH_PROP, Util.getHgPath());
    vcsRoot.addProperty(Constants.USERNAME, myUsername);
    vcsRoot.addProperty(Constants.PASSWORD, myPassword);
    return vcsRoot;
  }


  public VcsRootBuilder repository(@NotNull String repository) {
    myRepository = repository;
    return this;
  }


  public VcsRootBuilder username(@NotNull String username) {
    myUsername = username;
    return this;
  }


  public VcsRootBuilder password(@NotNull String password) {
    myPassword = password;
    return this;
  }


  public VcsRootBuilder rootId(long rootId) {
    myRootId = rootId;
    return this;
  }
}