diff --git a/src/Commands/Merge.cs b/src/Commands/Merge.cs index ee827390..a44c72a1 100644 --- a/src/Commands/Merge.cs +++ b/src/Commands/Merge.cs @@ -1,12 +1,21 @@ +using System; + namespace SourceGit.Commands { /// /// 合并分支 /// public class Merge : Command { + private Action handler = null; - public Merge(string repo, string source, string mode) { + public Merge(string repo, string source, string mode, Action onProgress) { Cwd = repo; - Args = $"merge {source} {mode}"; + Args = $"merge --progress {source} {mode}"; + TraitErrorAsOutput = true; + handler = onProgress; + } + + public override void OnReadline(string line) { + handler?.Invoke(line); } } } diff --git a/src/Views/Popups/Merge.xaml.cs b/src/Views/Popups/Merge.xaml.cs index 06406038..dd3f2f98 100644 --- a/src/Views/Popups/Merge.xaml.cs +++ b/src/Views/Popups/Merge.xaml.cs @@ -26,7 +26,7 @@ namespace SourceGit.Views.Popups { var mode = (cmbMode.SelectedItem as Models.MergeOption).Arg; return Task.Run(() => { Models.Watcher.SetEnabled(repo, false); - new Commands.Merge(repo, source, mode).Exec(); + new Commands.Merge(repo, source, mode, UpdateProgress).Exec(); Models.Watcher.SetEnabled(repo, true); return true; });