-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathGitFlowFinish.cs
53 lines (44 loc) · 1.43 KB
/
GitFlowFinish.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
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class GitFlowFinish : Popup
{
public Models.Branch Branch
{
get;
}
public bool IsFeature => _type == "feature";
public bool IsRelease => _type == "release";
public bool IsHotfix => _type == "hotfix";
public bool KeepBranch
{
get;
set;
} = false;
public GitFlowFinish(Repository repo, Models.Branch branch, string type, string prefix)
{
_repo = repo;
_type = type;
_prefix = prefix;
Branch = branch;
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
var name = Branch.Name.StartsWith(_prefix) ? Branch.Name.Substring(_prefix.Length) : Branch.Name;
ProgressDescription = $"Git Flow - finishing {_type} {name} ...";
var log = _repo.CreateLog("Gitflow - Finish");
Use(log);
return Task.Run(() =>
{
var succ = Commands.GitFlow.Finish(_repo.FullPath, _type, name, KeepBranch, log);
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
});
}
private readonly Repository _repo;
private readonly string _type;
private readonly string _prefix;
}
}