From 8c751bed467931a4e20a5493e11e336d6ab96c39 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 12 Nov 2013 21:37:31 +0400 Subject: [PATCH] svn: Do not handle possible authentication errors (from process output) if command was manually cancelled --- .../idea/svn/commandLine/CommandExecutor.java | 17 ++++++++++------- .../idea/svn/commandLine/CommandRuntime.java | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java index ec48f728c622..77b5f29280a7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandExecutor.java @@ -45,6 +45,7 @@ public class CommandExecutor { private boolean myIsDestroyed; private boolean myNeedsDestroy; private volatile String myDestroyReason; + private volatile boolean myWasCancelled; protected final GeneralCommandLine myCommandLine; protected Process myProcess; protected OSProcessHandler myHandler; @@ -181,7 +182,7 @@ public class CommandExecutor { boolean finished; do { finished = waitFor(500); - if (!finished && (wasError() || needsDestroy() || wasCancelled())) { + if (!finished && (wasError() || needsDestroy() || checkCancelled())) { waitFor(1000); doDestroyProcess(); break; @@ -204,20 +205,22 @@ public class CommandExecutor { } } - private boolean wasCancelled() { - boolean result = false; - - if (myCommand.getCanceller() != null) { + private boolean checkCancelled() { + if (!myWasCancelled && myCommand.getCanceller() != null) { try { myCommand.getCanceller().checkCancelled(); } catch (SVNCancelException e) { // indicates command should be cancelled - result = true; + myWasCancelled = true; } } - return result; + return myWasCancelled; + } + + public boolean wasCancelled() { + return myWasCancelled; } public void destroyProcess() { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java index 614121e559e5..cf82da3c545a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java @@ -105,7 +105,8 @@ public class CommandRuntime { // handle authentication final String errText = executor.getErrorOutput().trim(); final AuthCallbackCase callback = executor instanceof TerminalExecutor ? null : createCallback(errText, command.getRepositoryUrl()); - if (callback != null) { + // do not handle possible authentication errors if command was manually cancelled + if (!executor.wasCancelled() && callback != null) { if (callback.getCredentials(errText)) { if (myAuthCallback.getSpecialConfigDir() != null) { command.setConfigDir(myAuthCallback.getSpecialConfigDir());