mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
refactor: rewrite the way to deal with uncommitted local changes when checkout/pull/create branch (#1085)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
e430e847ff
commit
0e261cffd2
21 changed files with 63 additions and 260 deletions
|
@ -1,5 +1,4 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -9,51 +8,5 @@ namespace SourceGit.Views
|
|||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(e);
|
||||
|
||||
var vm = DataContext as ViewModels.CreateBranch;
|
||||
if (vm == null)
|
||||
return;
|
||||
|
||||
switch (vm.PreAction)
|
||||
{
|
||||
case Models.DealWithLocalChanges.DoNothing:
|
||||
RadioDoNothing.IsChecked = true;
|
||||
break;
|
||||
case Models.DealWithLocalChanges.StashAndReaply:
|
||||
RadioStashAndReply.IsChecked = true;
|
||||
break;
|
||||
default:
|
||||
RadioDiscard.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLocalChangeActionIsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = DataContext as ViewModels.CreateBranch;
|
||||
if (vm == null)
|
||||
return;
|
||||
|
||||
if (RadioDoNothing.IsChecked == true)
|
||||
{
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.DoNothing)
|
||||
vm.PreAction = Models.DealWithLocalChanges.DoNothing;
|
||||
return;
|
||||
}
|
||||
|
||||
if (RadioStashAndReply.IsChecked == true)
|
||||
{
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.StashAndReaply)
|
||||
vm.PreAction = Models.DealWithLocalChanges.StashAndReaply;
|
||||
return;
|
||||
}
|
||||
|
||||
if (vm.PreAction != Models.DealWithLocalChanges.Discard)
|
||||
vm.PreAction = Models.DealWithLocalChanges.Discard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue