/
vasiukoff
/
sg
Обзор
Документация
Войти
/
vasiukoff
/
sg
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/ViewModels/ResetWithoutCheckout.cs
53 строки
1 KB
leo
refactor: file-system watcher
01 сен 2025, 12:39
01 сен 2025, 12:39
cd80a55
Код
Авторство
О чём код?
using System.Threading.Tasks; namespace SourceGit.ViewModels { public class ResetWithoutCheckout : Popup { public Models.Branch Target { get; } public object To { get; } public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Branch to) { _repo = repo; _revision = to.Head; Target = target; To = to; } public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Commit to) { _repo = repo; _revision = to.SHA; Target = target; To = to; } public override async Task<bool> Sure() { using var lockWatcher = _repo.LockWatcher(); ProgressDescription = $"Reset {Target.Name} to {_revision} ..."; var log = _repo.CreateLog($"Reset '{Target.Name}' to '{_revision}'"); Use(log); var succ = await new Commands.Branch(_repo.FullPath, Target.Name) .Use(log) .CreateAsync(_revision, true); log.Complete(); _repo.MarkBranchesDirtyManually(); return succ; } private readonly Repository _repo = null; private readonly string _revision; } }