private void UpdateChachesThreaded(object statusObj) { Monitor.Enter(commitCachesLock); try { GitRepoStatus status = (GitRepoStatus)statusObj; //update all branches cachedBranches = GitManager.Repository.Branches.Select(b => new BranchInfo(b)).ToArray(); //update selected branch UpdateSelectedBranch(); int commitCount = 0; if (selectedBranch != null) { //update commits and limit them depending on settings var loadedBranch = selectedBranch.LoadBranch(); if (loadedBranch != null && loadedBranch.Commits != null) { IEnumerable <Commit> commits = GitManager.Settings.MaxCommits >= 0 ? loadedBranch.Commits.Take(GitManager.Settings.MaxCommits) : loadedBranch.Commits; if (commits != null) { cachedCommits = commits.Take(GitManager.Settings.MaxCommits).Select(c => new CommitInfo(c, cachedBranches.Where(b => b.Tip.Id == c.Id).ToArray())).ToArray(); commitCount = cachedCommits.Length; } } } commitRects = new Rect[commitCount]; hasConflicts = status.Any(s => s.Status == FileStatus.Conflicted); GitManager.ActionQueue.Enqueue(UpdateGitStatusIcon); GitManager.ActionQueue.Enqueue(Repaint); } catch (Exception e) { Debug.LogException(e); } finally { Monitor.Exit(commitCachesLock); } }
private void UpdateChaches(GitRepoStatus status) { try { //update all branches cachedBranches = gitManager.Repository.Branches.Select(b => new BranchInfo(b)).ToArray(); //update selected branch SetSelectedBranch(selectedBranchName); int commitCount = 0; CommitInfo[] newCachedCommits = null; if (selectedBranch != null) { //update commits and limit them depending on settings var loadedBranch = selectedBranch.LoadBranch(gitManager); if (loadedBranch != null && loadedBranch.Commits != null) { Commit[] commits = loadedBranch.Commits.Take(maxCommitsCount).ToArray(); newCachedCommits = new CommitInfo[commits.Length]; for (int i = 0; i < commits.Length; i++) { newCachedCommits[i] = new CommitInfo(commits[i], cachedBranches.Where(b => b.Tip.Id == commits[i].Id).ToArray()); } commitCount = newCachedCommits.Length; } } commitRects = new Rect[commitCount]; cachedCommits = newCachedCommits; hasConflicts = status.Any(s => s.Status == FileStatus.Conflicted); } catch (Exception e) { Debug.LogException(e); } }