mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
enhance: cherry-pick (#563)
* supports to cherry-pick a merge commit * add option to enable the `-x` parameter
This commit is contained in:
parent
688f10e02f
commit
5fef6e93b9
7 changed files with 144 additions and 19 deletions
|
@ -424,7 +424,28 @@ namespace SourceGit.ViewModels
|
|||
cherryPick.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new CherryPick(_repo, [commit]));
|
||||
{
|
||||
if (commit.Parents.Count <= 1)
|
||||
{
|
||||
PopupHost.ShowPopup(new CherryPick(_repo, [commit]));
|
||||
}
|
||||
else
|
||||
{
|
||||
var parents = new List<Models.Commit>();
|
||||
foreach (var sha in commit.Parents)
|
||||
{
|
||||
var parent = _commits.Find(x => x.SHA == sha);
|
||||
if (parent == null)
|
||||
parent = new Commands.QuerySingleCommit(_repo.FullPath, sha).Result();
|
||||
|
||||
if (parent != null)
|
||||
parents.Add(parent);
|
||||
}
|
||||
|
||||
PopupHost.ShowPopup(new CherryPick(_repo, commit, parents));
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(cherryPick);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue