forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetSubmoduleBranch.cs
More file actions
49 lines (40 loc) · 1.23 KB
/
Copy pathSetSubmoduleBranch.cs
File metadata and controls
49 lines (40 loc) · 1.23 KB
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
using System;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class SetSubmoduleBranch : Popup
{
public Models.Submodule Submodule
{
get;
}
public string ChangeTo
{
get => _changeTo;
set => SetProperty(ref _changeTo, value);
}
public SetSubmoduleBranch(Repository repo, Models.Submodule submodule)
{
_repo = repo;
_changeTo = submodule.Branch;
Submodule = submodule;
}
public override async Task<bool> Sure()
{
ProgressDescription = "Set submodule's branch ...";
if (_changeTo.Equals(Submodule.Branch, StringComparison.Ordinal))
return true;
var log = _repo.CreateLog("Set Submodule's Branch");
_repo.SetWatcherEnabled(false);
Use(log);
var succ = await new Commands.Submodule(_repo.FullPath)
.Use(log)
.SetBranchAsync(Submodule.Path, _changeTo);
log.Complete();
_repo.SetWatcherEnabled(true);
return succ;
}
private readonly Repository _repo;
private string _changeTo;
}
}