view mercurial/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PullCommand.java @ 8:2cb2df5a0dcd

fix working directory update (use pull command)
author Pavel.Sher
date Mon, 14 Jul 2008 20:52:10 +0400
parents
children 6989ac0f8cac
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;

import com.intellij.execution.configurations.GeneralCommandLine;
import org.jetbrains.annotations.NotNull;
import jetbrains.buildServer.ExecResult;
import jetbrains.buildServer.SimpleCommandLineProcessRunner;
import jetbrains.buildServer.vcs.VcsException;

/**
 * @author Pavel.Sher
 *         Date: 14.07.2008
 */
public class PullCommand {
  private Settings mySettings;

  public PullCommand(@NotNull final Settings settings) {
    mySettings = settings;
  }

  public void execute() throws VcsException {
    GeneralCommandLine cli = new GeneralCommandLine();
    cli.setExePath(mySettings.getHgCommandPath());
    cli.setWorkDirectory(mySettings.getWorkingDir());
    cli.addParameter("pull");
    cli.addParameter(mySettings.getRepository());
    final ExecResult res = SimpleCommandLineProcessRunner.runCommand(cli, null);
    CommandUtil.checkCommandFailed("hg pull", res);
  }
}