[hg] don't check for incoming/outgoing changes if there is no default repository.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 13 Apr 2011 15:47:05 +0000 (19:47 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Thu, 14 Apr 2011 06:52:03 +0000 (10:52 +0400)
For outgoing changes check default-push instead of default (if exists).

plugins/hg4idea/src/org/zmlx/hg4idea/command/HgOutgoingCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgRemoteChangesetsCommand.java

index a14eb43e2cacbdd497bfde89420e90effe8aa0d5..cc045d2affd7c66b1e5c6c6b8c77d7b37058097a 100644 (file)
@@ -13,6 +13,7 @@
 package org.zmlx.hg4idea.command;
 
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
 
 public class HgOutgoingCommand extends HgRemoteChangesetsCommand {
 
@@ -20,4 +21,8 @@ public class HgOutgoingCommand extends HgRemoteChangesetsCommand {
     super(project, "outgoing");
   }
 
+  protected String getRepositoryUrl(VirtualFile repo) {
+    return new HgShowConfigCommand(project).getDefaultPushPath(repo);
+  }
+
 }
index 2dedb57a86cb913bb79af3dee46c727b67ab77da..702e419c1ca3c68afa53f18bc000e5d0b99b831f 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.notification.Notification;
 import com.intellij.notification.NotificationListener;
 import com.intellij.notification.NotificationType;
 import com.intellij.notification.Notifications;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.options.ShowSettingsUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -36,6 +37,9 @@ import java.util.List;
  * @author Kirill Likhodedov
  */
 public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand {
+
+  private static final Logger LOG = Logger.getInstance(HgRemoteChangesetsCommand.class);
+
   public HgRemoteChangesetsCommand(Project project, String command) {
     super(project, command);
   }
@@ -50,9 +54,17 @@ public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand {
     return true;
   }
 
+  protected String getRepositoryUrl(VirtualFile repo) {
+    return new HgShowConfigCommand(project).getDefaultPath(repo);
+  }
+
   @Override
   protected HgCommandResult executeCommand(VirtualFile repo, List<String> args) {
-    String repositoryURL = new HgShowConfigCommand(project).getDefaultPath(repo);
+    String repositoryURL = getRepositoryUrl(repo);
+    if (repositoryURL == null) {
+      LOG.info("executeCommand no default path configured");
+      return null;
+    }
     HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repo, command, args);
     if (result == HgCommandResult.CANCELLED) {
       final HgVcs vcs = HgVcs.getInstance(project);