feature<Pull>: remember user's choice for Pull

This commit is contained in:
leo 2022-05-26 17:43:01 +08:00
parent 0463879b29
commit e779d1b65e
3 changed files with 16 additions and 7 deletions

View file

@ -141,6 +141,16 @@ namespace SourceGit.Models {
/// </summary> /// </summary>
public bool UseCombinedDiff { get; set; } = false; public bool UseCombinedDiff { get; set; } = false;
/// <summary>
/// Pull时是否使用Rebase替换Merge
/// </summary>
public bool UseRebaseOnPull { get; set; } = true;
/// <summary>
/// Pull时是否使用自动暂存
/// </summary>
public bool UseAutoStashOnPull { get; set; } = true;
/// <summary> /// <summary>
/// 未暂存视图中变更显示方式 /// 未暂存视图中变更显示方式
/// </summary> /// </summary>

View file

@ -5,7 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:SourceGit.Views.Controls" xmlns:controls="clr-namespace:SourceGit.Views.Controls"
xmlns:converters="clr-namespace:SourceGit.Views.Converters" xmlns:converters="clr-namespace:SourceGit.Views.Converters"
xmlns:models="clr-namespace:SourceGit.Models"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignWidth="500"> d:DesignWidth="500">
<UserControl.Resources> <UserControl.Resources>
@ -81,13 +82,11 @@
<CheckBox Grid.Row="3" Grid.Column="1" <CheckBox Grid.Row="3" Grid.Column="1"
Margin="0,4,0,0" Margin="0,4,0,0"
x:Name="chkUseRebase" IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.UseRebaseOnPull, Mode=TwoWay}"
IsChecked="True"
Content="{DynamicResource Text.Pull.UseRebase}"/> Content="{DynamicResource Text.Pull.UseRebase}"/>
<CheckBox Grid.Row="4" Grid.Column="1" <CheckBox Grid.Row="4" Grid.Column="1"
x:Name="chkAutoStash" IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.UseAutoStashOnPull, Mode=TwoWay}"
IsChecked="True"
Content="{DynamicResource Text.Pull.AutoStash}"/> Content="{DynamicResource Text.Pull.AutoStash}"/>
</Grid> </Grid>
</controls:PopupWidget> </controls:PopupWidget>

View file

@ -42,8 +42,8 @@ namespace SourceGit.Views.Popups {
var branch = cmbBranches.SelectedItem as Models.Branch; var branch = cmbBranches.SelectedItem as Models.Branch;
if (branch == null) return null; if (branch == null) return null;
var rebase = chkUseRebase.IsChecked == true; var rebase = Models.Preference.Instance.Window.UseRebaseOnPull;
var autoStash = chkAutoStash.IsChecked == true; var autoStash = Models.Preference.Instance.Window.UseAutoStashOnPull;
return Task.Run(() => { return Task.Run(() => {
Models.Watcher.SetEnabled(repo.Path, false); Models.Watcher.SetEnabled(repo.Path, false);