public async Task UpdateBranchAsync(Branch branch)
        {
            using (statusService.PauseStatusNotifications())
                using (progress.ShowDialog($"Updating branch {branch.Name} ..."))
                {
                    R result = R.NoValue;
                    if (branch == branch.Repository.CurrentBranch ||
                        branch.IsMainPart && branch.LocalSubBranch == branch.Repository.CurrentBranch)
                    {
                        Log.Debug("Update current branch");

                        if ((await gitFetchService.FetchAsync(CancellationToken.None)).IsOk)
                        {
                            result = await MergeCurrentBranchAsync();
                        }
                    }
                    else
                    {
                        Log.Debug($"Update branch {branch.Name}");
                        result = await gitFetchService.FetchBranchAsync(branch.Name, CancellationToken.None);
                    }

                    if (result.IsFaulted)
                    {
                        message.ShowWarning($"Failed to update the branch {branch.Name}.\n{result.Message}");
                    }
                }
        }
Beispiel #2
0
 public async Task <R> FetchAsync()
 {
     return(await gitFetchService.FetchAsync(CancellationToken.None));
 }