forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteMultipleTags.cs
More file actions
55 lines (46 loc) · 1.38 KB
/
DeleteMultipleTags.cs
File metadata and controls
55 lines (46 loc) · 1.38 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
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class DeleteMultipleTags : Popup
{
public List<Models.Tag> Tags
{
get;
}
public bool DeleteFromRemote
{
get;
set;
} = false;
public DeleteMultipleTags(Repository repo, List<Models.Tag> tags)
{
_repo = repo;
Tags = tags;
}
public override async Task<bool> Sure()
{
using var lockWatcher = _repo.LockWatcher();
ProgressDescription = "Deleting multiple tags...";
var log = _repo.CreateLog("Delete Multiple Tags");
Use(log);
foreach (var tag in Tags)
{
var succ = await new Commands.Tag(_repo.FullPath, tag.Name)
.Use(log)
.DeleteAsync();
if (succ && DeleteFromRemote)
{
foreach (var r in _repo.Remotes)
await new Commands.Push(_repo.FullPath, r.Name, $"refs/tags/{tag.Name}", true)
.Use(log)
.RunAsync();
}
}
log.Complete();
_repo.MarkTagsDirtyManually();
return true;
}
private readonly Repository _repo;
}
}