Check for Mercurial before setting up test project

This commit is contained in:
Roman Shevchenko
2013-02-28 10:53:39 +01:00
parent 2334d487d3
commit 7536898a11
2 changed files with 5 additions and 23 deletions
@@ -29,29 +29,13 @@ public class HgExecutor extends Executor {
private static final String HG_EXECUTABLE_ENV = "IDEA_TEST_HG_EXECUTABLE";
//private static final String TEAMCITY_HG_EXECUTABLE_ENV = "TEAMCITY_HG_PATH"; //todo var for server testing
private static boolean myVersionPrinted;
private static final String HG_EXECUTABLE = findHgExecutable();
private static String findHgExecutable() {
return findExecutable("hg", "hg", "hg.exe", Arrays.asList(HG_EXECUTABLE_ENV));
}
private static final String HG_EXECUTABLE = findExecutable("hg", "hg", "hg.exe", Arrays.asList(HG_EXECUTABLE_ENV));
public static String hg(String command) {
printVersionTheFirstTime();
List<String> split = StringUtil.split(command, " ");
split.add(0, HG_EXECUTABLE);
log("hg " + command);
for(int attempt = 0; attempt < 3; attempt++) {
return run(split);
}
throw new RuntimeException("fatal error during execution of Hg command: " + command);
return run(split);
}
private static void printVersionTheFirstTime() {
if (!myVersionPrinted) {
myVersionPrinted = true;
hg("version");
}
}
}
@@ -55,6 +55,9 @@ public abstract class HgPlatformTest extends LightPlatformTestCase {
@Override
protected void setUp() throws Exception {
cd(FileUtil.getTempDirectory());
hg("version");
super.setUp();
myProject = getProject();
@@ -65,11 +68,6 @@ public abstract class HgPlatformTest extends LightPlatformTestCase {
setUpHgrc(myRepository);
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
private static void setUpHgrc(VirtualFile repository) {
cd(".hg");
File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea"));