sourcegit/src/ViewModels/FetchInto.cs
2025-04-19 11:14:19 +08:00

47 lines
1.1 KiB
C#

using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class FetchInto : Popup
{
public Models.Branch Local
{
get;
}
public Models.Branch Upstream
{
get;
}
public FetchInto(Repository repo, Models.Branch local, Models.Branch upstream)
{
_repo = repo;
Local = local;
Upstream = upstream;
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = "Fast-Forward ...";
var log = _repo.CreateLog($"Fetch Into '{Local.FriendlyName}'");
Use(log);
return Task.Run(() =>
{
new Commands.Fetch(_repo.FullPath, Local, Upstream).Use(log).Exec();
log.Complete();
CallUIThread(() =>
{
_repo.NavigateToBranchDelayed(Upstream.FullName);
_repo.SetWatcherEnabled(true);
});
return true;
});
}
private readonly Repository _repo = null;
}
}