mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
feature: add worktree support (#205)
This commit is contained in:
parent
43af8c49a1
commit
8a8aabede3
23 changed files with 959 additions and 21 deletions
41
src/ViewModels/RemoveWorktree.cs
Normal file
41
src/ViewModels/RemoveWorktree.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class RemoveWorktree : Popup
|
||||
{
|
||||
public Models.Worktree Target
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = null;
|
||||
|
||||
public bool Force
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public RemoveWorktree(Repository repo, Models.Worktree target)
|
||||
{
|
||||
_repo = repo;
|
||||
Target = target;
|
||||
View = new Views.RemoveWorktree() { DataContext = this };
|
||||
}
|
||||
|
||||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = "Remove worktrees ...";
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = new Commands.Worktree(_repo.FullPath).Remove(Target.FullPath, Force, SetProgressDescription);
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return succ;
|
||||
});
|
||||
}
|
||||
|
||||
private Repository _repo = null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue