new feature:

push new branch to remote ,just click new branch checkbox
This commit is contained in:
East.Shang 2024-10-04 14:35:55 +08:00
parent 718dd322cf
commit bf965e8fb1
9 changed files with 54 additions and 8 deletions

View file

@ -454,6 +454,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">Push</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote-Branch:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Remote-Branch verfolgen</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">Neuer Zweig:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">Neuer Zweig</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Alle Tags pushen</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Tag zum Remote pushen</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Zu allen Remotes pushen</x:String>

View file

@ -456,6 +456,8 @@
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote:</x:String>
<x:String x:Key="Text.Push.Title" xml:space="preserve">Push Changes To Remote</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote Branch:</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">NewBranch:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">NewBranch</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Set as tracking branch</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Push all tags</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Push Tag To Remote</x:String>

View file

@ -441,6 +441,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">Push Changes To Remote</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote Branch:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Set as tracking branch</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">Nouvelle branche:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">Nouvelle branche</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Push all tags</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Push Tag To Remote</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Push to all remotes</x:String>

View file

@ -434,6 +434,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">Empurrar Alterações para o Remoto</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">Branch Remoto:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Definir como branch de rastreamento</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">Novo ramo:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">Novo ramo</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Empurrar todas as tags</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Empurrar Tag para o Remoto</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Empurrar para todos os remotos</x:String>

View file

@ -457,6 +457,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">Выложить изменения на внешнее хранилище</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">Ветка внешнего хранилища:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Установить в качестве ветки отслеживания</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">Новая ветвь: </x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">Новая ветвь </x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Выложить все теги</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">Выложить тег на внешнее хранилище</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Выложить на все внешние хранилища</x:String>

View file

@ -456,6 +456,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">推送到远程仓库</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">远程分支 </x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">跟踪远程分支</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">新分支:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">新分支</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">同时推送标签</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">推送标签到远程仓库</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">推送到所有远程仓库</x:String>

View file

@ -460,6 +460,8 @@
<x:String x:Key="Text.Push.Title" xml:space="preserve">推送到遠端存放庫</x:String>
<x:String x:Key="Text.Push.To" xml:space="preserve">遠端分支:</x:String>
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">追蹤遠端分支</x:String>
<x:String x:Key="Text.Push.IsNewBranch" xml:space="preserve">新分支:</x:String>
<x:String x:Key="Text.Push.NewBranch" xml:space="preserve">新分支</x:String>
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">同時推送標籤</x:String>
<x:String x:Key="Text.PushTag" xml:space="preserve">推送標籤到遠端存放庫</x:String>
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">推送到所有遠端存放庫</x:String>

View file

@ -74,6 +74,17 @@ namespace SourceGit.ViewModels
set;
} = true;
public bool IsNewBranch
{
get=> _isNewBranch;
set=> SetProperty(ref _isNewBranch, value);
}
public Models.Branch NewBranch
{
get => _newBranch;
private set => SetProperty(ref _newBranch, value);
}
public bool IsCheckSubmodulesVisible
{
get => _repo.Submodules.Count > 0;
@ -152,6 +163,10 @@ namespace SourceGit.ViewModels
_repo.SetWatcherEnabled(false);
var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", "");
if (_isNewBranch&&!string.IsNullOrEmpty(_newBranch.Name))
{
remoteBranchName = _newBranch.Name;
}
ProgressDescription = $"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ...";
return Task.Run(() =>
@ -223,5 +238,7 @@ namespace SourceGit.ViewModels
private List<Models.Branch> _remoteBranches = new List<Models.Branch>();
private Models.Branch _selectedRemoteBranch = null;
private bool _isSetTrackOptionVisible = false;
private bool _isNewBranch = false;
private Models.Branch _newBranch = new Models.Branch();
}
}

View file

@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="500"
x:Class="SourceGit.Views.Push"
x:DataType="vm:Push">
<StackPanel Orientation="Vertical" Margin="8,0">
@ -12,7 +12,7 @@
Classes="bold"
Text="{DynamicResource Text.Push.Title}"/>
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,32,32" ColumnDefinitions="130,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,32,32,32" ColumnDefinitions="130,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
@ -60,7 +60,9 @@
Height="28" Padding="8,0"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
ItemsSource="{Binding RemoteBranches}"
SelectedItem="{Binding SelectedRemoteBranch, Mode=TwoWay}">
SelectedItem="{Binding SelectedRemoteBranch, Mode=TwoWay}"
IsEnabled="{Binding !IsNewBranch}"
>
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="{x:Type m:Branch}">
<StackPanel Orientation="Horizontal" Height="20" VerticalAlignment="Center">
@ -70,24 +72,37 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<CheckBox Grid.Row="3" Grid.Column="0"
Height="32"
Margin="0,0,8,0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Content="{DynamicResource Text.Push.IsNewBranch}"
IsChecked="{Binding IsNewBranch, Mode=TwoWay}"
/>
<CheckBox Grid.Row="3" Grid.Column="1"
<TextBox Grid.Row="3" Grid.Column="1" x:Name="NewBranch"
Height="28"
CornerRadius="3"
IsVisible="{Binding IsNewBranch}"
Watermark="{DynamicResource Text.Push.NewBranch}"
Text="{Binding NewBranch.Name, Mode=TwoWay}"/>
<CheckBox Grid.Row="4" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Push.Tracking}"
IsChecked="{Binding Tracking, Mode=TwoWay}"
IsVisible="{Binding IsSetTrackOptionVisible}"/>
<CheckBox Grid.Row="4" Grid.Column="1"
<CheckBox Grid.Row="5" Grid.Column="1"
Height="32"
Content="{DynamicResource Text.Push.CheckSubmodules}"
IsChecked="{Binding CheckSubmodules, Mode=TwoWay}"
IsVisible="{Binding IsCheckSubmodulesVisible}"/>
IsVisible="{Binding IsCheckSubmodulesVisible}"/>
<CheckBox Grid.Row="5" Grid.Column="1"
<CheckBox Grid.Row="6" Grid.Column="1"
Content="{DynamicResource Text.Push.WithAllTags}"
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
<CheckBox Grid.Row="6" Grid.Column="1"
<CheckBox Grid.Row="7" Grid.Column="1"
Content="{DynamicResource Text.Push.Force}"
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
</Grid>