mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-11 23:57:21 -08:00
9e048751ae
* ViewModels.MergeMode -> Models.MergeMode * ViewModels.Notification -> Models.Notification * ViewModels.ResetMode -> Models.ResetMode * use `int` instead of `ViewModels.CountSelectedCommits`
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System.Threading.Tasks;
|
|
|
|
namespace SourceGit.ViewModels
|
|
{
|
|
public class Reset : Popup
|
|
{
|
|
public Models.Branch Current
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public Models.Commit To
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
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[0];
|
|
View = new Views.Reset() { DataContext = this };
|
|
}
|
|
|
|
public override Task<bool> Sure()
|
|
{
|
|
_repo.SetWatcherEnabled(false);
|
|
ProgressDescription = $"Reset current branch to {To.SHA} ...";
|
|
|
|
return Task.Run(() =>
|
|
{
|
|
var succ = new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg).Exec();
|
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
|
return succ;
|
|
});
|
|
}
|
|
|
|
private readonly Repository _repo = null;
|
|
}
|
|
}
|