-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathFormMergeBranch.cs
54 lines (44 loc) · 1.5 KB
/
FormMergeBranch.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Windows.Forms;
namespace GitForce
{
/// <summary>
/// Form to merge a branch.
/// </summary>
public partial class FormMergeBranch : Form
{
public FormMergeBranch()
{
InitializeComponent();
ClassWinGeometry.Restore(this);
ClassBranches branches = App.Repos.Current.Branches;
labelCurrentBranchName.Text = "Current branch is \"" + branches.Current + "\"";
// Add all available branches to the list of branches to merge
foreach (var branch in branches.Local)
listBranches.Items.Add(branch);
foreach (var branch in branches.Remote)
listBranches.Items.Add(branch);
listBranches.Items.RemoveAt(listBranches.Items.IndexOf(branches.Current));
if (listBranches.Items.Count > 0)
{
listBranches.SelectedIndex = 0;
btMerge.Enabled = true;
}
}
/// <summary>
/// Form is closing.
/// </summary>
private void FormMergeBranchFormClosing(object sender, FormClosingEventArgs e)
{
ClassWinGeometry.Save(this);
}
/// <summary>
/// Button is clicked to perform a branch merge.
/// </summary>
private void BtMergeClick(object sender, EventArgs e)
{
string cmd = "merge " + listBranches.SelectedItem;
App.Repos.Current.RunCmd(cmd);
}
}
}