private void OkClick(object sender, EventArgs e) { try { if (!DeleteRemote.Checked) { return; } List <IGitRef> selectedBranches = Branches.GetSelectedBranches().ToList(); var hasUnmergedBranches = selectedBranches.Any(branch => !_mergedBranches.Contains(branch.CompleteName)); if (hasUnmergedBranches) { if (MessageBox.Show(this, _confirmDeleteUnmergedRemoteBranchMessage.Text, _deleteRemoteBranchesCaption.Text, MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } } foreach (var remoteGroup in selectedBranches.GroupBy(b => b.Remote)) { string remote = remoteGroup.Key; EnsurePageant(remote); var cmd = new GitDeleteRemoteBranchesCmd(remote, remoteGroup); ScriptManager.RunEventScripts(this, ScriptEvent.BeforePush); using (var form = new FormRemoteProcess(Module, cmd.ToLine()) { Remote = remote }) { form.ShowDialog(); if (!Module.InTheMiddleOfAction() && !form.ErrorOccurred()) { ScriptManager.RunEventScripts(this, ScriptEvent.AfterPush); } } } UICommands.RepoChangedNotifier.Notify(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } Close(); }
public void Delete() { var remoteBranchInfo = GetRemoteBranchInfo(); var cmd = new GitDeleteRemoteBranchesCmd(remoteBranchInfo.Remote, new[] { remoteBranchInfo.BranchName }); if (MessageBoxes.ConfirmDeleteRemoteBranch(TreeViewNode.TreeView, remoteBranchInfo.BranchName, remoteBranchInfo.Remote)) { UICommands.StartCommandLineProcessDialog(null, cmd); } }