mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-28 23:54:59 +00:00
feature<Cleanup>: add toolbar button to run git gc
and git lfs prune
This commit is contained in:
parent
bc404de937
commit
b04c94ccc1
9 changed files with 103 additions and 1 deletions
12
src/Views/Popups/Cleanup.xaml
Normal file
12
src/Views/Popups/Cleanup.xaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<controls:PopupWidget x:Class="SourceGit.Views.Popups.Cleanup"
|
||||
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="800" Height="100">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</controls:PopupWidget>
|
34
src/Views/Popups/Cleanup.xaml.cs
Normal file
34
src/Views/Popups/Cleanup.xaml.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.Views.Popups {
|
||||
/// <summary>
|
||||
/// 清理仓库
|
||||
/// </summary>
|
||||
public partial class Cleanup : Controls.PopupWidget {
|
||||
private string repo;
|
||||
|
||||
public Cleanup(string repo) {
|
||||
this.repo = repo;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public override string GetTitle() {
|
||||
return App.Text("Dashboard.Clean");
|
||||
}
|
||||
|
||||
public override Task<bool> Start() {
|
||||
UpdateProgress(GetTitle());
|
||||
|
||||
return Task.Run(() => {
|
||||
Models.Watcher.SetEnabled(repo, false);
|
||||
new Commands.GC(repo, UpdateProgress).Exec();
|
||||
|
||||
var lfs = new Commands.LFS(repo);
|
||||
if (lfs.IsEnabled()) lfs.Prune(UpdateProgress);
|
||||
|
||||
Models.Watcher.SetEnabled(repo, true);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -122,6 +122,13 @@
|
|||
ToolTip="{DynamicResource Text.Dashboard.Refresh}"
|
||||
Click="TriggerRefresh"/>
|
||||
|
||||
<controls:IconButton
|
||||
Margin="8,0"
|
||||
Padding="0,8"
|
||||
Icon="{DynamicResource Icon.Clean}"
|
||||
ToolTip="{DynamicResource Text.Dashboard.Clean}"
|
||||
Click="OpenCleanup"/>
|
||||
|
||||
<controls:IconButton
|
||||
Margin="8,0"
|
||||
Padding="0,8"
|
||||
|
|
|
@ -413,6 +413,11 @@ namespace SourceGit.Views.Widgets {
|
|||
dialog.ShowDialog();
|
||||
}
|
||||
|
||||
private void OpenCleanup(object sender, RoutedEventArgs e) {
|
||||
new Popups.Cleanup(repo.Path).ShowAndStart();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OpenConfigure(object sender, RoutedEventArgs e) {
|
||||
new Popups.Configure(repo.Path).Show();
|
||||
e.Handled = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue