Skip to content

Commit

Permalink
feature: allow changing of tracking branch on push (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
love-linger committed May 25, 2024
1 parent 8e3a8f4 commit 754a252
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">You are about to delete a remote branch!!!</x:String>
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">Also delete remote branch${0}$</x:String>
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">Delete Multiple Branches</x:String>
<x:String x:Key="Text.DeleteMultiBranch.Targets" xml:space="preserve">Targets : </x:String>
<x:String x:Key="Text.DeleteMultiBranch.Tip" xml:space="preserve">You are trying to delete multiple branches at one time. Be sure to double-check before taking action!</x:String>
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">Delete Remote</x:String>
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">Remote :</x:String>
Expand Down Expand Up @@ -319,6 +318,7 @@
<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.Tracking" xml:space="preserve">Tracking remote branch(--set-upstream)</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>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Locales/zh_CN.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">您正在删除远程上的分支,请务必小心!!!</x:String>
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">同时删除远程分支${0}$</x:String>
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">删除多个分支</x:String>
<x:String x:Key="Text.DeleteMultiBranch.Targets" xml:space="preserve">分支列表 :</x:String>
<x:String x:Key="Text.DeleteMultiBranch.Tip" xml:space="preserve">您正在尝试一次性删除多个分支,请务必仔细检查后再执行操作!</x:String>
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">删除远程确认</x:String>
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">远程名 :</x:String>
Expand Down Expand Up @@ -319,6 +318,7 @@
<x:String x:Key="Text.Push.Remote" xml:space="preserve">远程仓库 :</x:String>
<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">跟踪远程分支(--set-upstream)</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>
Expand Down
8 changes: 7 additions & 1 deletion src/ViewModels/Push.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ public bool PushAllTags
set;
}

public bool Tracking
{
get;
set;
} = true;

public bool ForcePush
{
get;
Expand Down Expand Up @@ -154,7 +160,7 @@ public override Task<bool> Sure()
remoteBranchName,
PushAllTags,
ForcePush,
string.IsNullOrEmpty(_selectedLocalBranch.Upstream),
Tracking,
SetProgressDescription).Exec();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
Expand Down
8 changes: 6 additions & 2 deletions src/Views/Push.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Classes="bold"
Text="{DynamicResource Text.Push.Title}"/>

<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32" ColumnDefinitions="150,*">
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="150,*">
<TextBlock Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="0,0,8,0"
Expand Down Expand Up @@ -73,10 +73,14 @@
</ComboBox>

<CheckBox Grid.Row="3" Grid.Column="1"
Content="{DynamicResource Text.Push.Tracking}"
IsChecked="{Binding Tracking, Mode=TwoWay}"/>

<CheckBox Grid.Row="4" Grid.Column="1"
Content="{DynamicResource Text.Push.WithAllTags}"
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>

<CheckBox Grid.Row="4" Grid.Column="1"
<CheckBox Grid.Row="5" Grid.Column="1"
Content="{DynamicResource Text.Push.Force}"
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
</Grid>
Expand Down

0 comments on commit 754a252

Please sign in to comment.