[hg] Disable checking for incoming/outgoing changes in case of auth error.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 24 Apr 2011 12:11:07 +0000 (16:11 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Sun, 24 Apr 2011 12:13:05 +0000 (16:13 +0400)
Added authentication error case.
TODO: HgCommandResult.CANCELLED is never returned now.

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

index 702e419c1ca3c68afa53f18bc000e5d0b99b831f..2f127142f2dd4df3f703e266c33a094100d5acc6 100644 (file)
@@ -28,6 +28,7 @@ import org.zmlx.hg4idea.HgProjectSettings;
 import org.zmlx.hg4idea.HgVcs;
 import org.zmlx.hg4idea.execution.HgCommandExecutor;
 import org.zmlx.hg4idea.execution.HgCommandResult;
+import org.zmlx.hg4idea.util.HgErrorUtil;
 
 import javax.swing.event.HyperlinkEvent;
 import java.util.List;
@@ -66,7 +67,7 @@ public abstract class HgRemoteChangesetsCommand extends HgChangesetsCommand {
       return null;
     }
     HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repo, command, args);
-    if (result == HgCommandResult.CANCELLED) {
+    if (result == HgCommandResult.CANCELLED || HgErrorUtil.isAuthorizationError(result)) {
       final HgVcs vcs = HgVcs.getInstance(project);
       Notifications.Bus.notify(new Notification(HgVcs.NOTIFICATION_GROUP_ID, "Checking for incoming/outgoing changes disabled",
                                                 "Authentication is required to check incoming/outgoing changes in " + repositoryURL +