// Executed in a worker thread. protected override GuidStatusDatasBind[] GatherDataInThread() { var statusOptions = new SVNStatusDataOptions() { Depth = SVNStatusDataOptions.SearchDepth.Infinity, RaiseError = false, Timeout = WiseSVNIntegration.ONLINE_COMMAND_TIMEOUT * 2, Offline = !SVNPreferencesManager.Instance.DownloadRepositoryChanges && !SVNPreferencesManager.Instance.ProjectPrefs.EnableAutoLocking, FetchLockOwner = true, }; // Will get statuses of all added / modified / deleted / conflicted / unversioned files. Only normal files won't be listed. var statuses = WiseSVNIntegration.GetStatuses("Assets", statusOptions) #if UNITY_2018_4_OR_NEWER .Concat(WiseSVNIntegration.GetStatuses("Packages", statusOptions)) #endif .Where(s => s.Status != VCFileStatus.Missing) .ToList(); for (int i = 0, count = statuses.Count; i < count; ++i) { var statusData = statuses[i]; // Statuses for entries under unversioned directories are not returned. Add them manually. if (statusData.Status == VCFileStatus.Unversioned && Directory.Exists(statusData.Path)) { try { var paths = Directory.EnumerateFileSystemEntries(statusData.Path, "*", SearchOption.AllDirectories) .Where(path => !WiseSVNIntegration.IsHiddenPath(path)) ; statuses.AddRange(paths .Select(path => path.Replace(WiseSVNIntegration.ProjectRoot, "")) .Select(path => new SVNStatusData() { Status = VCFileStatus.Unversioned, Path = path, LockDetails = LockDetails.Empty }) ); } catch (Exception) { // Files must have changed while scanning. Nothing we can do. } } } // HACK: the base class works with the DataType for pending data. Guid won't be used. return(statuses .Where(s => statuses.Count < SanityStatusesLimit || // Include everything when below the limit s.Status == VCFileStatus.Added || s.Status == VCFileStatus.Modified || s.Status == VCFileStatus.Conflicted ) .Select(s => new GuidStatusDatasBind() { MergedStatusData = s }) .ToArray()); }
// Executed in a worker thread. private void GatherSVNStatuses() { try { var statusOptions = new SVNStatusDataOptions() { Depth = SVNStatusDataOptions.SearchDepth.Infinity, RaiseError = false, Timeout = WiseSVNIntegration.COMMAND_TIMEOUT * 2, Offline = !SVNPreferencesManager.Instance.DownloadRepositoryChanges, FetchLockOwner = true, }; // Will get statuses of all added / modified / deleted / conflicted / unversioned files. Only normal files won't be listed. var statuses = WiseSVNIntegration.GetStatuses("Assets", statusOptions) // Deleted svn file can still exist for some reason. Need to show it as deleted. // If file doesn't exists, skip it as we can't show it anyway. .Where(s => s.Status != VCFileStatus.Deleted || File.Exists(s.Path)) .Where(s => s.Status != VCFileStatus.Missing) .ToList(); for (int i = 0, count = statuses.Count; i < count; ++i) { var statusData = statuses[i]; // Statuses for entries under unversioned directories are not returned. Add them manually. if (statusData.Status == VCFileStatus.Unversioned && Directory.Exists(statusData.Path)) { var paths = Directory.EnumerateFileSystemEntries(statusData.Path, "*", SearchOption.AllDirectories) .Where(path => !WiseSVNIntegration.IsHiddenPath(path)) ; statuses.AddRange(paths .Select(path => path.Replace(WiseSVNIntegration.ProjectRoot, "")) .Select(path => new SVNStatusData() { Status = VCFileStatus.Unversioned, Path = path, LockDetails = LockDetails.Empty }) ); } } if (PendingUpdate == false) { throw new Exception("SVN thread finished work but the update is over?"); } m_PendingStatuses = statuses.ToArray(); } // Most probably the assembly got reloaded and the thread was aborted. catch (System.Threading.ThreadAbortException) { System.Threading.Thread.ResetAbort(); // Should always be true. if (PendingUpdate) { m_PendingStatuses = new SVNStatusData[0]; } } catch (Exception ex) { Debug.LogException(ex); // Should always be true. if (PendingUpdate) { m_PendingStatuses = new SVNStatusData[0]; } } }