Skip to content

Commit 8a38b6a

Browse files
committed
Add fetch all branches on pull. (acts like fetch+pull)
1 parent 7bfb684 commit 8a38b6a

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

src/Models/RepositorySettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public bool FetchWithoutTagsOnPull
3434
set;
3535
} = false;
3636

37+
public bool FetchAllBranchesOnPull
38+
{
39+
get;
40+
set;
41+
} = false;
42+
3743
public bool PushAllTags
3844
{
3945
get;

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@
403403
<x:String x:Key="Text.PruneWorktrees.Tip" xml:space="preserve">Prune worktree information in `$GIT_DIR/worktrees`</x:String>
404404
<x:String x:Key="Text.Pull" xml:space="preserve">Pull</x:String>
405405
<x:String x:Key="Text.Pull.Branch" xml:space="preserve">Branch:</x:String>
406+
<x:String x:Key="Text.Pull.FetchAllBranchesOnPull" xml:space="preserve">Fetch all branches on pull</x:String>
406407
<x:String x:Key="Text.Pull.Into" xml:space="preserve">Into:</x:String>
407408
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Local Changes:</x:String>
408409
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Discard</x:String>

src/ViewModels/Pull.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public bool UseRebase
5858
get => _repo.Settings.PreferRebaseInsteadOfMerge;
5959
set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
6060
}
61+
62+
public bool FetchAllBranchesOnPull
63+
{
64+
get => _repo.Settings.FetchAllBranchesOnPull;
65+
set => _repo.Settings.FetchAllBranchesOnPull = value;
66+
}
6167

6268
public bool NoTags
6369
{
@@ -151,6 +157,12 @@ public override Task<bool> Sure()
151157
}
152158
}
153159

160+
if (FetchAllBranchesOnPull)
161+
{
162+
SetProgressDescription($"Fetching remote: {_selectedRemote.Name}...");
163+
new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec();
164+
}
165+
154166
SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}...");
155167
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec();
156168
if (rs && needPopStash)

src/Views/Pull.axaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<TextBlock FontSize="18"
1313
Classes="bold"
1414
Text="{DynamicResource Text.Pull.Title}"/>
15-
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="140,*">
15+
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32,32" ColumnDefinitions="140,*">
1616
<TextBlock Grid.Row="0" Grid.Column="0"
1717
HorizontalAlignment="Right" VerticalAlignment="Center"
1818
Margin="0,0,8,0"
@@ -91,6 +91,10 @@
9191
<CheckBox Grid.Row="5" Grid.Column="1"
9292
Content="{DynamicResource Text.Pull.NoTags}"
9393
IsChecked="{Binding NoTags, Mode=TwoWay}"/>
94+
95+
<CheckBox Grid.Row="6" Grid.Column="1"
96+
Content="{DynamicResource Text.Pull.FetchAllBranchesOnPull}"
97+
IsChecked="{Binding FetchAllBranchesOnPull, Mode=TwoWay}"/>
9498
</Grid>
9599
</StackPanel>
96100
</UserControl>

0 commit comments

Comments
 (0)