From 82320f3494c3079be25c3e47a5f0e0207930c070 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 10:26:34 +0800 Subject: [PATCH] revert: PR #673 * the `Commands.QueryCommitChildren` takes too much time when executes in a large repo Signed-off-by: leo --- src/Commands/QueryCommitChildren.cs | 34 --------------------------- src/Resources/Locales/en_US.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 1 - src/Resources/Locales/zh_TW.axaml | 1 - src/ViewModels/CommitDetail.cs | 13 ----------- src/Views/CommitBaseInfo.axaml | 36 ++++------------------------- src/Views/CommitBaseInfo.axaml.cs | 9 -------- src/Views/CommitDetail.axaml | 1 - 9 files changed, 4 insertions(+), 93 deletions(-) delete mode 100644 src/Commands/QueryCommitChildren.cs diff --git a/src/Commands/QueryCommitChildren.cs b/src/Commands/QueryCommitChildren.cs deleted file mode 100644 index 22a44563..00000000 --- a/src/Commands/QueryCommitChildren.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace SourceGit.Commands -{ - public class QueryCommitChildren : Command - { - public QueryCommitChildren(string repo, string sha) - { - WorkingDirectory = repo; - Context = repo; - _sha = sha; - Args = $"rev-list --children --all {sha}^.."; - } - - public string[] Result() - { - var rs = ReadToEnd(); - if (!rs.IsSuccess) - return []; - - int start = rs.StdOut.IndexOf($"\n{_sha}"); - if (start != -1) - { - int end = rs.StdOut.IndexOf('\n', start + 1); - if (end == -1) - end = rs.StdOut.Length; - start = rs.StdOut.IndexOf(' ', start); - if (start != -1 && start < end) - return rs.StdOut.Substring(start + 1, end - start - 1).Split(' ', System.StringSplitOptions.RemoveEmptyEntries); - } - return []; - } - - private string _sha; - } -} diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 302f7cba..3803bd39 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -125,7 +125,6 @@ INFORMATION AUTHOR CHANGED - CHILDREN COMMITTER Check refs that contains this commit COMMIT IS CONTAINED BY diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 88e2a661..043e8f97 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -118,7 +118,6 @@ INFORMATIONS AUTEUR CHANGÉ - ENFANTS COMMITTER Vérifier les références contenant ce commit LE COMMIT EST CONTENU PAR diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 34c8e647..3df54899 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -128,7 +128,6 @@ 基本信息 修改者 变更列表 - 子提交 提交者 查看包含此提交的分支/标签 本提交已被以下分支/标签包含 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index a35abc1c..4dcb31aa 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -128,7 +128,6 @@ 基本資訊 作者 變更列表 - 子提交 提交者 檢視包含此提交的分支或標籤 本提交包含於以下分支或標籤 diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index d180f6d6..e56ea3fd 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -78,12 +78,6 @@ namespace SourceGit.ViewModels } } - public AvaloniaList Children - { - get; - private set; - } = new AvaloniaList(); - public string SearchChangeFilter { get => _searchChangeFilter; @@ -513,7 +507,6 @@ namespace SourceGit.ViewModels VisibleChanges = null; SelectedChanges = null; ViewRevisionFileContent = null; - Children.Clear(); if (_commit == null) return; @@ -530,12 +523,6 @@ namespace SourceGit.ViewModels Dispatcher.UIThread.Invoke(() => SignInfo = signInfo); }); - Task.Run(() => - { - var children = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA).Result(); - Dispatcher.UIThread.Invoke(() => Children.AddRange(children)); - }); - if (_cancelToken != null) _cancelToken.Requested = true; diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 5f80f5f9..76ea0227 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -51,7 +51,7 @@ - + @@ -122,37 +122,9 @@ - - - - - - - - - - - - - - - - - - + + - + SetValue(IssueTrackerRulesProperty, value); } - public static readonly StyledProperty> ChildrenProperty = - AvaloniaProperty.Register>(nameof(Children)); - - public AvaloniaList Children - { - get => GetValue(ChildrenProperty); - set => SetValue(ChildrenProperty, value); - } - public CommitBaseInfo() { InitializeComponent(); diff --git a/src/Views/CommitDetail.axaml b/src/Views/CommitDetail.axaml index 4c6fd5dc..cb99b3d9 100644 --- a/src/Views/CommitDetail.axaml +++ b/src/Views/CommitDetail.axaml @@ -24,7 +24,6 @@ SignInfo="{Binding SignInfo}" SupportsContainsIn="True" WebLinks="{Binding WebLinks}" - Children="{Binding Children}" IssueTrackerRules="{Binding IssueTrackerRules}"/>