diff --git a/src/Commands/QueryCommitStatistic.cs b/src/Commands/QueryCommitStatistic.cs
new file mode 100644
index 000000000..a3aabf9ea
--- /dev/null
+++ b/src/Commands/QueryCommitStatistic.cs
@@ -0,0 +1,42 @@
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace SourceGit.Commands
+{
+ public partial class QueryCommitStatistic : Command
+ {
+ [GeneratedRegex(@"(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?")]
+ private static partial Regex REG_SHORTSTAT();
+
+ public QueryCommitStatistic(string repo, string parentRevision, string targetRevision)
+ {
+ WorkingDirectory = repo;
+ Context = repo;
+ Args = $"--no-optional-locks diff --shortstat --no-color {parentRevision} {targetRevision}";
+ }
+
+ public async Task<(int files, int added, int deleted)> GetResultAsync()
+ {
+ var rs = await ReadToEndAsync().ConfigureAwait(false);
+ if (!rs.IsSuccess || string.IsNullOrWhiteSpace(rs.StdOut))
+ return (0, 0, 0);
+
+ var files = 0;
+ var added = 0;
+ var deleted = 0;
+
+ var match = REG_SHORTSTAT().Match(rs.StdOut.Trim());
+ if (match.Success)
+ {
+ if (match.Groups[1].Success)
+ files = int.Parse(match.Groups[1].Value);
+ if (match.Groups[2].Success)
+ added = int.Parse(match.Groups[2].Value);
+ if (match.Groups[3].Success)
+ deleted = int.Parse(match.Groups[3].Value);
+ }
+
+ return (files, added, deleted);
+ }
+ }
+}
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 676bd57a0..446eda3fc 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -176,6 +176,8 @@
Save as Patch...
CHANGES
changed file(s)
+ added
+ deleted
Search Changes...
Collapse details
FILES
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index d77cd5418..7d3f1fac8 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -179,7 +179,9 @@
回滚此提交...
另存为补丁...
变更对比
+ 新增
个文件发生变更
+ 删除
查找变更...
折叠详细面板
文件列表
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index b07c82996..e5fe0af68 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -179,7 +179,9 @@
復原此提交...
另存為修補檔 (patch)...
變更對比
+ 新增
個檔案已變更
+ 刪除
搜尋變更...
收合詳細面板
檔案列表
diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs
index b23465774..d7a672d21 100644
--- a/src/ViewModels/CommitDetail.cs
+++ b/src/ViewModels/CommitDetail.cs
@@ -106,6 +106,18 @@ public List SelectedChanges
}
}
+ public int TotalAddedLines
+ {
+ get => _totalAddedLines;
+ set => SetProperty(ref _totalAddedLines, value);
+ }
+
+ public int TotalDeletedLines
+ {
+ get => _totalDeletedLines;
+ set => SetProperty(ref _totalDeletedLines, value);
+ }
+
public DiffContext DiffContext
{
get => _diffContext;
@@ -543,6 +555,22 @@ private void Refresh()
});
}
}, token);
+
+ Task.Run(async () =>
+ {
+ var (_, added, deleted) = await new Commands.QueryCommitStatistic(_repo.FullPath, _commit.FirstParentToCompare, _commit.SHA)
+ .GetResultAsync()
+ .ConfigureAwait(false);
+
+ if (!token.IsCancellationRequested)
+ {
+ Dispatcher.UIThread.Post(() =>
+ {
+ TotalAddedLines = added;
+ TotalDeletedLines = deleted;
+ });
+ }
+ }, token);
}
private async Task ParseInlinesInMessageAsync(string message)
@@ -750,5 +778,7 @@ private async Task SetViewingCommitAsync(Models.Object file)
private List _revisionFileSearchSuggestion = null;
private bool _canOpenRevisionFileWithDefaultEditor = false;
private Vector _scrollOffset = Vector.Zero;
+ private int _totalAddedLines = 0;
+ private int _totalDeletedLines = 0;
}
}
diff --git a/src/Views/CommitChanges.axaml b/src/Views/CommitChanges.axaml
index d7d245ccf..0c030227f 100644
--- a/src/Views/CommitChanges.axaml
+++ b/src/Views/CommitChanges.axaml
@@ -56,12 +56,32 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+