Skip to content

Commit 754a252

Browse files
committed
feature: allow changing of tracking branch on push (#142)
1 parent 8e3a8f4 commit 754a252

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">You are about to delete a remote branch!!!</x:String>
131131
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">Also delete remote branch${0}$</x:String>
132132
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">Delete Multiple Branches</x:String>
133-
<x:String x:Key="Text.DeleteMultiBranch.Targets" xml:space="preserve">Targets : </x:String>
134133
<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>
135134
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">Delete Remote</x:String>
136135
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">Remote :</x:String>
@@ -319,6 +318,7 @@
319318
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote :</x:String>
320319
<x:String x:Key="Text.Push.Title" xml:space="preserve">Push Changes To Remote</x:String>
321320
<x:String x:Key="Text.Push.To" xml:space="preserve">Remote Branch :</x:String>
321+
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">Tracking remote branch(--set-upstream)</x:String>
322322
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">Push all tags</x:String>
323323
<x:String x:Key="Text.PushTag" xml:space="preserve">Push Tag To Remote</x:String>
324324
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">Push to all remotes</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
<x:String x:Key="Text.DeleteBranch.IsRemoteTip" xml:space="preserve">您正在删除远程上的分支,请务必小心!!!</x:String>
131131
<x:String x:Key="Text.DeleteBranch.WithTrackingRemote" xml:space="preserve">同时删除远程分支${0}$</x:String>
132132
<x:String x:Key="Text.DeleteMultiBranch" xml:space="preserve">删除多个分支</x:String>
133-
<x:String x:Key="Text.DeleteMultiBranch.Targets" xml:space="preserve">分支列表 :</x:String>
134133
<x:String x:Key="Text.DeleteMultiBranch.Tip" xml:space="preserve">您正在尝试一次性删除多个分支,请务必仔细检查后再执行操作!</x:String>
135134
<x:String x:Key="Text.DeleteRemote" xml:space="preserve">删除远程确认</x:String>
136135
<x:String x:Key="Text.DeleteRemote.Remote" xml:space="preserve">远程名 :</x:String>
@@ -319,6 +318,7 @@
319318
<x:String x:Key="Text.Push.Remote" xml:space="preserve">远程仓库 :</x:String>
320319
<x:String x:Key="Text.Push.Title" xml:space="preserve">推送到远程仓库</x:String>
321320
<x:String x:Key="Text.Push.To" xml:space="preserve">远程分支 :</x:String>
321+
<x:String x:Key="Text.Push.Tracking" xml:space="preserve">跟踪远程分支(--set-upstream)</x:String>
322322
<x:String x:Key="Text.Push.WithAllTags" xml:space="preserve">同时推送标签</x:String>
323323
<x:String x:Key="Text.PushTag" xml:space="preserve">推送标签到远程仓库</x:String>
324324
<x:String x:Key="Text.PushTag.PushAllRemotes" xml:space="preserve">推送到所有远程仓库</x:String>

src/ViewModels/Push.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ public bool PushAllTags
8282
set;
8383
}
8484

85+
public bool Tracking
86+
{
87+
get;
88+
set;
89+
} = true;
90+
8591
public bool ForcePush
8692
{
8793
get;
@@ -154,7 +160,7 @@ public override Task<bool> Sure()
154160
remoteBranchName,
155161
PushAllTags,
156162
ForcePush,
157-
string.IsNullOrEmpty(_selectedLocalBranch.Upstream),
163+
Tracking,
158164
SetProgressDescription).Exec();
159165
CallUIThread(() => _repo.SetWatcherEnabled(true));
160166
return succ;

src/Views/Push.axaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Classes="bold"
1414
Text="{DynamicResource Text.Push.Title}"/>
1515

16-
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32" ColumnDefinitions="150,*">
16+
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="150,*">
1717
<TextBlock Grid.Column="0"
1818
HorizontalAlignment="Right" VerticalAlignment="Center"
1919
Margin="0,0,8,0"
@@ -73,10 +73,14 @@
7373
</ComboBox>
7474

7575
<CheckBox Grid.Row="3" Grid.Column="1"
76+
Content="{DynamicResource Text.Push.Tracking}"
77+
IsChecked="{Binding Tracking, Mode=TwoWay}"/>
78+
79+
<CheckBox Grid.Row="4" Grid.Column="1"
7680
Content="{DynamicResource Text.Push.WithAllTags}"
7781
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
7882

79-
<CheckBox Grid.Row="4" Grid.Column="1"
83+
<CheckBox Grid.Row="5" Grid.Column="1"
8084
Content="{DynamicResource Text.Push.Force}"
8185
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
8286
</Grid>

0 commit comments

Comments
 (0)