Example #1
0
        public async Task <R> FetchAllNotesAsync()
        {
            Log.Debug("Fetch all notes ...");
            string[] noteRefs =
            {
                //$"+refs/notes/{CommitBranchNoteNameSpace}:refs/notes/origin/{CommitBranchNoteNameSpace}",
                $"+refs/notes/{ManualBranchNoteNameSpace}:refs/notes/origin/{ManualBranchNoteNameSpace}",
            };

            return(await gitFetchService.FetchRefsAsync(noteRefs, CancellationToken.None));
        }
Example #2
0
        public async Task TryUpdateAllBranchesAsync()
        {
            Log.Debug("Try update all branches");

            using (statusService.PauseStatusNotifications())
                using (progress.ShowDialog("Updating all branches ..."))
                {
                    Branch currentBranch = Repository.CurrentBranch;

                    R result = await FetchAsync();

                    if (result.IsOk && currentBranch.CanBeUpdated)
                    {
                        progress.SetText($"Updating current branch {currentBranch.Name} ...");
                        result = await MergeCurrentBranchAsync();
                    }

                    if (result.IsFaulted)
                    {
                        message.ShowWarning(
                            $"Failed to update current branch {currentBranch.Name}\n{result.Message}.");
                    }

                    IEnumerable <Branch> updatableBranches = Repository.Branches
                                                             .Where(b => !b.IsCurrentBranch && b.CanBeUpdated)
                                                             .ToList();

                    foreach (Branch branch in updatableBranches)
                    {
                        progress.SetText($"Updating branch {branch.Name} ...");
                        string[] refspecs = { $"{branch.Name}:{branch.Name}" };
                        await gitFetchService.FetchRefsAsync(refspecs, CancellationToken.None);
                    }

                    progress.SetText("Updating all branches ...");
                    await FetchAllNotesAsync();
                }
        }