sourcegit/src/ViewModels/LFSPull.cs
leo 0c21bcd06a
enhance: Git LFS supports (#209)
* add a new context menu to push local LFS object to selected remote
* supports to choose remote for fetch/pull/push/lock/unlock actions
* auto select remote if there's only one remote
2024-06-26 11:50:22 +08:00

37 lines
994 B
C#

using System.Collections.Generic;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class LFSPull : Popup
{
public List<Models.Remote> Remotes => _repo.Remotes;
public Models.Remote SelectedRemote
{
get;
set;
}
public LFSPull(Repository repo)
{
_repo = repo;
SelectedRemote = _repo.Remotes[0];
View = new Views.LFSPull() { DataContext = this };
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = $"Pull LFS objects from remote ...";
return Task.Run(() =>
{
new Commands.LFS(_repo.FullPath).Pull(SelectedRemote.Name, SetProgressDescription);
CallUIThread(() => _repo.SetWatcherEnabled(true));
return true;
});
}
private readonly Repository _repo = null;
}
}