Example #1
0
        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;
        }
Example #2
0
        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;
        }
Example #3
0
 public CommandLineCompletedEventArgs(Exception exception, bool cancelled, CommandLineOutput output)
     : base(exception, cancelled)
 {
     mOutput = output;
 }