/
vasiukoff
/
sg
Обзор
Документация
Войти
/
vasiukoff
/
sg
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/ViewModels/ApplyStash.cs
63 строки
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 ApplyStash : Popup { public Models.Stash Stash { get; private set; } public bool RestoreIndex { get; set; } = true; public bool DropAfterApply { get; set; } = false; public ApplyStash(Repository repo, Models.Stash stash) { _repo = repo; Stash = stash; } public override async Task<bool> Sure() { using var lockWatcher = _repo.LockWatcher(); ProgressDescription = $"Applying stash: {Stash.Name}"; var log = _repo.CreateLog("Apply Stash"); Use(log); var succ = await new Commands.Stash(_repo.FullPath) .Use(log) .ApplyAsync(Stash.Name, RestoreIndex); if (succ) { _repo.MarkWorkingCopyDirtyManually(); if (DropAfterApply) { await new Commands.Stash(_repo.FullPath) .Use(log) .DropAsync(Stash.Name); _repo.MarkStashesDirtyManually(); } } log.Complete(); return true; } private readonly Repository _repo; } }