-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathApplyStash.cs
More file actions
63 lines (51 loc) · 1.4 KB
/
ApplyStash.cs
File metadata and controls
63 lines (51 loc) · 1.4 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
54
55
56
57
58
59
60
61
62
63
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class ApplyStash : Popup
{
public Models.Stash Stash
{
get;
private set;
}
public bool RestoreIndex
{
get;
set;
} = true;
public bool DropAfterApply
{
get;
set;
} = false;
public ApplyStash(Repository repo, Models.Stash stash)
{
_repo = repo;
Stash = stash;
}
public override async Task<bool> Sure()
{
using var lockWatcher = _repo.LockWatcher();
ProgressDescription = $"Applying stash: {Stash.Name}";
var log = _repo.CreateLog("Apply Stash");
Use(log);
var succ = await new Commands.Stash(_repo.FullPath)
.Use(log)
.ApplyAsync(Stash.Name, RestoreIndex);
if (succ)
{
_repo.MarkWorkingCopyDirtyManually();
if (DropAfterApply)
{
await new Commands.Stash(_repo.FullPath)
.Use(log)
.DropAsync(Stash.Name);
_repo.MarkStashesDirtyManually();
}
}
log.Complete();
return true;
}
private readonly Repository _repo;
}
}