private async Task UpdateRepositoryAsync(MRepository repository, GitStatus status, IReadOnlyList <string> repoIds) { Log.Debug("Updating repository"); Timing t = new Timing(); //string gitRepositoryPath = repository.WorkingFolder; var branchesResult = await gitBranchService.GetBranchesAsync(CancellationToken.None); if (branchesResult.IsFaulted) { Log.Warn($"Failed to update repo, {branchesResult}"); return; } IReadOnlyList <GitBranch> branches = branchesResult.Value; repository.Status = status ?? await statusService.GetStatusAsync(); t.Log("Got status"); repository.RepositoryIds = repoIds ?? await statusService.GetRepoIdsAsync(); t.Log("Got repo ids"); CleanRepositoryOfTempData(repository); t.Log("CleanRepositoryOfTempData"); await commitsService.AddNewCommitsAsync(repository); t.Log("Added new commits"); commitsService.AddBranchCommits(branches, repository); t.Log($"Added {repository.Commits.Count} commits referenced by active branches"); //if (!repository.Commits.Any()) //{ // Log.Debug("No branches, no commits"); // return; //} await tagService.CopyTagsAsync(repository); t.Log("CopyTags"); branchService.AddActiveBranches(branches, repository); t.Log("AddActiveBranches"); await SetSpecifiedCommitBranchNamesAsync(repository); t.Log("SetSpecifiedCommitBranchNames"); commitBranchNameService.SetMasterBranchCommits(repository); t.Log("SetMasterBranchCommits"); branchService.AddInactiveBranches(repository); t.Log("AddInactiveBranches"); commitBranchNameService.SetBranchTipCommitsNames(repository); t.Log("SetBranchTipCommitsNames"); commitBranchNameService.SetNeighborCommitNames(repository); t.Log("SetNeighborCommitNames"); branchService.AddMissingInactiveBranches(repository); t.Log("AddMissingInactiveBranches"); branchService.AddMultiBranches(repository); t.Log("AddMultiBranches"); branchHierarchyService.SetBranchHierarchy(repository); t.Log("SetBranchHierarchy"); SetCurrentBranchAndCommit(repository, branches); t.Log("SetCurrentBranchAndCommit"); repository.SubBranches.Clear(); t.Log("Clear sub branches"); t.Log("Done"); }