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>
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>

View file

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

View file

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