mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-07 03:45: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
|
@ -38,11 +38,11 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _selectedBranch, value, true);
|
||||
}
|
||||
|
||||
public Models.DealWithLocalChanges PreAction
|
||||
public bool DiscardLocalChanges
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = Models.DealWithLocalChanges.DoNothing;
|
||||
}
|
||||
|
||||
public bool UseRebase
|
||||
{
|
||||
|
@ -124,7 +124,12 @@ namespace SourceGit.ViewModels
|
|||
var needPopStash = false;
|
||||
if (changes > 0)
|
||||
{
|
||||
if (PreAction == Models.DealWithLocalChanges.StashAndReaply)
|
||||
if (DiscardLocalChanges)
|
||||
{
|
||||
SetProgressDescription("Discard local changes ...");
|
||||
Commands.Discard.All(_repo.FullPath, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProgressDescription("Stash local changes...");
|
||||
var succ = new Commands.Stash(_repo.FullPath).Push("PULL_AUTO_STASH");
|
||||
|
@ -136,11 +141,6 @@ namespace SourceGit.ViewModels
|
|||
|
||||
needPopStash = true;
|
||||
}
|
||||
else if (PreAction == Models.DealWithLocalChanges.Discard)
|
||||
{
|
||||
SetProgressDescription("Discard local changes ...");
|
||||
Commands.Discard.All(_repo.FullPath, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool rs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue