mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
feature: execute children search asynchronously
This commit is contained in:
parent
3fb1c763f3
commit
f96f602456
2 changed files with 18 additions and 15 deletions
|
@ -15,19 +15,19 @@ namespace SourceGit.Commands
|
|||
Args = $"rev-list --parents {filters} ^{commit}";
|
||||
}
|
||||
|
||||
protected override void OnReadline(string line)
|
||||
{
|
||||
if (line.Contains(_commit))
|
||||
_lines.Add(line);
|
||||
}
|
||||
|
||||
public IEnumerable<string> Result()
|
||||
{
|
||||
var rs = ReadToEnd();
|
||||
if (!rs.IsSuccess)
|
||||
yield break;
|
||||
|
||||
foreach (string s in rs.StdOut.Split('\n', StringSplitOptions.None))
|
||||
{
|
||||
if (s.Contains(_commit))
|
||||
yield return s.Substring(0, 40);
|
||||
}
|
||||
Exec();
|
||||
return _lines;
|
||||
}
|
||||
|
||||
private string _commit;
|
||||
private List<string> _lines = new List<string>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -538,16 +538,19 @@ namespace SourceGit.ViewModels
|
|||
Dispatcher.UIThread.Invoke(() => SignInfo = signInfo);
|
||||
});
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var children = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, _repo.Settings.BuildHistoriesFilter()).Result();
|
||||
Dispatcher.UIThread.Invoke(() => Children.AddRange(children));
|
||||
});
|
||||
|
||||
if (_cancelToken != null)
|
||||
_cancelToken.Requested = true;
|
||||
|
||||
_cancelToken = new Commands.Command.CancelToken();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, _repo.Settings.BuildHistoriesFilter()) { Cancel = _cancelToken };
|
||||
var children = cmdChildren.Result();
|
||||
if (!cmdChildren.Cancel.Requested)
|
||||
Dispatcher.UIThread.Post(() => Children.AddRange(children));
|
||||
});
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var parent = _commit.Parents.Count == 0 ? "4b825dc642cb6eb9a060e54bf8d69288fbee4904" : _commit.Parents[0];
|
||||
|
|
Loading…
Reference in a new issue