view mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/VcsRootCommand.java @ 304:e9cdb499350d remote-run/subrepos

Do clean checkout if subrepository URL changed Hg cannot do update correctly in this situation. The only thing that helps is a clean checkout.
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Fri, 09 Sep 2011 11:47:59 +0400
parents 8c1fd2e565ae
children 4a49a0baf30b
line wrap: on
line source
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;

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

import java.io.File;
import java.util.Collections;
import java.util.Set;

/**
 * @author dmitry.neverov
 */
public class VcsRootCommand extends BaseCommand {

  private final Settings mySettings;


  public VcsRootCommand(@NotNull final Settings settings, @NotNull final File workDir) {
    super(settings.getHgCommandPath(), workDir);
    mySettings = settings;
  }


  public Settings getSettings() {
    return mySettings;
  }


  public Set<String> getPrivateData() {
    return Collections.singleton(mySettings.getPassword());
  }


  protected ExecResult runCommand(@NotNull GeneralCommandLine cli) throws VcsException {
    return CommandUtil.runCommand(cli, getPrivateData());
  }


  protected ExecResult runCommand(@NotNull GeneralCommandLine cli, int executionTimeout) throws VcsException {
    return CommandUtil.runCommand(cli, executionTimeout, getPrivateData());
  }


  protected ExecResult runCommand(@NotNull GeneralCommandLine cli, boolean checkFailure) throws VcsException {
    return CommandUtil.runCommand(cli, getPrivateData(), checkFailure);
  }
}