mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature(Submodule): add button to do submodule update
This commit is contained in:
parent
1896ae1daf
commit
0e9b1574a8
5 changed files with 62 additions and 7 deletions
|
@ -26,27 +26,27 @@ namespace SourceGit.Git {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Branch name
|
/// Branch name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Full name.
|
/// Full name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Head ref
|
/// Head ref
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Head { get; set; }
|
public string Head { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subject for head ref.
|
/// Subject for head ref.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string HeadSubject { get; set; }
|
public string HeadSubject { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is local branch
|
/// Is local branch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsLocal { get; set; }
|
public bool IsLocal { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Branch type.
|
/// Branch type.
|
||||||
|
@ -56,7 +56,7 @@ namespace SourceGit.Git {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remote name. Only used for remote branch
|
/// Remote name. Only used for remote branch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Remote { get; set; }
|
public string Remote { get; set; } = "";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Upstream. Only used for local branches.
|
/// Upstream. Only used for local branches.
|
||||||
|
|
|
@ -445,12 +445,17 @@
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="16"/>
|
<ColumnDefinition Width="16"/>
|
||||||
|
<ColumnDefinition Width="8"/>
|
||||||
|
<ColumnDefinition Width="16"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Label Grid.Column="0" x:Name="submoduleCount" Content="SUBMODULES" Style="{StaticResource Style.Label.GroupHeader}"/>
|
<Label Grid.Column="0" x:Name="submoduleCount" Content="SUBMODULES" Style="{StaticResource Style.Label.GroupHeader}"/>
|
||||||
<Button Grid.Column="1" Click="OpenAddSubmodule" ToolTip="ADD SUBMODULE">
|
<Button Grid.Column="1" Click="OpenAddSubmodule" ToolTip="ADD SUBMODULE">
|
||||||
<Path Width="14" Height="14" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Submodule}"/>
|
<Path Width="14" Height="14" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Submodule}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button Grid.Column="3" Click="UpdateSubmodule" ToolTip="UPDATE SUBMODULE">
|
||||||
|
<Path Width="14" Height="14" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Loading}"/>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<DataGrid
|
<DataGrid
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace SourceGit.UI {
|
||||||
foreach (var b in branches) {
|
foreach (var b in branches) {
|
||||||
if (b.IsLocal) {
|
if (b.IsLocal) {
|
||||||
MakeBranchNode(b, localBranchNodes, folders, states, "locals");
|
MakeBranchNode(b, localBranchNodes, folders, states, "locals");
|
||||||
} else {
|
} else if (!string.IsNullOrEmpty(b.Remote)) {
|
||||||
RemoteNode remote = null;
|
RemoteNode remote = null;
|
||||||
|
|
||||||
if (!remoteMap.ContainsKey(b.Remote)) {
|
if (!remoteMap.ContainsKey(b.Remote)) {
|
||||||
|
@ -926,6 +926,13 @@ namespace SourceGit.UI {
|
||||||
AddSubmodule.Show(repo);
|
AddSubmodule.Show(repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateSubmodule(object sender, RoutedEventArgs e) {
|
||||||
|
Waiting.Show(() => {
|
||||||
|
var errs = repo.RunCommand("submodule update", PopupManager.UpdateStatus, true);
|
||||||
|
if (errs != null) App.RaiseError(errs);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void SubmoduleLostFocus(object sender, RoutedEventArgs e) {
|
private void SubmoduleLostFocus(object sender, RoutedEventArgs e) {
|
||||||
(sender as DataGrid).UnselectAll();
|
(sender as DataGrid).UnselectAll();
|
||||||
}
|
}
|
||||||
|
|
8
SourceGit/UI/Waiting.xaml
Normal file
8
SourceGit/UI/Waiting.xaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<UserControl x:Class="SourceGit.UI.Waiting"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="160" d:DesignWidth="500" Height="200" Width="500">
|
||||||
|
</UserControl>
|
35
SourceGit/UI/Waiting.xaml.cs
Normal file
35
SourceGit/UI/Waiting.xaml.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace SourceGit.UI {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// General waiting dialog.
|
||||||
|
/// </summary>
|
||||||
|
public partial class Waiting : UserControl {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
public Waiting() {
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show this dialog.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="job"></param>
|
||||||
|
public static void Show(Action job) {
|
||||||
|
var dialog = new Waiting();
|
||||||
|
PopupManager.Show(dialog);
|
||||||
|
PopupManager.Lock();
|
||||||
|
Task.Run(() => {
|
||||||
|
job.Invoke();
|
||||||
|
dialog.Dispatcher.Invoke(() => {
|
||||||
|
PopupManager.Close(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue