2020-08-03 01:23:00 -07:00
|
|
|
using System.Windows;
|
2020-07-03 00:24:31 -07:00
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
namespace SourceGit.UI {
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Cherry pick commit dialog.
|
|
|
|
/// </summary>
|
|
|
|
public partial class CherryPick : UserControl {
|
|
|
|
private Git.Repository repo = null;
|
|
|
|
private string commitSHA = null;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Constructor.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="opened"></param>
|
|
|
|
/// <param name="commit"></param>
|
|
|
|
public CherryPick(Git.Repository opened, Git.Commit commit) {
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
repo = opened;
|
|
|
|
commitSHA = commit.SHA;
|
2020-09-01 02:22:47 -07:00
|
|
|
desc.Text = $"{commit.ShortSHA} {commit.Subject}";
|
2020-07-03 00:24:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Display this dialog.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="repo"></param>
|
|
|
|
/// <param name="commit"></param>
|
|
|
|
public static void Show(Git.Repository repo, Git.Commit commit) {
|
2020-08-06 00:41:25 -07:00
|
|
|
repo.GetPopupManager()?.Show(new CherryPick(repo, commit));
|
2020-07-03 00:24:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Start pick.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void Start(object sender, RoutedEventArgs e) {
|
|
|
|
repo.CherryPick(commitSHA, chkCommitChanges.IsChecked != true);
|
2020-08-06 00:41:25 -07:00
|
|
|
repo.GetPopupManager()?.Close();
|
2020-07-03 00:24:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Cancel.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void Cancel(object sender, RoutedEventArgs e) {
|
2020-08-06 00:41:25 -07:00
|
|
|
repo.GetPopupManager()?.Close();
|
2020-07-03 00:24:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|