forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReset.cs
More file actions
50 lines (42 loc) · 1.19 KB
/
Copy pathReset.cs
File metadata and controls
50 lines (42 loc) · 1.19 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
50
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class Reset : Popup
{
public Models.Branch Current
{
get;
}
public Models.Commit To
{
get;
}
public Models.ResetMode SelectedMode
{
get;
set;
}
public Reset(Repository repo, Models.Branch current, Models.Commit to)
{
_repo = repo;
Current = current;
To = to;
SelectedMode = Models.ResetMode.Supported[1];
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = $"Reset current branch to {To.SHA} ...";
var log = _repo.CreateLog($"Reset HEAD to '{To.SHA}'");
Use(log);
return Task.Run(() =>
{
var succ = new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg).Use(log).Exec();
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
});
}
private readonly Repository _repo = null;
}
}