[Mercurial] IDEA-55929: fixed possible valid executable file name for Windows.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Tue, 22 Jun 2010 12:09:31 +0000 (16:09 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Tue, 22 Jun 2010 12:09:31 +0000 (16:09 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgVersionCommand.java

index 377857fe35d1357dc8aaf496c20a5625f5c61df7..a1fdf65f15ec7eee68a150677621fa4fcc46f073 100644 (file)
@@ -75,6 +75,7 @@ public class HgVcs extends AbstractVcs {
   public static final String VCS_NAME = "hg4idea";
   public static final String DIRSTATE_FILE_PATH = ".hg/dirstate";
   public static final String NOTIFICATION_GROUP_ID = "Mercurial";
+  public static final String HG_EXECUTABLE_FILE_NAME = (SystemInfo.isWindows ? "hg.exe" : "hg");
 
   private final HgChangeProvider changeProvider;
   private final HgProjectConfigurable configurable;
@@ -337,7 +338,7 @@ public class HgVcs extends AbstractVcs {
    */
   public String getHgExecutable() {
     if (ApplicationManager.getApplication().isUnitTestMode()) {
-      return (new File(ourTestHgExecutablePath, SystemInfo.isWindows ? "hg.exe" : "hg")).getPath();
+      return (new File(ourTestHgExecutablePath, HG_EXECUTABLE_FILE_NAME)).getPath();
     }
     return globalSettings.getHgExecutable();
   }
index b7fb63b45a3de3866711d75356b56668ce3b2b80..762622ce565435f50fac7bf898e55d7db60150d7 100644 (file)
@@ -13,6 +13,7 @@
 package org.zmlx.hg4idea.command;
 
 import org.apache.commons.lang.StringUtils;
+import org.zmlx.hg4idea.HgVcs;
 
 import java.nio.charset.Charset;
 import java.util.Arrays;
@@ -21,7 +22,7 @@ public class HgVersionCommand {
 
   public boolean isValid(String executable) {
     String hgExecutable = StringUtils.trim(executable);
-    if (!hgExecutable.endsWith("hg")) {
+    if (!hgExecutable.endsWith(HgVcs.HG_EXECUTABLE_FILE_NAME)) {
       return false;
     }
     ShellCommand shellCommand = new ShellCommand();