mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-26 20:00:59 +08:00
51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
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 async Task<bool> Sure()
|
|
{
|
|
_repo.SetWatcherEnabled(false);
|
|
ProgressDescription = $"Reset current branch to {To.SHA} ...";
|
|
|
|
var log = _repo.CreateLog($"Reset HEAD to '{To.SHA}'");
|
|
Use(log);
|
|
|
|
var succ = await new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg)
|
|
.Use(log)
|
|
.ExecAsync();
|
|
|
|
log.Complete();
|
|
_repo.SetWatcherEnabled(true);
|
|
return succ;
|
|
}
|
|
|
|
private readonly Repository _repo = null;
|
|
}
|
|
}
|