view mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PullCommand.java @ 349:e0464f11206c

TW-19698 Handle unrelated repositories When repository becames unrelated - clone it in different directory on the server. When changes are collected and any of revisions is from unrelated repository - return empty changes collection.
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Thu, 12 Jan 2012 18:21:07 +0400
parents fd56b9524834
children 15c86ab0046c
line wrap: on
line source

/*
 * Copyright 2000-2011 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;

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

import java.io.File;

/**
 * @author Pavel.Sher
 *         Date: 14.07.2008
 */
public class PullCommand extends VcsRootCommand {

  private final String myPullUrl;

  public PullCommand(@NotNull Settings settings, @NotNull File workingDir) {
    this(settings, workingDir, settings.getRepositoryUrlWithCredentials());
  }

  public PullCommand(@NotNull Settings settings, @NotNull File workingDir, @NotNull String pullUrl) {
    super(settings, workingDir);
    myPullUrl = pullUrl;
  }

  public void execute(int timeout) throws VcsException {
    GeneralCommandLine cli = createCommandLine();
    cli.addParameter("pull");
    cli.addParameter(myPullUrl);
    CommandResult result = CommandUtil.runCommand(cli, timeout, getPrivateData(), false);
    CommandUtil.checkCommandFailed(result);
  }
}