forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResetWithoutCheckout.cs
More file actions
53 lines (45 loc) · 1.37 KB
/
Copy pathResetWithoutCheckout.cs
File metadata and controls
53 lines (45 loc) · 1.37 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
51
52
53
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class ResetWithoutCheckout : Popup
{
public Models.Branch Target
{
get;
}
public object To
{
get;
}
public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Branch to)
{
_repo = repo;
_revision = to.Head;
Target = target;
To = to;
}
public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Commit to)
{
_repo = repo;
_revision = to.SHA;
Target = target;
To = to;
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = $"Reset {Target.Name} to {_revision} ...";
var log = _repo.CreateLog($"Reset '{Target.Name}' to '{_revision}'");
Use(log);
return Task.Run(() =>
{
var succ = Commands.Branch.Create(_repo.FullPath, Target.Name, _revision, true, log);
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
});
}
private readonly Repository _repo = null;
private readonly string _revision = string.Empty;
}
}