code_review: PR (#288)

* add missing translations and it's no need to add `OnPull` suffix since it already has a prefix `Text.Pull.`
* when enable fetching all branches of selected remote, use merge/rebase command instead of pull
* re-arrange orders of options in pull popup panel
* default enable `Fetch all branches`
This commit is contained in:
leo 2024-07-27 20:35:19 +08:00
parent 924a2ce935
commit 4612cecf10
No known key found for this signature in database
6 changed files with 33 additions and 13 deletions

View file

@ -59,7 +59,7 @@ namespace SourceGit.ViewModels
set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
}
public bool FetchAllBranchesOnPull
public bool FetchAllBranches
{
get => _repo.Settings.FetchAllBranchesOnPull;
set => _repo.Settings.FetchAllBranchesOnPull = value;
@ -157,14 +157,32 @@ namespace SourceGit.ViewModels
}
}
if (FetchAllBranchesOnPull)
var rs = false;
if (FetchAllBranches)
{
SetProgressDescription($"Fetching remote: {_selectedRemote.Name}...");
new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec();
rs = new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec();
if (!rs)
return false;
// Use merge/rebase instead of pull as fetch is done manually.
if (UseRebase)
{
SetProgressDescription($"Rebase {_current.Name} on {_selectedBranch.FriendlyName} ...");
rs = new Commands.Rebase(_repo.FullPath, _selectedBranch.FriendlyName, false).Exec();
}
else
{
SetProgressDescription($"Merge {_selectedBranch.FriendlyName} into {_current.Name} ...");
rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", SetProgressDescription).Exec();
}
}
else
{
SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}...");
rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec();
}
SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}...");
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec();
if (rs && needPopStash)
{
SetProgressDescription("Re-apply local changes...");