Show the list of children in the commit details (#710)

* feature: add children list to the commit base info view

Useful for navigation between the commits.

* feature: use repository filters to limit children search
* feature: execute children search asynchronously
* feature: respect global commit limit for a good measure
* fix: input lines may contain several commits

The first commit is always the immediate child, so take only 40 initial characters of the line

* fix: hide children behind the preference
* feature: make parents and children scrollable
This commit is contained in:
Dmitrij D. Czarkoff 2024-11-20 01:17:36 +00:00 committed by GitHub
parent cc1eb55cf0
commit cc5bb5f6d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 170 additions and 44 deletions

View file

@ -78,6 +78,12 @@ namespace SourceGit.ViewModels
}
}
public AvaloniaList<string> Children
{
get;
private set;
} = new AvaloniaList<string>();
public string SearchChangeFilter
{
get => _searchChangeFilter;
@ -515,6 +521,7 @@ namespace SourceGit.ViewModels
VisibleChanges = null;
SelectedChanges = null;
ViewRevisionFileContent = null;
Children.Clear();
if (_commit == null)
return;
@ -535,6 +542,18 @@ namespace SourceGit.ViewModels
_cancelToken.Requested = true;
_cancelToken = new Commands.Command.CancelToken();
if (Preference.Instance.ShowChildren)
{
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];