2021-04-29 05:05:55 -07:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace SourceGit.Views.Popups {
|
|
|
|
/// <summary>
|
|
|
|
/// 遴选面板
|
|
|
|
/// </summary>
|
|
|
|
public partial class CherryPick : Controls.PopupWidget {
|
|
|
|
private string repo = null;
|
|
|
|
private string commit = null;
|
|
|
|
|
|
|
|
public CherryPick(string repo, Models.Commit commit) {
|
|
|
|
this.repo = repo;
|
|
|
|
this.commit = commit.SHA;
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
2021-08-05 18:50:43 -07:00
|
|
|
txtSHA.Text = commit.ShortSHA;
|
|
|
|
txtCommit.Text = commit.Subject;
|
2021-04-29 05:05:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetTitle() {
|
|
|
|
return App.Text("CherryPick.Title");
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Task<bool> Start() {
|
|
|
|
var noCommits = chkCommit.IsChecked != true;
|
|
|
|
|
|
|
|
return Task.Run(() => {
|
|
|
|
Models.Watcher.SetEnabled(repo, false);
|
|
|
|
new Commands.CherryPick(repo, commit, noCommits).Exec();
|
|
|
|
Models.Watcher.SetEnabled(repo, true);
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|