mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature<Merge>: show progress for merge
This commit is contained in:
parent
67f5eed9a0
commit
763779b529
2 changed files with 12 additions and 3 deletions
|
@ -1,12 +1,21 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace SourceGit.Commands {
|
namespace SourceGit.Commands {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 合并分支
|
/// 合并分支
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Merge : Command {
|
public class Merge : Command {
|
||||||
|
private Action<string> handler = null;
|
||||||
|
|
||||||
public Merge(string repo, string source, string mode) {
|
public Merge(string repo, string source, string mode, Action<string> onProgress) {
|
||||||
Cwd = repo;
|
Cwd = repo;
|
||||||
Args = $"merge {source} {mode}";
|
Args = $"merge --progress {source} {mode}";
|
||||||
|
TraitErrorAsOutput = true;
|
||||||
|
handler = onProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnReadline(string line) {
|
||||||
|
handler?.Invoke(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SourceGit.Views.Popups {
|
||||||
var mode = (cmbMode.SelectedItem as Models.MergeOption).Arg;
|
var mode = (cmbMode.SelectedItem as Models.MergeOption).Arg;
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
Models.Watcher.SetEnabled(repo, false);
|
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);
|
Models.Watcher.SetEnabled(repo, true);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue