// // Gets the logs for a given set of revisions // public static Log[] GetRevisionLogs(string svnPath, string[] revisions, Logging logger, LogRetrieved logRetrieved) { // We need to track properties throughout the loop Object writeLock = new Object(); List <Log> logs = new List <Log>(); int logCount = 0; // Spin through all the revisions requested ParallelLoopResult result = Parallel.ForEach(revisions, new ParallelOptions { MaxDegreeOfParallelism = 16 }, (thisRevision, loopState) => { // Pull out the log string logOutput = Svn.GetLog(svnPath, thisRevision, true, logger); if (logOutput == null) { loopState.Stop(); } // Get the log we found logger.Log("* Recieved log\n{0}\n", logOutput); // Continue? if (loopState.IsStopped == false) { // Read in the log input Log[] individualLogs = ParseLogOutput(logOutput, logger); if (individualLogs == null) { loopState.Stop(); } // How many did we get logger.Log("* Identified {0} logs", individualLogs.Length); // Continue? if (loopState.IsStopped == false) { // Lock our writes lock (writeLock) { // Add and update logs.AddRange(individualLogs); logRetrieved(++logCount); } } } }); // If we didn't succeed, bail if (result.IsCompleted == false) { logger.Log("* The log generation loop did not complete successfully"); return(null); } // Return all our logs logger.Log("* In total we found {0} logs", logs.Count); return(logs.ToArray()); }