public async Task CreateBranchFromCommitAsync(Commit commit)
        {
            using (statusService.PauseStatusNotifications())
            {
                CrateBranchDialog dialog = new CrateBranchDialog(owner);

                if (dialog.ShowDialog() == true)
                {
                    BranchName branchName = dialog.BranchName;
                    Log.Debug($"Create branch {dialog.BranchName}, from {commit.Branch} ...");

                    using (progress.ShowDialog($"Creating branch {dialog.BranchName} ..."))
                    {
                        R result = await gitBranchService.BranchFromCommitAsync(
                            branchName, commit.RealCommitSha.Sha, true, CancellationToken.None);

                        if (result.IsOk)
                        {
                            Log.Debug($"Created branch {branchName}, from {commit.Branch}");

                            if (dialog.IsPublish)
                            {
                                progress.SetText($"Publishing branch {dialog.BranchName}...");

                                R publish = await gitPushService.PushBranchAsync(branchName, CancellationToken.None);

                                if (publish.IsFaulted)
                                {
                                    message.ShowWarning($"Failed to publish the branch {branchName}.");
                                }
                            }

                            repositoryCommands.ShowBranch(branchName);
                        }
                        else
                        {
                            message.ShowWarning($"Failed to create branch {branchName}\n{result.Message}");
                        }
                    }
                }
            }
        }
Пример #2
0
 public async Task <R> PushBranchAsync(BranchName branchName)
 {
     return(await gitPushService.PushBranchAsync(branchName, CancellationToken.None));
 }