2021-04-29 05:05:55 -07:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace SourceGit.Views.Popups {
|
|
|
|
/// <summary>
|
|
|
|
/// 完成GitFlow分支开发
|
|
|
|
/// </summary>
|
|
|
|
public partial class GitFlowFinish : Controls.PopupWidget {
|
|
|
|
private string repo = null;
|
|
|
|
private string name = null;
|
|
|
|
private Models.GitFlowBranchType type = Models.GitFlowBranchType.None;
|
|
|
|
|
|
|
|
public GitFlowFinish(Models.Repository repo, string branch, Models.GitFlowBranchType type) {
|
|
|
|
this.repo = repo.Path;
|
|
|
|
this.type = type;
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
txtName.Text = branch;
|
|
|
|
switch (type) {
|
|
|
|
case Models.GitFlowBranchType.Feature:
|
|
|
|
txtPrefix.Text = App.Text("GitFlow.Feature");
|
|
|
|
name = branch.Substring(repo.GitFlow.Feature.Length);
|
|
|
|
break;
|
|
|
|
case Models.GitFlowBranchType.Release:
|
2021-08-05 00:54:00 -07:00
|
|
|
txtPrefix.Text = App.Text("GitFlow.Release");
|
2021-04-29 05:05:55 -07:00
|
|
|
name = branch.Substring(repo.GitFlow.Release.Length);
|
|
|
|
break;
|
|
|
|
case Models.GitFlowBranchType.Hotfix:
|
|
|
|
txtPrefix.Text = App.Text("GitFlow.Hotfix");
|
|
|
|
name = branch.Substring(repo.GitFlow.Hotfix.Length);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetTitle() {
|
|
|
|
switch (type) {
|
|
|
|
case Models.GitFlowBranchType.Feature:
|
|
|
|
return App.Text("GitFlow.FinishFeature");
|
|
|
|
case Models.GitFlowBranchType.Release:
|
|
|
|
return App.Text("GitFlow.FinishRelease");
|
|
|
|
case Models.GitFlowBranchType.Hotfix:
|
|
|
|
return App.Text("GitFlow.FinishHotfix");
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Task<bool> Start() {
|
2021-05-13 00:31:10 -07:00
|
|
|
var keepBranch = chkKeep.IsChecked == true;
|
|
|
|
|
2021-04-29 05:05:55 -07:00
|
|
|
return Task.Run(() => {
|
|
|
|
Models.Watcher.SetEnabled(repo, false);
|
2021-05-13 00:31:10 -07:00
|
|
|
new Commands.GitFlow(repo).Finish(type, name, keepBranch);
|
2021-04-29 05:05:55 -07:00
|
|
|
Models.Watcher.SetEnabled(repo, true);
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|