private CommandLineOutput ExecuteOperation(CommandLine commandLine, bool useOperationLock = true) { CommandLineOutput commandLineOutput; if (useOperationLock) { lock (operationActiveLockToken) { commandLineOutput = ExecuteCommandLine(commandLine); } } else { commandLineOutput = ExecuteCommandLine(commandLine); } //if (commandLineOutput.Arguments.Contains("ExceptionTest.txt")) //{ // throw new VCCriticalException("Test Exception cast due to ExceptionTest.txt being a part of arguments", commandLine.ToString()); //} if (!string.IsNullOrEmpty(commandLineOutput.ErrorStr)) { var errStr = commandLineOutput.ErrorStr; if (errStr.Contains("E170001") || errStr.Contains("get username or password")) throw new VCMissingCredentialsException(errStr, commandLine.ToString()); else if (errStr.Contains("W160042") || errStr.Contains("Newer Version")) throw new VCNewerVersionException(errStr, commandLine.ToString()); else if (errStr.Contains("W155007") || errStr.Contains("'" + workingDirectory + "'" + " is not a working copy")) throw new VCCriticalException(errStr, commandLine.ToString()); else if (errStr.Contains("E720005") || errStr.Contains("Access is denied")) throw new VCCriticalException(errStr, commandLine.ToString()); else if (errStr.Contains("E160028") || errStr.Contains("is out of date")) throw new VCOutOfDate(errStr, commandLine.ToString()); else if (errStr.Contains("E155037") || errStr.Contains("E155004") || errStr.Contains("run 'svn cleanup'") || errStr.Contains("run 'cleanup'")) throw new VCLocalCopyLockedException(errStr, commandLine.ToString()); else if (errStr.Contains("W160035") || errStr.Contains("is already locked by user")) throw new VCLockedByOther(errStr, commandLine.ToString()); else if (errStr.Contains("E730060") || errStr.Contains("Unable to connect") || errStr.Contains("is unreachable") || errStr.Contains("Operation timed out") || errStr.Contains("Can't connect to")) throw new VCConnectionTimeoutException(errStr, commandLine.ToString()); else if (errStr.Contains("W200017")) // Ignore warning relating to use of propget on non-existing property in SVN 1.9+ commandLineOutput = new CommandLineOutput(commandLineOutput.Command, commandLineOutput.Arguments, commandLineOutput.OutputStr, "", 0); else throw new VCException(errStr, commandLine.ToString()); } return commandLineOutput; }
public CommandLineOutput ExecuteOperation(CommandLine commandLine, bool useOperationLock = true) { CommandLineOutput commandLineOutput; if (useOperationLock) { lock (operationActiveLockToken) { commandLineOutput = ExecuteCommandLine(commandLine); } } else { commandLineOutput = ExecuteCommandLine(commandLine); } //D.Log(commandLineOutput + " " + commandLine.ToString()); if (commandLineOutput != null) { if (!String.IsNullOrEmpty(commandLineOutput.ErrorStr)) { var errStr = commandLineOutput.ErrorStr; if (errStr.Contains(" - no file(s) to reconcile.")) { // this is not an error - put this text in the OutputStr and clear ErrorStr commandLineOutput = new CommandLineOutput(commandLine.ToString(), "", errStr, "", 0); } else if (errStr.Contains(" - no such file(s).")) { // this is not an error - put this text in the OutputStr and clear ErrorStr commandLineOutput = new CommandLineOutput(commandLine.ToString(), "", errStr, "", 0); } else { D.Log("ERROR: " + errStr + " " + commandLine.ToString()); } // D.Log(commandLineOutput.OutputStr); } //D.Log(commandLineOutput.OutputStr); } return commandLineOutput; }
private CommandLineOutput ExecuteCommandLine(CommandLine commandLine) { CommandLineOutput commandLineOutput; try { D.Log(commandLine.ToString()); currentExecutingOperation = commandLine; //System.Threading.Thread.Sleep(500); // emulate latency to SVN server commandLineOutput = commandLine.Execute(); } catch (Exception e) { if (e.StackTrace.Contains("System.IO.MonoSyncFileStream/ReadDelegate")) { throw new VCMonoDebuggerAttachedException(e.Message, commandLine.ToString(), e); } throw new VCCriticalException(e.Message, commandLine.ToString(), e); } finally { currentExecutingOperation = null; } return commandLineOutput; }