enhance: tag creation & pushing (#141)

* supports creating lightweight tags
* supports GPG signed tags
* add option to push selected tag to all remotes
This commit is contained in:
leo 2024-05-24 10:31:20 +08:00
parent 0dea7ed0e2
commit b556feb3d3
11 changed files with 122 additions and 42 deletions

View file

@ -1,12 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class CreateTag : Popup
{
public object BasedOn
{
get;
private set;
}
[Required(ErrorMessage = "Tag name is required!")]
[RegularExpression(@"^[\w\-\.]+$", ErrorMessage = "Bad tag name format!")]
[CustomValidation(typeof(CreateTag), nameof(ValidateTagName))]
@ -22,11 +26,17 @@ namespace SourceGit.ViewModels
set;
}
public object BasedOn
public bool Annotated
{
get => _annotated;
set => SetProperty(ref _annotated, value);
}
public bool SignTag
{
get;
private set;
}
set;
} = false;
public CreateTag(Repository repo, Models.Branch branch)
{
@ -65,7 +75,11 @@ namespace SourceGit.ViewModels
return Task.Run(() =>
{
Commands.Tag.Add(_repo.FullPath, TagName, _basedOn, Message);
if (_annotated)
Commands.Tag.Add(_repo.FullPath, _tagName, _basedOn, Message, SignTag);
else
Commands.Tag.Add(_repo.FullPath, _tagName, _basedOn);
CallUIThread(() => _repo.SetWatcherEnabled(true));
return true;
});
@ -73,6 +87,7 @@ namespace SourceGit.ViewModels
private readonly Repository _repo = null;
private string _tagName = string.Empty;
private bool _annotated = true;
private readonly string _basedOn = string.Empty;
}
}