feature<Remote>: add 'Prune' context menu for remote to prune dead branches without fetching

This commit is contained in:
leo 2021-11-17 16:12:26 +08:00
parent 0379d7e331
commit 9f58e0c715
6 changed files with 65 additions and 10 deletions

View file

@ -0,0 +1,10 @@
<controls:PopupWidget
x:Class="SourceGit.Views.Popups.Prune"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
mc:Ignorable="d"
d:DesignWidth="500" Height="100">
</controls:PopupWidget>

View file

@ -0,0 +1,30 @@
using System.Threading.Tasks;
namespace SourceGit.Views.Popups {
/// <summary>
/// 清理远程已删除分支
/// </summary>
public partial class Prune : Controls.PopupWidget {
private string repo = null;
private string remote = null;
public Prune(string repo, string remote) {
this.repo = repo;
this.remote = remote;
InitializeComponent();
}
public override string GetTitle() {
return App.Text("RemoteCM.Prune");
}
public override Task<bool> Start() {
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
var succ = new Commands.Remote(repo).Prune(remote);
Models.Watcher.SetEnabled(repo, true);
return succ;
});
}
}
}