mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 05:05:00 +00:00
code_review: PR #793
* do NOT modify the existing merge, and add a new constructor for `Commands.Merge` instead * rewrite `ViewModels.MergeMultiple` - since `_histories.Commits.Find` may returns null, use `List<object>` instead of `List<Models.Commits>` - supports display merge target as both `Models.Commit` and `Models.Branch` * rename translation key `Text.MergeMultiple.Commit` to `Text.MergeMultiple.Targets`, and add translations for zh_CN and zh_TW * some UI/UX changes
This commit is contained in:
parent
4eed9674b4
commit
94daa46db9
10 changed files with 122 additions and 40 deletions
|
@ -1,18 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public class Merge : Command
|
||||
{
|
||||
public Merge(string repo, string source, string mode, string strategy, Action<string> outputHandler)
|
||||
public Merge(string repo, string source, string mode, Action<string> outputHandler)
|
||||
{
|
||||
_outputHandler = outputHandler;
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
TraitErrorAsOutput = true;
|
||||
if (strategy != null)
|
||||
strategy = string.Concat("--strategy=", strategy);
|
||||
Args = $"merge --progress {strategy} {source} {mode}";
|
||||
Args = $"merge --progress {source} {mode}";
|
||||
}
|
||||
|
||||
public Merge(string repo, List<string> targets, bool autoCommit, string strategy, Action<string> outputHandler)
|
||||
{
|
||||
_outputHandler = outputHandler;
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
TraitErrorAsOutput = true;
|
||||
|
||||
var builder = new StringBuilder();
|
||||
builder.Append("merge --progress ");
|
||||
if (!string.IsNullOrEmpty(strategy))
|
||||
builder.Append($"--strategy={strategy} ");
|
||||
if (!autoCommit)
|
||||
builder.Append("--no-commit ");
|
||||
|
||||
foreach (var t in targets)
|
||||
{
|
||||
builder.Append(t);
|
||||
builder.Append(' ');
|
||||
}
|
||||
|
||||
Args = builder.ToString();
|
||||
}
|
||||
|
||||
protected override void OnReadline(string line)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue