mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-01 01:14:59 +00:00
feature: support to enable --squash
and --push
option while finishing git-flow branches (#1290)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
e8bf58f6c3
commit
ebe0e61367
6 changed files with 47 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Avalonia.Threading;
|
||||
|
||||
|
@ -134,7 +135,7 @@ namespace SourceGit.Commands
|
|||
return start.Exec();
|
||||
}
|
||||
|
||||
public static bool Finish(string repo, string type, string name, bool keepBranch, Models.ICommandLog log)
|
||||
public static bool Finish(string repo, string type, string name, bool squash, bool push, bool keepBranch, Models.ICommandLog log)
|
||||
{
|
||||
if (!SUPPORTED_BRANCH_TYPES.Contains(type))
|
||||
{
|
||||
|
@ -146,11 +147,22 @@ namespace SourceGit.Commands
|
|||
return false;
|
||||
}
|
||||
|
||||
var option = keepBranch ? "-k" : string.Empty;
|
||||
var builder = new StringBuilder();
|
||||
builder.Append("flow ");
|
||||
builder.Append(type);
|
||||
builder.Append(" finish ");
|
||||
if (squash)
|
||||
builder.Append("--squash ");
|
||||
if (push)
|
||||
builder.Append("--push ");
|
||||
if (keepBranch)
|
||||
builder.Append("-k ");
|
||||
builder.Append(name);
|
||||
|
||||
var finish = new Command();
|
||||
finish.WorkingDirectory = repo;
|
||||
finish.Context = repo;
|
||||
finish.Args = $"flow {type} finish {option} {name}";
|
||||
finish.Args = builder.ToString();
|
||||
finish.Log = log;
|
||||
return finish.Exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue