enhance: cherry-pick (#563)

* supports to cherry-pick a merge commit
* add option to enable the `-x` parameter
This commit is contained in:
leo 2024-10-14 15:18:29 +08:00
parent 688f10e02f
commit 5fef6e93b9
No known key found for this signature in database
7 changed files with 144 additions and 19 deletions

View file

@ -2,12 +2,19 @@
{
public class CherryPick : Command
{
public CherryPick(string repo, string commits, bool noCommit)
public CherryPick(string repo, string commits, bool noCommit, bool appendSourceToMessage, string extraParams)
{
var mode = noCommit ? "-n" : "--ff";
WorkingDirectory = repo;
Context = repo;
Args = $"cherry-pick {mode} {commits}";
Args = "cherry-pick ";
if (noCommit)
Args += "-n ";
if (appendSourceToMessage)
Args += "-x ";
if (!string.IsNullOrEmpty(extraParams))
Args += $"{extraParams} ";
Args += commits;
}
}
}