public bool Status(StatusLevel statusLevel, DetailLevel detailLevel) { if (!active) { return(false); } string arguments = "status --xml"; if (statusLevel == StatusLevel.Remote) { arguments += " -u"; } if (detailLevel == DetailLevel.Verbose) { arguments += " -v"; } CommandLineOutput commandLineOutput; using (var svnStatusTask = CreateSVNCommandLine(arguments)) { commandLineOutput = ExecuteOperation(svnStatusTask); } if (commandLineOutput == null || commandLineOutput.Failed || string.IsNullOrEmpty(commandLineOutput.OutputStr) || !active) { return(false); } try { var db = SVNStatusXMLParser.SVNParseStatusXML(commandLineOutput.OutputStr); lock (statusDatabaseLockToken) { foreach (var statusIt in db) { var status = statusIt.Value; status.reflectionLevel = statusLevel == StatusLevel.Remote ? VCReflectionLevel.Repository : VCReflectionLevel.Local; statusDatabase[statusIt.Key] = status; } } lock (requestQueueLockToken) { foreach (var assetIt in db.Keys) { if (statusLevel == StatusLevel.Remote) { remoteRequestQueue.Remove(assetIt.Compose()); } localRequestQueue.Remove(assetIt.Compose()); } } OnStatusCompleted(); } catch (XmlException) { return(false); } return(true); }
public bool Status(IEnumerable <string> assets, StatusLevel statusLevel) { if (!active) { return(false); } if (statusLevel == StatusLevel.Previous) { statusLevel = StatusLevel.Local; foreach (var assetIt in assets) { if (GetAssetStatus(assetIt).reflectionLevel == VCReflectionLevel.Repository && statusLevel == StatusLevel.Local) { statusLevel = StatusLevel.Remote; } } } if (statusLevel == StatusLevel.Remote) { assets = RemoveFilesIfParentFolderInList(assets); } const int assetsPerStatus = 20; if (assets.Count() > assetsPerStatus) { return(Status(assets.Take(assetsPerStatus), statusLevel) && Status(assets.Skip(assetsPerStatus), statusLevel)); } string arguments = "status --xml -q -v "; if (statusLevel == StatusLevel.Remote) { arguments += "-u "; } else { arguments += " --depth=infinity "; } arguments += ConcatAssetPaths(RemoveFilesIfParentFolderInList(RemoveWorkingDirectoryFromPath(assets))); SetPending(assets); CommandLineOutput commandLineOutput; using (var svnStatusTask = CreateSVNCommandLine(arguments)) { commandLineOutput = ExecuteOperation(svnStatusTask); } if (commandLineOutput == null || commandLineOutput.Failed || string.IsNullOrEmpty(commandLineOutput.OutputStr) || !active) { return(false); } try { var db = SVNStatusXMLParser.SVNParseStatusXML(commandLineOutput.OutputStr); lock (statusDatabaseLockToken) { foreach (var statusIt in db) { var status = statusIt.Value; status.reflectionLevel = statusLevel == StatusLevel.Remote ? VCReflectionLevel.Repository : VCReflectionLevel.Local; statusDatabase[statusIt.Key] = status; } } lock (requestQueueLockToken) { foreach (var assetIt in db.Keys) { if (statusLevel == StatusLevel.Remote) { remoteRequestQueue.Remove(assetIt.Compose()); } localRequestQueue.Remove(assetIt.Compose()); } } OnStatusCompleted(); } catch (XmlException e) { DebugLog.ThrowException(e); return(false); } return(true); }