From f45bed6f92d0f4f1c8b567ab11c78bdb8165c638 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 10:31:17 +0800 Subject: [PATCH 01/59] fix: avoid NRE Signed-off-by: leo --- src/Views/TextDiffView.axaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 242f8c4c..757690e8 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1089,7 +1089,7 @@ namespace SourceGit.Views public void ForceSyncScrollOffset() { if (DataContext is ViewModels.TwoSideTextDiff diff) - diff.SyncScrollOffset = _scrollViewer.Offset; + diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero; } public override List GetLines() @@ -1302,7 +1302,7 @@ namespace SourceGit.Views private void OnTextViewScrollChanged(object sender, ScrollChangedEventArgs e) { if (TextArea.IsFocused && DataContext is ViewModels.TwoSideTextDiff diff) - diff.SyncScrollOffset = _scrollViewer.Offset; + diff.SyncScrollOffset = _scrollViewer?.Offset ?? Vector.Zero; } private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e) From b25f9bdb6c51542b054730f8f7ea9fb8dfabf2f1 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 11:32:13 +0800 Subject: [PATCH 02/59] feature: supports switch histories order mode (#705) Signed-off-by: leo --- src/Commands/QueryCommits.cs | 6 ++++-- src/Resources/Icons.axaml | 1 + src/Resources/Locales/en_US.axaml | 3 +++ src/Resources/Locales/zh_CN.axaml | 3 +++ src/Resources/Locales/zh_TW.axaml | 3 +++ src/ViewModels/FileHistories.cs | 3 ++- src/ViewModels/Repository.cs | 13 +++++++++++- src/Views/Repository.axaml | 9 ++++++++- src/Views/Repository.axaml.cs | 33 +++++++++++++++++++++++++++++++ 9 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/Commands/QueryCommits.cs b/src/Commands/QueryCommits.cs index 5875301e..80497a90 100644 --- a/src/Commands/QueryCommits.cs +++ b/src/Commands/QueryCommits.cs @@ -6,11 +6,13 @@ namespace SourceGit.Commands { public class QueryCommits : Command { - public QueryCommits(string repo, string limits, bool needFindHead = true) + public QueryCommits(string repo, bool useTopoOrder, string limits, bool needFindHead = true) { + var order = useTopoOrder ? "--topo-order" : "--date-order"; + WorkingDirectory = repo; Context = repo; - Args = "log --date-order --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s " + limits; + Args = $"log {order} --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s {limits}"; _findFirstMerged = needFindHead; } diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 53b2b3d3..413d2df9 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -79,6 +79,7 @@ M299 811 299 725 384 725 384 811 299 811M469 811 469 725 555 725 555 811 469 811M640 811 640 725 725 725 725 811 640 811M299 640 299 555 384 555 384 640 299 640M469 640 469 555 555 555 555 640 469 640M640 640 640 555 725 555 725 640 640 640M299 469 299 384 384 384 384 469 299 469M469 469 469 384 555 384 555 469 469 469M640 469 640 384 725 384 725 469 640 469M299 299 299 213 384 213 384 299 299 299M469 299 469 213 555 213 555 299 469 299M640 299 640 213 725 213 725 299 640 299Z M64 363l0 204 265 0L329 460c0-11 6-18 14-20C349 437 355 437 362 441c93 60 226 149 226 149 33 22 34 60 0 82 0 0-133 89-226 149-14 9-32-3-32-18l-1-110L64 693l0 117c0 41 34 75 75 75l746 0c41 0 75-34 75-74L960 364c0-0 0-1 0-1L64 363zM64 214l0 75 650 0-33-80c-16-38-62-69-103-69l-440 0C97 139 64 173 64 214z M683 409v204L1024 308 683 0v191c-413 0-427 526-427 526c117-229 203-307 427-307zm85 492H102V327h153s38-63 114-122H51c-28 0-51 27-51 61v697c0 34 23 61 51 61h768c28 0 51-27 51-61V614l-102 100v187z + M841 627A43 43 0 00811 555h-299v85h196l-183 183A43 43 0 00555 896h299v-85h-196l183-183zM299 170H213v512H85l171 171 171-171H299zM725 128h-85c-18 0-34 11-40 28l-117 313h91L606 384h154l32 85h91l-117-313A43 43 0 00725 128zm-88 171 32-85h26l32 85h-90z M640 96c-158 0-288 130-288 288 0 17 3 31 5 46L105 681 96 691V928h224v-96h96v-96h96v-95c38 18 82 31 128 31 158 0 288-130 288-288s-130-288-288-288zm0 64c123 0 224 101 224 224s-101 224-224 224a235 235 0 01-109-28l-8-4H448v96h-96v96H256v96H160v-146l253-254 12-11-3-17C419 417 416 400 416 384c0-123 101-224 224-224zm64 96a64 64 0 100 128 64 64 0 100-128z M544 85c49 0 90 37 95 85h75a96 96 0 0196 89L811 267a32 32 0 01-28 32L779 299a32 32 0 01-32-28L747 267a32 32 0 00-28-32L715 235h-91a96 96 0 01-80 42H395c-33 0-62-17-80-42L224 235a32 32 0 00-32 28L192 267v576c0 16 12 30 28 32l4 0h128a32 32 0 0132 28l0 4a32 32 0 01-32 32h-128a96 96 0 01-96-89L128 843V267a96 96 0 0189-96L224 171h75a96 96 0 0195-85h150zm256 256a96 96 0 0196 89l0 7v405a96 96 0 01-89 96L800 939h-277a96 96 0 01-96-89L427 843v-405a96 96 0 0189-96L523 341h277zm-256-192H395a32 32 0 000 64h150a32 32 0 100-64z m186 532 287 0 0 287c0 11 9 20 20 20s20-9 20-20l0-287 287 0c11 0 20-9 20-20s-9-20-20-20l-287 0 0-287c0-11-9-20-20-20s-20 9-20 20l0 287-287 0c-11 0-20 9-20 20s9 20 20 20z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 55fb04d8..d742ac78 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -543,6 +543,9 @@ Unset Hide in commit graph Filter in commit graph + Switch Order Mode + By Date (--date-order) + Topologically (--topo-order) LOCAL BRANCHES Navigate to HEAD Enable '--first-parent' Option diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 1ab661be..a1779a36 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -547,6 +547,9 @@ 不指定 在提交列表中隐藏 使用其对提交列表过滤 + 切换排序模式 + 按提交时间 (--date-order) + 按拓扑排序 (--topo-order) 本地分支 定位HEAD 启用 --first-parent 过滤选项 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 5452fef6..c821679b 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -546,6 +546,9 @@ 不指定 在提交清單中隱藏 使用其來篩選提交清單 + 切換排序方式 + 按提交时间排序 (--date-order) + 按拓扑排序 (--topo-order) 本機分支 回到 HEAD 啟用 [--first-parent] 選項 diff --git a/src/ViewModels/FileHistories.cs b/src/ViewModels/FileHistories.cs index 52ed6b01..8384d42e 100644 --- a/src/ViewModels/FileHistories.cs +++ b/src/ViewModels/FileHistories.cs @@ -64,7 +64,8 @@ namespace SourceGit.ViewModels Task.Run(() => { - var commits = new Commands.QueryCommits(_repo.FullPath, $"-n 10000 {commit} -- \"{file}\"", false).Result(); + var based = commit ?? string.Empty; + var commits = new Commands.QueryCommits(_repo.FullPath, false, $"-n 10000 {based} -- \"{file}\"", false).Result(); Dispatcher.UIThread.Invoke(() => { IsLoading = false; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 1847c79a..c87fea6b 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -106,6 +106,16 @@ namespace SourceGit.ViewModels } } + public bool EnableTopoOrderInHistories + { + get => _enableTopoOrderInHistories; + set + { + if (SetProperty(ref _enableTopoOrderInHistories, value)) + Task.Run(RefreshCommits); + } + } + public string Filter { get => _filter; @@ -852,7 +862,7 @@ namespace SourceGit.ViewModels else builder.Append(filters); - var commits = new Commands.QueryCommits(_fullpath, builder.ToString()).Result(); + var commits = new Commands.QueryCommits(_fullpath, _enableTopoOrderInHistories, builder.ToString()).Result(); var graph = Models.CommitGraph.Parse(commits, _enableFirstParentInHistories); Dispatcher.UIThread.Invoke(() => @@ -2228,6 +2238,7 @@ namespace SourceGit.ViewModels private bool _onlySearchCommitsInCurrentBranch = false; private bool _enableReflog = false; private bool _enableFirstParentInHistories = false; + private bool _enableTopoOrderInHistories = false; private string _searchCommitFilter = string.Empty; private List _searchedCommits = new List(); private List _revisionFiles = new List(); diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index a6c7679b..079af6ab 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -67,7 +67,7 @@ - + + diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index dec3d447..3a0e387f 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -395,5 +395,38 @@ namespace SourceGit.Views } e.Handled = true; } + + private void OnSwitchHistoriesOrderClicked(object sender, RoutedEventArgs e) + { + if (sender is Button button && DataContext is ViewModels.Repository repo) + { + var checkIcon = App.CreateMenuIcon("Icons.Check"); + + var dateOrder = new MenuItem(); + dateOrder.Header = App.Text("Repository.HistoriesOrder.ByDate"); + dateOrder.Icon = repo.EnableTopoOrderInHistories ? null : checkIcon; + dateOrder.Click += (_, ev) => + { + repo.EnableTopoOrderInHistories = false; + ev.Handled = true; + }; + + var topoOrder = new MenuItem(); + topoOrder.Header = App.Text("Repository.HistoriesOrder.Topo"); + topoOrder.Icon = repo.EnableTopoOrderInHistories ? checkIcon : null; + topoOrder.Click += (_, ev) => + { + repo.EnableTopoOrderInHistories = true; + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(dateOrder); + menu.Items.Add(topoOrder); + menu.Open(button); + } + + e.Handled = true; + } } } From 00804e453e1b98a7f5693cee5233361faa7634d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 19 Nov 2024 03:33:55 +0000 Subject: [PATCH 03/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d49fb1e4..63916c27 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-100.00%25-brightgreen)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.14%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.14%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.71%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.99%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.57%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 5967d21e..ad8ebc64 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,14 +1,16 @@ -### de_DE.axaml: 100.00% +### de_DE.axaml: 99.57%
Missing Keys - +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo
-### es_ES.axaml: 99.14% +### es_ES.axaml: 98.71%
@@ -20,10 +22,13 @@ - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo
-### fr_FR.axaml: 98.42% +### fr_FR.axaml: 97.99%
@@ -39,11 +44,14 @@ - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo - Text.ScanRepositories
-### pt_BR.axaml: 99.14% +### pt_BR.axaml: 98.71%
@@ -55,16 +63,21 @@ - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.57%
Missing Keys - +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo
From 814529a6907b3477e42febcf87790fd0f352fc2a Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 12:12:31 +0800 Subject: [PATCH 04/59] feature: add hotkeys to stage/unstage/discard block or selected lines in text diff view (#718) Signed-off-by: leo --- src/Views/TextDiffView.axaml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Views/TextDiffView.axaml b/src/Views/TextDiffView.axaml index f2a5beaf..d9d6dde3 100644 --- a/src/Views/TextDiffView.axaml +++ b/src/Views/TextDiffView.axaml @@ -97,9 +97,29 @@ - + + + + From b452e13453de9d442a465d7accc7470b92123b1e Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 14:42:59 +0800 Subject: [PATCH 05/59] localization: update Text.Repository.HistoriesOrder.ByDate Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index d742ac78..ed4f1baf 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -544,7 +544,7 @@ Hide in commit graph Filter in commit graph Switch Order Mode - By Date (--date-order) + Commit Date (--date-order) Topologically (--topo-order) LOCAL BRANCHES Navigate to HEAD From 73687689cefd96c456192f72830155dc2d671872 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 16:45:07 +0800 Subject: [PATCH 06/59] ux: min height of change block in minimap Signed-off-by: leo --- src/Views/TextDiffView.axaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 757690e8..544453f5 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -1426,7 +1426,7 @@ namespace SourceGit.Views { var brush = type == Models.TextDiffLineType.Added ? AddedLineBrush : DeletedLineBrush; var y = start / (total * 1.0) * Bounds.Height; - var h = count / (total * 1.0) * Bounds.Height; + var h = Math.Max(0.5, count / (total * 1.0) * Bounds.Height); context.DrawRectangle(brush, null, new Rect(x, y, width, h)); } } From 8021cd8566be5f8ac548ef352c18bc2df856aa6c Mon Sep 17 00:00:00 2001 From: aikawayataro Date: Tue, 19 Nov 2024 11:46:44 +0000 Subject: [PATCH 07/59] enhance: introduce template engine for commit templates (#704) (#719) --- src/Models/CommitTemplate.cs | 59 +---- src/Models/TemplateEngine.cs | 410 +++++++++++++++++++++++++++++++++++ 2 files changed, 413 insertions(+), 56 deletions(-) create mode 100644 src/Models/TemplateEngine.cs diff --git a/src/Models/CommitTemplate.cs b/src/Models/CommitTemplate.cs index b34fa5a5..56e1992c 100644 --- a/src/Models/CommitTemplate.cs +++ b/src/Models/CommitTemplate.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; +using System.Collections.Generic; using CommunityToolkit.Mvvm.ComponentModel; @@ -9,9 +6,6 @@ namespace SourceGit.Models { public partial class CommitTemplate : ObservableObject { - [GeneratedRegex(@"\$\{files(\:\d+)?\}")] - private static partial Regex REG_COMMIT_TEMPLATE_FILES(); - public string Name { get => _name; @@ -26,55 +20,8 @@ namespace SourceGit.Models public string Apply(Branch branch, List changes) { - var content = _content - .Replace("${files_num}", $"{changes.Count}") - .Replace("${branch_name}", branch.Name); - - var matches = REG_COMMIT_TEMPLATE_FILES().Matches(content); - if (matches.Count == 0) - return content; - - var builder = new StringBuilder(); - var last = 0; - for (int i = 0; i < matches.Count; i++) - { - var match = matches[i]; - if (!match.Success) - continue; - - var start = match.Index; - if (start != last) - builder.Append(content.Substring(last, start - last)); - - var countStr = match.Groups[1].Value; - var paths = new List(); - var more = string.Empty; - if (countStr is { Length: <= 1 }) - { - foreach (var c in changes) - paths.Add(c.Path); - } - else - { - var count = Math.Min(int.Parse(countStr.Substring(1)), changes.Count); - for (int j = 0; j < count; j++) - paths.Add(changes[j].Path); - - if (count < changes.Count) - more = $" and {changes.Count - count} other files"; - } - - builder.Append(string.Join(", ", paths)); - if (!string.IsNullOrEmpty(more)) - builder.Append(more); - - last = start + match.Length; - } - - if (last != content.Length - 1) - builder.Append(content.Substring(last)); - - return builder.ToString(); + var te = new TemplateEngine(); + return te.Eval(_content, branch, changes); } private string _name = string.Empty; diff --git a/src/Models/TemplateEngine.cs b/src/Models/TemplateEngine.cs new file mode 100644 index 00000000..6b5f525d --- /dev/null +++ b/src/Models/TemplateEngine.cs @@ -0,0 +1,410 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace SourceGit.Models +{ + public class TemplateEngine + { + private class Context(Branch branch, IReadOnlyList changes) + { + public Branch branch = branch; + public IReadOnlyList changes = changes; + } + + private class Text(string text) + { + public string text = text; + } + + private class Variable(string name) + { + public string name = name; + } + + private class SlicedVariable(string name, int count) + { + public string name = name; + public int count = count; + } + + private class RegexVariable(string name, Regex regex, string replacement) + { + public string name = name; + public Regex regex = regex; + public string replacement = replacement; + } + + private const char ESCAPE = '\\'; + private const char VARIABLE_ANCHOR = '$'; + private const char VARIABLE_START = '{'; + private const char VARIABLE_END = '}'; + private const char VARIABLE_SLICE = ':'; + private const char VARIABLE_REGEX = '/'; + private const char NEWLINE = '\n'; + private const RegexOptions REGEX_OPTIONS = RegexOptions.Singleline | RegexOptions.IgnoreCase; + + public string Eval(string text, Branch branch, IReadOnlyList changes) + { + Reset(); + + _chars = text.ToCharArray(); + Parse(); + + var context = new Context(branch, changes); + var sb = new StringBuilder(); + sb.EnsureCapacity(text.Length); + foreach (var token in _tokens) + { + switch (token) + { + case Text text_token: + sb.Append(text_token.text); + break; + case Variable var_token: + sb.Append(EvalVariable(context, var_token)); + break; + case SlicedVariable sliced_var: + sb.Append(EvalVariable(context, sliced_var)); + break; + case RegexVariable regex_var: + sb.Append(EvalVariable(context, regex_var)); + break; + } + } + + return sb.ToString(); + } + + private void Reset() + { + _pos = 0; + _chars = []; + _tokens.Clear(); + } + + private char? Next() + { + var c = Peek(); + if (c is not null) + { + _pos++; + } + return c; + } + + private char? Peek() + { + return (_pos >= _chars.Length) ? null : _chars[_pos]; + } + + private int? Integer() + { + var start = _pos; + while (Peek() is char c && c >= '0' && c <= '9') + { + _pos++; + } + if (start >= _pos) + return null; + + var chars = new ReadOnlySpan(_chars, start, _pos - start); + return int.Parse(chars); + } + + private void Parse() + { + // text token start + var tok = _pos; + bool esc = false; + while (Next() is char c) + { + if (esc) + { + esc = false; + continue; + } + switch (c) + { + case ESCAPE: + // allow to escape only \ and $ + if (Peek() is char nc && (nc == ESCAPE || nc == VARIABLE_ANCHOR)) + { + esc = true; + FlushText(tok, _pos - 1); + tok = _pos; + } + break; + case VARIABLE_ANCHOR: + // backup the position + var bak = _pos; + var variable = TryParseVariable(); + if (variable is null) + { + // no variable found, rollback + _pos = bak; + } + else + { + // variable found, flush a text token + FlushText(tok, bak - 1); + _tokens.Add(variable); + tok = _pos; + } + break; + } + } + // flush text token + FlushText(tok, _pos); + } + + private void FlushText(int start, int end) + { + int len = end - start; + if (len <= 0) + return; + var text = new string(_chars, start, len); + _tokens.Add(new Text(text)); + } + + private object TryParseVariable() + { + if (Next() != VARIABLE_START) + return null; + int name_start = _pos; + while (Next() is char c) + { + // name character, continue advancing + if (IsNameChar(c)) + continue; + + var name_end = _pos - 1; + // not a name character but name is empty, cancel + if (name_start >= name_end) + return null; + var name = new string(_chars, name_start, name_end - name_start); + + return c switch + { + // variable + VARIABLE_END => new Variable(name), + // sliced variable + VARIABLE_SLICE => TryParseSlicedVariable(name), + // regex variable + VARIABLE_REGEX => TryParseRegexVariable(name), + _ => null, + }; + } + + return null; + } + + private object TryParseSlicedVariable(string name) + { + int? n = Integer(); + if (n is null) + return null; + if (Next() != VARIABLE_END) + return null; + + return new SlicedVariable(name, (int)n); + } + + private object TryParseRegexVariable(string name) + { + var regex = ParseRegex(); + if (regex == null) + return null; + var replacement = ParseReplacement(); + if (replacement == null) + return null; + + return new RegexVariable(name, regex, replacement); + } + + private Regex ParseRegex() + { + var sb = new StringBuilder(); + var tok = _pos; + var esc = false; + while (Next() is char c) + { + if (esc) + { + esc = false; + continue; + } + switch (c) + { + case ESCAPE: + // allow to escape only / as \ and { used frequently in regexes + if (Peek() == VARIABLE_REGEX) + { + esc = true; + sb.Append(_chars, tok, _pos - 1 - tok); + tok = _pos; + } + break; + case VARIABLE_REGEX: + // goto is fine + goto Loop_exit; + case NEWLINE: + // no newlines allowed + return null; + } + } + Loop_exit: + sb.Append(_chars, tok, _pos - 1 - tok); + + try + { + var pattern = sb.ToString(); + if (pattern.Length == 0) + return null; + var regex = new Regex(pattern, REGEX_OPTIONS); + + return regex; + } + catch (RegexParseException) + { + return null; + } + } + + private string ParseReplacement() + { + var sb = new StringBuilder(); + var tok = _pos; + var esc = false; + while (Next() is char c) + { + if (esc) + { + esc = false; + continue; + } + switch (c) + { + case ESCAPE: + // allow to escape only } + if (Peek() == VARIABLE_END) + { + esc = true; + sb.Append(_chars, tok, _pos - 1 - tok); + tok = _pos; + } + break; + case VARIABLE_END: + // goto is fine + goto Loop_exit; + case NEWLINE: + // no newlines allowed + return null; + } + } + Loop_exit: + sb.Append(_chars, tok, _pos - 1 - tok); + + var replacement = sb.ToString(); + + return replacement; + } + + private static bool IsNameChar(char c) + { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'); + } + + // (?) notice or log if variable is not found + private static string EvalVariable(Context context, string name) + { + if (!s_variables.TryGetValue(name, out var getter)) + { + return string.Empty; + } + return getter(context); + } + + private static string EvalVariable(Context context, Variable variable) + { + return EvalVariable(context, variable.name); + } + + private static string EvalVariable(Context context, SlicedVariable variable) + { + if (!s_slicedVariables.TryGetValue(variable.name, out var getter)) + { + return string.Empty; + } + return getter(context, variable.count); + } + + private static string EvalVariable(Context context, RegexVariable variable) + { + var str = EvalVariable(context, variable.name); + if (string.IsNullOrEmpty(str)) + return str; + return variable.regex.Replace(str, variable.replacement); + } + + private int _pos = 0; + private char[] _chars = []; + private readonly List _tokens = []; + + private delegate string VariableGetter(Context context); + + private static readonly IReadOnlyDictionary s_variables = new Dictionary() { + // legacy variables + {"branch_name", GetBranchName}, + {"files_num", GetFilesCount}, + {"files", GetFiles}, + // + {"BRANCH", GetBranchName}, + {"FILES_COUNT", GetFilesCount}, + {"FILES", GetFiles}, + }; + + private static string GetBranchName(Context context) + { + return context.branch.Name; + } + + private static string GetFilesCount(Context context) + { + return context.changes.Count.ToString(); + } + + private static string GetFiles(Context context) + { + var paths = new List(); + foreach (var c in context.changes) + paths.Add(c.Path); + return string.Join(", ", paths); + } + + private delegate string VariableSliceGetter(Context context, int count); + + private static readonly IReadOnlyDictionary s_slicedVariables = new Dictionary() { + // legacy variables + {"files", GetFilesSliced}, + // + {"FILES", GetFilesSliced}, + }; + + private static string GetFilesSliced(Context context, int count) + { + var sb = new StringBuilder(); + var paths = new List(); + var max = Math.Min(count, context.changes.Count); + for (int i = 0; i < max; i++) + paths.Add(context.changes[i].Path); + + sb.AppendJoin(", ", paths); + if (max < context.changes.Count) + sb.AppendFormat(" and {0} other files", context.changes.Count - max); + + return sb.ToString(); + } + } +} From 7a9c8d7444890b6d4fe455dba22225f0b9d2c117 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 19 Nov 2024 20:07:37 +0800 Subject: [PATCH 08/59] ux: enable TextTrimming for author name in FileHistories Signed-off-by: leo --- src/Views/FileHistories.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/FileHistories.axaml b/src/Views/FileHistories.axaml index 703957b8..8403ae73 100644 --- a/src/Views/FileHistories.axaml +++ b/src/Views/FileHistories.axaml @@ -80,7 +80,7 @@ - + Date: Tue, 19 Nov 2024 22:16:44 -0300 Subject: [PATCH 09/59] update pt-BR strings (#722) * fix: update pt-BR strings * doc: Update translation status and missing keys Co-authored-by: github-actions[bot] --- README.md | 2 +- TRANSLATION.md | 12 +- src/Resources/Locales/pt_BR.axaml | 340 +++++++++++++++--------------- 3 files changed, 178 insertions(+), 176 deletions(-) diff --git a/README.md b/README.md index 63916c27..ecb4e40b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.71%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.99%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.57%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.71%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.99%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.57%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index ad8ebc64..83ba7f13 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -51,21 +51,13 @@ -### pt_BR.axaml: 98.71% +### pt_BR.axaml: 100.00%
Missing Keys -- Text.Preference.Appearance.FontSize -- Text.Preference.Appearance.FontSize.Default -- Text.Preference.Appearance.FontSize.Editor -- Text.Repository.FilterCommits.Default -- Text.Repository.FilterCommits.Exclude -- Text.Repository.FilterCommits.Include -- Text.Repository.HistoriesOrder -- Text.Repository.HistoriesOrder.ByDate -- Text.Repository.HistoriesOrder.Topo +
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index a4f20310..744fc0cc 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -2,6 +2,7 @@ + + Sobre + Sobre o SourceGit • Construído com • Gráfico desenhado por © 2024 sourcegit-scm • Editor de Texto de • Fontes monoespaçadas de - Sobre o SourceGit • Código-fonte pode ser encontrado em Cliente Git GUI Livre e de Código Aberto - Sobre - Caminho para este worktree. Caminho relativo é suportado. - Localização: - Opcional. O padrão é o nome da pasta de destino. - Nome do Branch: - Rastreando branch remoto - Rastrear Branch: - Criar Novo Branch - Branch Existente - O que Checar: Adicionar Worktree + O que Checar: + Branch Existente + Criar Novo Branch + Localização: + Caminho para este worktree. Caminho relativo é suportado. + Nome do Branch: + Opcional. O padrão é o nome da pasta de destino. + Rastrear Branch: + Rastreando branch remoto Assietente IA Utilizar IA para gerar mensagem de commit - Erros levantados e se recusa a aplicar o patch - Erro - Semelhante a 'erro', mas mostra mais - Erro Total - Selecione o arquivo .patch para aplicar - Arquivo de Patch: - Ignorar mudanças de espaço em branco - Desativa o aviso de espaço em branco no final - Sem Aviso - Aplicar Patch - Emite avisos para alguns erros, mas aplica - Aviso - Espaço em Branco: Patch - Selecione o caminho do arquivo de arquivo + Erro + Erros levantados e se recusa a aplicar o patch + Erro Total + Semelhante a 'erro', mas mostra mais + Arquivo de Patch: + Selecione o arquivo .patch para aplicar + Ignorar mudanças de espaço em branco + Sem Aviso + Desativa o aviso de espaço em branco no final + Aplicar Patch + Aviso + Emite avisos para alguns erros, mas aplica + Espaço em Branco: + Arquivar... Salvar Arquivo Como: + Selecione o caminho do arquivo de arquivo Revisão: Arquivar - Arquivar... SourceGit Askpass + ARQUIVOS CONSIDERADOS SEM ALTERAÇÕES NENHUM ARQUIVO CONSIDERADO SEM ALTERAÇÕES REMOVER - ARQUIVOS CONSIDERADOS SEM ALTERAÇÕES ARQUIVO BINÁRIO NÃO SUPORTADO!!! Blame BLAME NESTE ARQUIVO NÃO É SUPORTADO!!! @@ -95,42 +96,42 @@ Comparação de Branches Bytes CANCELAR - Resetar para Revisão Pai Resetar para Esta Revisão + Resetar para Revisão Pai Gerar mensagem de commit + ALTERAR MODO DE EXIBIÇÃO Exibir como Lista de Arquivos e Diretórios Exibir como Lista de Caminhos Exibir como Árvore de Sistema de Arquivos - ALTERAR MODO DE EXIBIÇÃO - Commit: - Aviso: Ao fazer o checkout de um commit, seu Head ficará desanexado + Checkout Branch Checkout Commit + Aviso: Ao fazer o checkout de um commit, seu Head ficará desanexado + Commit: + Branch: + Alterações Locais: Descartar Nada Stash & Reaplicar - Alterações Locais: - Branch: - Checkout Branch + Cherry-Pick Adicionar origem à mensagem de commit Commit(s): Commitar todas as alterações Mainline: Geralmente você não pode fazer cherry-pick de um merge commit porque você não sabe qual lado do merge deve ser considerado na mainline. Esta opção permite ao cherry-pick reaplicar a mudança relativa ao parent especificado. - Cherry-Pick - Você está tentando limpar todas as stashes. Tem certeza que deseja continuar? Limpar Stashes - Argumentos adicionais para clonar o repositório. Opcional. + Você está tentando limpar todas as stashes. Tem certeza que deseja continuar? + Clonar Repositório Remoto Parâmetros Extras: - Nome do repositório. Opcional. + Argumentos adicionais para clonar o repositório. Opcional. Nome Local: + Nome do repositório. Opcional. Pasta Pai: URL do Repositório: - Clonar Repositório Remoto FECHAR Editor - Checar Commit Cherry-Pick este commit Cherry-Pick ... + Checar Commit Comparar com HEAD Comparar com Worktree Copiar Informações @@ -144,11 +145,12 @@ Salvar como Patch... Mesclar ao Commit Pai Mesclar commits filhos para este - Buscar Alterações... ALTERAÇÕES + Buscar Alterações... + ARQUIVOS Arquivo LFS Submódulo - ARQUIVOS + INFORMAÇÃO AUTOR ALTERADO COMMITTER @@ -159,13 +161,13 @@ PAIS REFERÊNCIAS SHA - INFORMAÇÃO Abrir no navegador - Descrição Insira o assunto do commit - Conteúdo do Template: - Nome do Template: + Descrição + Configurar Repositório TEMPLATE DE COMMIT + Nome do Template: + Conteúdo do Template: AÇÃO CUSTOMIZADA Argumentos: ${REPO} - Caminho do repositório; ${SHA} - SHA do commit selecionado @@ -176,12 +178,13 @@ Repositório Endereço de email Endereço de email + GIT Buscar remotos automaticamente Minuto(s) Remoto padrão Habilita --prune ao buscar Habilita --signoff para commits - GIT + RASTREADOR DE PROBLEMAS Adicionar Regra de Exemplo do Github Adicionar Regra de Exemplo do Jira Adicionar Regra de Exemplo do GitLab @@ -189,17 +192,15 @@ Nova Regra Expressão Regex de Issue: Nome da Regra: - Por favor, use $1, $2 para acessar os valores de grupos do regex. URL de Resultado: - RASTREADOR DE PROBLEMAS + Por favor, use $1, $2 para acessar os valores de grupos do regex. IA Serviço desejado: Se o 'Serviço desejado' for definido, SourceGit usará ele neste Repositório. Senão, caso haja mais de um serviço disponível, será exibido um menu para seleção. - Proxy HTTP usado por este repositório Proxy HTTP - Nome de usuário para este repositório + Proxy HTTP usado por este repositório Nome de Usuário - Configurar Repositório + Nome de usuário para este repositório Workspaces Cor Restaurar abas ao inicializar @@ -212,51 +213,51 @@ Tipo de mudança: Copiar Copiar todo o texto - Copiar Nome do Arquivo Copiar Caminho + Copiar Nome do Arquivo + Criar Branch... Baseado Em: Checar o branch criado + Alterações Locais: Descartar Não Fazer Nada Guardar & Reaplicar - Alterações Locais: - Insira o nome do branch. Nome do Novo Branch: + Insira o nome do branch. Criar Branch Local - Criar Branch... + Criar Tag... Nova Tag Em: Assinatura GPG - Opcional. Mensagem da Tag: - Formato recomendado: v1.0.0-alpha + Opcional. Nome da Tag: + Formato recomendado: v1.0.0-alpha Enviar para todos os remotos após criação Criar Nova Tag + Tipo: anotada leve - Tipo: - Criar Tag... Pressione Ctrl para iniciar diretamente Recortar + Excluir Branch Branch: Você está prestes a excluir uma branch remota!!! Também excluir branch remoto ${0}$ - Excluir Branch - Você está tentando excluir vários branches de uma vez. Certifique-se de verificar antes de agir! Excluir Múltiplos Branches - Remoto: + Você está tentando excluir vários branches de uma vez. Certifique-se de verificar antes de agir! Excluir Remoto + Remoto: Alvo: Confirmar Exclusão do Grupo Confirmar Exclusão do Repositório - Caminho do Submódulo: Excluir Submódulo + Caminho do Submódulo: + Excluir Tag Tag: Excluir dos repositórios remotos - Excluir Tag + DIFERENÇA BINÁRIA NOVO ANTIGO - DIFERENÇA BINÁRIA Copiar Modo de Arquivo Alterado Ignorar mudanças de espaço em branco @@ -267,8 +268,8 @@ Salvar como um Patch Exibir símbolos ocultos Diferença Lado a Lado - NOVO SUBMÓDULO + NOVO Trocar Realce de Sintaxe Quebra de Linha @@ -278,12 +279,12 @@ Aumentar Número de Linhas Visíveis SELECIONE O ARQUIVO PARA VISUALIZAR AS MUDANÇAS Abrir na Ferramenta de Mesclagem + Descartar Alterações Todas as alterações locais na cópia de trabalho. Alterações: Incluir arquivos ignorados Um total de {0} alterações será descartado Você não pode desfazer esta ação!!! - Descartar Alterações Favorito: Novo Nome: Alvo: @@ -292,11 +293,11 @@ Executar ação customizada Nome da ação: Fast-Forward (sem checkout) + Buscar Buscar todos os remotos Buscar sem tags Remoto: Buscar Alterações Remotas - Buscar Assumir não alterado Descartar... Descartar {0} arquivos... @@ -311,11 +312,12 @@ Desfazer Preparação Desfazer Preparação de {0} arquivos Desfazer Preparação nas Linhas Selecionadas - Usar Meu (checkout --ours) Usar Deles (checkout --theirs) + Usar Meu (checkout --ours) Histórico de Arquivos CONTEUDO MUDANÇA + Git-Flow Branch de Desenvolvimento: Feature: Prefixo da Feature: @@ -338,34 +340,34 @@ Iniciar Release... FLOW - Iniciar Release Prefixo da Tag de Versão: - Git-Flow + Git LFS + Adicionar Padrão de Rastreamento... Padrão é nome do arquivo Padrão Personalizado: Adicionar Padrão de Rastreamento ao Git LFS - Adicionar Padrão de Rastreamento... - Execute `git lfs fetch` para baixar objetos Git LFS. Isso não atualiza a cópia de trabalho. - Buscar Objetos LFS Buscar + Buscar Objetos LFS + Execute `git lfs fetch` para baixar objetos Git LFS. Isso não atualiza a cópia de trabalho. Instalar hooks do Git LFS + Exibir bloqueios Sem Arquivos Bloqueados Bloquear Exibir apenas meus bloqueios Bloqueios LFS Desbloquear Forçar Desbloqueio - Exibir bloqueios - Execute `git lfs prune` para excluir arquivos LFS antigos do armazenamento local Prune - Execute `git lfs pull` para baixar todos os arquivos Git LFS para a referência atual e checkout - Puxar Objetos LFS + Execute `git lfs prune` para excluir arquivos LFS antigos do armazenamento local Puxar - Envie arquivos grandes enfileirados para o endpoint Git LFS - Enviar Objetos LFS + Puxar Objetos LFS + Execute `git lfs pull` para baixar todos os arquivos Git LFS para a referência atual e checkout Enviar + Enviar Objetos LFS + Envie arquivos grandes enfileirados para o endpoint Git LFS Remoto: Rastrear arquivos nomeados '{0}' Rastrear todos os arquivos *{0} - Git LFS + Históricos Alternar Layout Horizontal/Vertical AUTOR DATA DO AUTOR @@ -373,17 +375,18 @@ SHA HORA DO COMMIT SELECIONADO {0} COMMITS + Segure 'Ctrl' ou 'Shift' para selecionar múltiplos commits. Segure ⌘ ou ⇧ para selecionar múltiplos commits. DICAS: - Segure 'Ctrl' ou 'Shift' para selecionar múltiplos commits. - Históricos + Referência de Atalhos de Teclado + GLOBAL Cancelar popup atual Fechar página atual - Ir para a próxima página Ir para a página anterior + Ir para a próxima página Criar nova página Abrir diálogo de preferências - GLOBAL + REPOSITÓRIO Commitar mudanças preparadas Commitar e enviar mudanças preparadas Preparar todas as mudanças e commitar @@ -391,43 +394,41 @@ Descartar mudanças selecionadas Buscar, imediatamente Modo de Dashboard (Padrão) - Modo de busca de commits Puxar, imediatamente Enviar, imediatamente Forçar recarregamento deste repositório Preparar/Despreparar mudanças selecionadas + Modo de busca de commits Alternar para 'Mudanças' Alternar para 'Históricos' Alternar para 'Stashes' - REPOSITÓRIO + EDITOR DE TEXTO Fechar painel de busca Encontrar próxima correspondência Encontrar correspondência anterior Abrir painel de busca - EDITOR DE TEXTO - Referência de Atalhos de Teclado - Descartar Preparar Despreparar - Caminho: + Descartar Inicializar Repositório + Caminho: Cherry-Pick em andamento. Pressione 'Abort' para restaurar o HEAD original. Merge em andamento. Pressione 'Abort' para restaurar o HEAD original. Rebase em andamento. Pressione 'Abort' para restaurar o HEAD original. Revert em andamento. Pressione 'Abort' para restaurar o HEAD original. - Em: - Ramo Alvo: Rebase Interativo - Copiar link + Ramo Alvo: + Em: Abrir no navegador + Copiar link ERRO AVISO + Mesclar Ramo Para: Opção de Mesclagem: Ramo de Origem: Mover nó do repositório Selecionar nó pai para: - Mesclar Ramo Nome: O Git NÃO foi configurado. Por favor, vá para [Preferências] e configure primeiro. Abrir Pasta de Dados do Aplicativo @@ -441,79 +442,83 @@ Copiar Caminho do Repositório Repositórios Colar - {0} dias atrás - {0} horas atrás Agora mesmo - Mês passado - Ano passado {0} minutos atrás - {0} meses atrás - {0} anos atrás + {0} horas atrás Ontem + {0} dias atrás + Mês passado + {0} meses atrás + Ano passado + {0} anos atrás + Preferências + INTELIGÊNCIA ARTIFICIAL Prompt para Analisar Diff Chave da API Prompt para Gerar Título Modelo Nome Servidor - INTELIGÊNCIA ARTIFICIAL + APARÊNCIA Fonte Padrão + Tamanho da Fonte + Padrão + Editor Fonte Monoespaçada Usar fonte monoespaçada apenas no editor de texto Tema Substituições de Tema Usar largura fixa de aba na barra de título Usar moldura de janela nativa - APARÊNCIA - Insira o caminho para a ferramenta de diff/merge - Caminho de Instalação - Ferramenta FERRAMENTA DE DIFF/MERGE + Caminho de Instalação + Insira o caminho para a ferramenta de diff/merge + Ferramenta + GERAL Verificar atualizações na inicialização Idioma Commits do Histórico Exibir data do autor em vez da data do commit no gráfico Comprimento do Guia de Assunto - GERAL + GIT Habilitar Auto CRLF Diretório de Clone Padrão - Email global do usuário git Email do Usuário - Git (>= 2.23.0) é necessário para este aplicativo + Email global do usuário git Caminho de Instalação - Nome global do usuário git Nome do Usuário + Nome global do usuário git Versão do Git - GIT - Assinatura GPG de commit - Formato GPG - Insira o caminho para o programa gpg instalado - Caminho de Instalação do Programa - Assinatura GPG de tag - Chave de assinatura gpg do usuário - Chave de Assinatura do Usuário + Git (>= 2.23.0) é necessário para este aplicativo ASSINATURA GPG + Assinatura GPG de commit + Assinatura GPG de tag + Formato GPG + Caminho de Instalação do Programa + Insira o caminho para o programa gpg instalado + Chave de Assinatura do Usuário + Chave de assinatura gpg do usuário INTEGRAÇÃO - Caminho - Shell/Terminal SHELL/TERMINAL - Preferências - Alvo: + Shell/Terminal + Caminho Prunar Remoto - Podar informações de worktree em `$GIT_DIR/worktrees` + Alvo: Podar Worktrees + Podar informações de worktree em `$GIT_DIR/worktrees` + Puxar Branch: Buscar todos os branches Para: + Alterações Locais: Descartar Não Fazer Nada Guardar & Reaplicar - Alterações Locais: Buscar sem tags Remoto: Puxar (Buscar & Mesclar) Usar rebase em vez de merge - Puxar + Empurrar Certifica de que submodules foram enviadas Forçar push Branch Local: @@ -522,36 +527,35 @@ Branch Remoto: Definir como branch de rastreamento Empurrar todas as tags - Empurrar + Empurrar Tag para o Remoto Empurrar para todos os remotos Remoto: Tag: - Empurrar Tag para o Remoto Sair + Rebase da Branch Atual Guardar & reaplicar alterações locais Em: Rebase: - Rebase da Branch Atual Atualizar Adicionar Remoto Editar Remoto - Nome do remoto Nome: - URL do repositório git remoto + Nome do remoto URL do Repositório: + URL do repositório git remoto Copiar URL Excluir... Editar... Buscar Abrir no Navegador Podar + Confirmar Remoção de Worktree Habilitar Opção `--force` Alvo: - Confirmar Remoção de Worktree - Nome único para este branch - Novo Nome: - Branch: Renomear Branch + Novo Nome: + Nome único para este branch + Branch: ABORTAR Buscando automaticamente mudanças dos remotos... Limpar (GC & Podar) @@ -564,108 +568,115 @@ Habilitar opção '--reflog' Abrir no Navegador de Arquivos Pesquisar Branches/Tags/Submódulos - Habilitar opção '--first-parent' + Desfazer + Esconder no gráfico de commit + Incluir no gráfico de commit + Alternar Modo de Ordenação + Data do Commit (--date-order) + Topologicamente (--topo-order) BRANCHES LOCAIS Navegar para HEAD + Habilitar opção '--first-parent' Criar Branch Abrir em {0} Abrir em Ferramentas Externas Atualizar - ADICIONAR REMOTO REMOTOS + ADICIONAR REMOTO RESOLVER + Pesquisar Commit Arquivo Mensagem SHA Autor & Committer Branch Atual - Pesquisar Commit Exibir Tags como Árvore Estatísticas + SUBMÓDULOS ADICIONAR SUBMÓDULO ATUALIZAR SUBMÓDULO - SUBMÓDULOS - NOVA TAG TAGS + NOVA TAG Abrir no Terminal + WORKTREES ADICIONAR WORKTREE PODAR - WORKTREES URL do Repositório Git + Resetar Branch Atual para Revisão Modo de Reset: Mover Para: Branch Atual: - Resetar Branch Atual para Revisão Revelar no Explorador de Arquivos + Reverter Commit Commit: Commitar alterações de reversão - Reverter Commit - Use 'Shift+Enter' para inserir uma nova linha. 'Enter' é a tecla de atalho do botão OK Reescrever Mensagem do Commit + Use 'Shift+Enter' para inserir uma nova linha. 'Enter' é a tecla de atalho do botão OK Executando. Por favor, aguarde... SALVAR Salvar Como... Patch salvo com sucesso! - Diretório Raiz: Escanear Repositórios + Diretório Raiz: + Verificar atualizações... Nova versão deste software disponível: Falha ao verificar atualizações! Baixar Ignorar esta versão Atualização de Software Não há atualizações disponíveis no momento. - Verificar atualizações... Squash Commits Squash commits em: - Caminho para a chave SSH privada Chave SSH Privada: + Caminho para a chave SSH privada INICIAR + Stash Incluir arquivos não rastreados Manter arquivos em stage - Opcional. Nome deste stash Mensagem: + Opcional. Nome deste stash Apenas mudanças em stage Tanto mudanças em stage e fora de stage dos arquivos selecionados serão enviadas para stash!!! Guardar Alterações Locais - Stash Aplicar Descartar Pop - Descartar: Descartar Stash + Descartar: + Stashes ALTERAÇÕES STASHES - Stashes + Estatísticas COMMITS COMMITTER - VISÃO GERAL MÊS SEMANA - AUTORES: COMMITS: - Estatísticas + AUTORES: + VISÃO GERAL + SUBMÓDULOS Adicionar Submódulo Copiar Caminho Relativo Buscar submódulos aninhados Abrir Repositório do Submódulo - Pasta relativa para armazenar este módulo. Caminho Relativo: + Pasta relativa para armazenar este módulo. Excluir Submódulo - SUBMÓDULOS OK Copiar Nome da Tag Copiar mensage da Tag Excluir ${0}$... Mesclar ${0}$ em ${1}$... Enviar ${0}$... + URL: + Atualizar Submódulos Todos os submódulos Inicializar conforme necessário Recursivamente Submódulo: Usar opção --remote - Atualizar Submódulos - URL: Aviso + Página de Boas-vindas Criar Grupo Raíz Criar Subgrupo Clonar Repositório @@ -679,12 +690,12 @@ Reescanear Repositórios no Diretório de Clone Padrão Buscar Repositórios... Ordenar - Página de Boas-vindas + Alterações + Git Ignore Ignorar todos os arquivos *{0} Ignorar arquivos *{0} na mesma pasta Ignorar arquivos na mesma pasta Ignorar apenas este arquivo - Git Ignore Corrigir Você pode stagear este arquivo agora. COMMIT @@ -693,26 +704,25 @@ Acionar evento de clique Preparar todas as mudanças e commitar Commit vazio detectado! Deseja continuar (--allow-empty)? - CONFLITOS DE ARQUIVO RESOLVIDOS CONFLITOS DETECTADOS + CONFLITOS DE ARQUIVO RESOLVIDOS INCLUIR ARQUIVOS NÃO RASTREADOS SEM MENSAGENS DE ENTRADA RECENTES SEM MODELOS DE COMMIT - Clique com o botão direito nos arquivos selecionados e escolha como resolver conflitos. + STAGED UNSTAGE UNSTAGE TODOS - STAGED UNSTAGED STAGE STAGE TODOS VER SUPOR NÃO ALTERADO Template: ${0}$ - Alterações - Configurar workspaces... + Clique com o botão direito nos arquivos selecionados e escolha como resolver conflitos. Workspaces: + Configurar workspaces... + WORKTREE Copiar Caminho Bloquear Remover Desbloquear - WORKTREE From cc5bb5f6d4ff97d3db62fbea79194274426249b9 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Wed, 20 Nov 2024 01:17:36 +0000 Subject: [PATCH 10/59] 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 --- src/Commands/QueryCommitChildren.cs | 34 ++++++++ src/Resources/Locales/en_US.axaml | 2 + src/Resources/Locales/fr_FR.axaml | 1 + src/ViewModels/CommitDetail.cs | 19 ++++ src/ViewModels/Preference.cs | 8 ++ src/Views/CommitBaseInfo.axaml | 131 +++++++++++++++++++--------- src/Views/CommitBaseInfo.axaml.cs | 9 ++ src/Views/CommitDetail.axaml | 1 + src/Views/Preference.axaml | 9 +- 9 files changed, 170 insertions(+), 44 deletions(-) create mode 100644 src/Commands/QueryCommitChildren.cs diff --git a/src/Commands/QueryCommitChildren.cs b/src/Commands/QueryCommitChildren.cs new file mode 100644 index 00000000..c110ef94 --- /dev/null +++ b/src/Commands/QueryCommitChildren.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using SourceGit.ViewModels; + +namespace SourceGit.Commands +{ + public class QueryCommitChildren : Command + { + public QueryCommitChildren(string repo, string commit, string filters) + { + WorkingDirectory = repo; + Context = repo; + _commit = commit; + if (string.IsNullOrEmpty(filters)) + filters = "--all"; + Args = $"rev-list -{Preference.Instance.MaxHistoryCommits} --parents {filters} ^{commit}"; + } + + protected override void OnReadline(string line) + { + if (line.Contains(_commit)) + _lines.Add(line.Substring(0, 40)); + } + + public IEnumerable Result() + { + Exec(); + return _lines; + } + + private string _commit; + private List _lines = new List(); + } +} diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index ed4f1baf..462cdf90 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -125,6 +125,7 @@ INFORMATION AUTHOR CHANGED + CHILDREN COMMITTER Check refs that contains this commit COMMIT IS CONTAINED BY @@ -451,6 +452,7 @@ Language History Commits Show author time intead of commit time in graph + Show children in the comment details Subject Guide Length GIT Enable Auto CRLF diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 75cd4d58..5a1a8e7b 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -126,6 +126,7 @@ INFORMATIONS AUTEUR CHANGÉ + ENFANTS COMMITTER Vérifier les références contenant ce commit LE COMMIT EST CONTENU PAR diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 7ef8ce85..6d819300 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -78,6 +78,12 @@ namespace SourceGit.ViewModels } } + public AvaloniaList Children + { + get; + private set; + } = new AvaloniaList(); + 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]; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 68065df1..9d3de526 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -294,6 +294,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _statisticsSampleColor, value); } + public bool ShowChildren + { + get => _showChildren; + set => SetProperty(ref _showChildren, value); + } + public List RepositoryNodes { get; @@ -617,5 +623,7 @@ namespace SourceGit.ViewModels private string _externalMergeToolPath = string.Empty; private uint _statisticsSampleColor = 0xFF00FF00; + + private bool _showChildren = false; } } diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index d8b77a18..d3d3bb0e 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -51,7 +51,7 @@ - + @@ -102,50 +102,97 @@ - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + 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 cb99b3d9..4c6fd5dc 100644 --- a/src/Views/CommitDetail.axaml +++ b/src/Views/CommitDetail.axaml @@ -24,6 +24,7 @@ SignInfo="{Binding SignInfo}" SupportsContainsIn="True" WebLinks="{Binding WebLinks}" + Children="{Binding Children}" IssueTrackerRules="{Binding IssueTrackerRules}"/> diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 9b84604a..0c7986ab 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -45,7 +45,7 @@ - + + + @@ -188,7 +193,7 @@ - + Date: Wed, 20 Nov 2024 01:17:50 +0000 Subject: [PATCH 11/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ecb4e40b..5e9f9ae8 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.71%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.99%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.57%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.71%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.71%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 83ba7f13..5425520f 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,24 +1,28 @@ -### de_DE.axaml: 99.57% +### de_DE.axaml: 99.29%
Missing Keys +- Text.CommitDetail.Info.Children +- Text.Preference.General.ShowChildren - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo
-### es_ES.axaml: 98.71% +### es_ES.axaml: 98.43%
Missing Keys +- Text.CommitDetail.Info.Children - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor +- Text.Preference.General.ShowChildren - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include @@ -28,7 +32,7 @@
-### fr_FR.axaml: 97.99% +### fr_FR.axaml: 97.86%
@@ -40,6 +44,7 @@ - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor +- Text.Preference.General.ShowChildren - Text.Repository.CustomActions - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude @@ -51,44 +56,49 @@
-### pt_BR.axaml: 100.00% +### pt_BR.axaml: 99.71%
Missing Keys - +- Text.CommitDetail.Info.Children +- Text.Preference.General.ShowChildren
-### ru_RU.axaml: 99.57% +### ru_RU.axaml: 99.29%
Missing Keys +- Text.CommitDetail.Info.Children +- Text.Preference.General.ShowChildren - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.71%
Missing Keys - +- Text.CommitDetail.Info.Children +- Text.Preference.General.ShowChildren
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.71%
Missing Keys - +- Text.CommitDetail.Info.Children +- Text.Preference.General.ShowChildren
From ab2156bfc21a1fe6d9404e6ee332c200447db212 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 09:42:48 +0800 Subject: [PATCH 12/59] code_review: PR #710 * SourceGit.Commands.* should not reference SourceGit.ViewModels.* * remove unused namespace using * update translations for zh_CN and zh_TW * use WrapPanel instead of inner ScrollViewer * some other UI/UX changes Signed-off-by: leo --- src/Commands/QueryCommitChildren.cs | 22 ++-- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 3 +- src/ViewModels/CommitDetail.cs | 4 +- src/ViewModels/Preference.cs | 15 ++- src/Views/CommitBaseInfo.axaml | 164 ++++++++++++++-------------- src/Views/Preference.axaml | 8 +- 7 files changed, 107 insertions(+), 110 deletions(-) diff --git a/src/Commands/QueryCommitChildren.cs b/src/Commands/QueryCommitChildren.cs index c110ef94..293de912 100644 --- a/src/Commands/QueryCommitChildren.cs +++ b/src/Commands/QueryCommitChildren.cs @@ -1,25 +1,17 @@ -using System; -using System.Collections.Generic; -using SourceGit.ViewModels; +using System.Collections.Generic; namespace SourceGit.Commands { public class QueryCommitChildren : Command { - public QueryCommitChildren(string repo, string commit, string filters) + public QueryCommitChildren(string repo, string commit, int max, string filters) { WorkingDirectory = repo; Context = repo; _commit = commit; if (string.IsNullOrEmpty(filters)) - filters = "--all"; - Args = $"rev-list -{Preference.Instance.MaxHistoryCommits} --parents {filters} ^{commit}"; - } - - protected override void OnReadline(string line) - { - if (line.Contains(_commit)) - _lines.Add(line.Substring(0, 40)); + filters = "--branches --remotes --tags"; + Args = $"rev-list -{max} --parents {filters} ^{commit}"; } public IEnumerable Result() @@ -28,6 +20,12 @@ namespace SourceGit.Commands return _lines; } + protected override void OnReadline(string line) + { + if (line.Contains(_commit)) + _lines.Add(line.Substring(0, 40)); + } + private string _commit; private List _lines = new List(); } diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index a1779a36..1e6fca06 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -128,6 +128,7 @@ 基本信息 修改者 变更列表 + 子提交 提交者 查看包含此提交的分支/标签 本提交已被以下分支/标签包含 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index c821679b..06ee4b37 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -128,7 +128,8 @@ 基本資訊 作者 變更列表 - 提交者 + 後續提交 + 提交 檢視包含此提交的分支或標籤 本提交包含於以下分支或標籤 僅顯示前 100 項變更。請前往 [變更對比] 頁面以瀏覽所有變更。 diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 6d819300..e874b09b 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -547,7 +547,9 @@ namespace SourceGit.ViewModels { Task.Run(() => { - var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, _repo.Settings.BuildHistoriesFilter()) { Cancel = _cancelToken }; + var max = Preference.Instance.MaxHistoryCommits; + var filter = _repo.Settings.BuildHistoriesFilter(); + var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, max, filter) { Cancel = _cancelToken }; var children = cmdChildren.Result(); if (!cmdChildren.Cancel.Requested) Dispatcher.UIThread.Post(() => Children.AddRange(children)); diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 9d3de526..70f0041f 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -144,6 +144,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _showAuthorTimeInGraph, value); } + public bool ShowChildren + { + get => _showChildren; + set => SetProperty(ref _showChildren, value); + } + public string IgnoreUpdateTag { get => _ignoreUpdateTag; @@ -294,12 +300,6 @@ namespace SourceGit.ViewModels set => SetProperty(ref _statisticsSampleColor, value); } - public bool ShowChildren - { - get => _showChildren; - set => SetProperty(ref _showChildren, value); - } - public List RepositoryNodes { get; @@ -598,6 +598,7 @@ namespace SourceGit.ViewModels private int _subjectGuideLength = 50; private bool _useFixedTabWidth = true; private bool _showAuthorTimeInGraph = false; + private bool _showChildren = false; private bool _check4UpdatesOnStartup = true; private double _lastCheckUpdateTime = 0; @@ -623,7 +624,5 @@ namespace SourceGit.ViewModels private string _externalMergeToolPath = string.Empty; private uint _statisticsSampleColor = 0xFF00FF00; - - private bool _showChildren = false; } } diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index d3d3bb0e..b58c3daf 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -53,8 +53,8 @@ - - + + - - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + - + - + + Content="{DynamicResource Text.Preference.General.ShowChildren}" + IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=ShowChildren, Mode=TwoWay}"/> + Content="{DynamicResource Text.Preference.General.Check4UpdatesOnStartup}" + IsChecked="{Binding Source={x:Static vm:Preference.Instance}, Path=Check4UpdatesOnStartup, Mode=TwoWay}"/> From 15eaa9eeab01e94851268f5da51211a7917e8e35 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Nov 2024 01:43:12 +0000 Subject: [PATCH 13/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5e9f9ae8..9a611dd0 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.71%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.71%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 5425520f..a53d423a 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -81,24 +81,22 @@ -### zh_CN.axaml: 99.71% +### zh_CN.axaml: 99.86%
Missing Keys -- Text.CommitDetail.Info.Children - Text.Preference.General.ShowChildren
-### zh_TW.axaml: 99.71% +### zh_TW.axaml: 99.86%
Missing Keys -- Text.CommitDetail.Info.Children - Text.Preference.General.ShowChildren
From 71e09ee045c513d3faa77fdd72fa5f7dfac8616e Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 09:56:38 +0800 Subject: [PATCH 14/59] localization: add missing translations for zh_CN and zh_TW (#710) Signed-off-by: leo --- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 1e6fca06..0c0ccf14 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -456,6 +456,7 @@ 显示语言 最大历史提交数 在提交路线图中显示修改时间而非提交时间 + 在提交详情页中显示子提交列表 SUBJECT字数检测 GIT配置 自动换行转换 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 06ee4b37..c21f471f 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -455,6 +455,7 @@ 顯示語言 最大歷史提交數 在提交路線圖中顯示修改時間而非提交時間 + 在提交詳細面板中顯示後續提交 提交標題字數偵測 Git 設定 自動換行轉換 From 892c74406f7ce7316eeca3fbad17f502a7f0dd84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Nov 2024 01:57:08 +0000 Subject: [PATCH 15/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a611dd0..74cc6e3e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index a53d423a..d5061a30 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -81,22 +81,22 @@ -### zh_CN.axaml: 99.86% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Preference.General.ShowChildren +
-### zh_TW.axaml: 99.86% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Preference.General.ShowChildren +
From 4796024483962d66530ac2452732b5eabfee1fd0 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 10:21:59 +0800 Subject: [PATCH 16/59] fix: modified the translation of Text.CommitDetail.Info.Committer by mistake Signed-off-by: leo --- src/Resources/Locales/zh_TW.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index c21f471f..31015ae7 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -129,7 +129,7 @@ 作者 變更列表 後續提交 - 提交 + 提交者 檢視包含此提交的分支或標籤 本提交包含於以下分支或標籤 僅顯示前 100 項變更。請前往 [變更對比] 頁面以瀏覽所有變更。 From 86d7541a7ce62b988aabea69816dcb2747ad8837 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 11:27:43 +0800 Subject: [PATCH 17/59] enhance: histories filter * set upstream branch using the same filter mode when change the filter mode of local branch * also excludes the decorators when current filter mode is excluding. Signed-off-by: leo --- src/Models/RepositorySettings.cs | 6 ++++++ src/ViewModels/Repository.cs | 24 ++---------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index f6796198..5b3aa331 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -320,6 +320,8 @@ namespace SourceGit.Models { builder.Append("--exclude="); builder.Append(b); + builder.Append(" --decorate-refs-exclude=refs/heads/"); + builder.Append(b); builder.Append(' '); } } @@ -332,6 +334,8 @@ namespace SourceGit.Models { builder.Append("--exclude="); builder.Append(r); + builder.Append(" --decorate-refs-exclude=refs/remotes/"); + builder.Append(r); builder.Append(' '); } } @@ -344,6 +348,8 @@ namespace SourceGit.Models { builder.Append("--exclude="); builder.Append(t); + builder.Append(" --decorate-refs-exclude=refs/tags/"); + builder.Append(t); builder.Append(' '); } } diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index c87fea6b..2a87cb15 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -724,28 +724,8 @@ namespace SourceGit.ViewModels if (!changed) return; - if (isLocal && !string.IsNullOrEmpty(branch.Upstream) && mode != Models.FilterMode.Excluded) - { - var upstream = branch.Upstream; - var canUpdateUpstream = true; - foreach (var filter in _settings.HistoriesFilters) - { - bool matched = false; - if (filter.Type == Models.FilterType.RemoteBranch) - matched = filter.Pattern.Equals(upstream, StringComparison.Ordinal); - else if (filter.Type == Models.FilterType.RemoteBranchFolder) - matched = upstream.StartsWith(filter.Pattern, StringComparison.Ordinal); - - if (matched && filter.Mode == Models.FilterMode.Excluded) - { - canUpdateUpstream = false; - break; - } - } - - if (canUpdateUpstream) - _settings.UpdateHistoriesFilter(upstream, Models.FilterType.RemoteBranch, mode); - } + if (isLocal && !string.IsNullOrEmpty(branch.Upstream)) + _settings.UpdateHistoriesFilter(branch.Upstream, Models.FilterType.RemoteBranch, mode); } else { From 839dab494ba215a18c5e1209e7c42fc476d12df6 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 14:39:53 +0800 Subject: [PATCH 18/59] ux: expand height of commit message box in commit template settings (#720) Signed-off-by: leo --- src/Views/RepositoryConfigure.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml index f1deca3a..c596f9e7 100644 --- a/src/Views/RepositoryConfigure.axaml +++ b/src/Views/RepositoryConfigure.axaml @@ -155,7 +155,7 @@ - + @@ -227,7 +227,7 @@ - + Date: Wed, 20 Nov 2024 16:52:30 +0800 Subject: [PATCH 19/59] refactor: update `Repository.HistoriesFilterMode` in `Repository.RefreshHistoriesFilters` Signed-off-by: leo --- src/ViewModels/Repository.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 2a87cb15..ab7924d5 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -704,12 +704,7 @@ namespace SourceGit.ViewModels { var changed = _settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode); if (changed) - { - if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0) - HistoriesFilterMode = mode; - RefreshHistoriesFilters(); - } } public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode) @@ -754,9 +749,6 @@ namespace SourceGit.ViewModels cur = parent; } while (true); - if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0) - HistoriesFilterMode = mode; - RefreshHistoriesFilters(); } @@ -2073,6 +2065,12 @@ namespace SourceGit.ViewModels UpdateBranchTreeFilterMode(LocalBranchTrees, filters); UpdateBranchTreeFilterMode(RemoteBranchTrees, filters); UpdateTagFilterMode(filters); + + if (_settings.HistoriesFilters.Count > 0) + HistoriesFilterMode = _settings.HistoriesFilters[0].Mode; + else + HistoriesFilterMode = Models.FilterMode.None; + Task.Run(RefreshCommits); } From b3ebd84af54ff9d770bc3766fe74b55b25181360 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 19:44:58 +0800 Subject: [PATCH 20/59] enhance: outputs the response body if OpenAI fails Signed-off-by: leo --- src/Models/OpenAI.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Models/OpenAI.cs b/src/Models/OpenAI.cs index c5ca7449..58f26792 100644 --- a/src/Models/OpenAI.cs +++ b/src/Models/OpenAI.cs @@ -169,12 +169,15 @@ namespace SourceGit.Models task.Wait(cancellation); var rsp = task.Result; - if (!rsp.IsSuccessStatusCode) - throw new Exception($"AI service returns error code {rsp.StatusCode}"); - var reader = rsp.Content.ReadAsStringAsync(cancellation); reader.Wait(cancellation); + var body = reader.Result; + if (!rsp.IsSuccessStatusCode) + { + throw new Exception($"AI service returns error code {rsp.StatusCode}. Body: {body??string.Empty}"); + } + return JsonSerializer.Deserialize(reader.Result, JsonCodeGen.Default.OpenAIChatResponse); } catch From 142987f73d19c2878b15807889af3427df6dbb48 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 09:31:38 +0800 Subject: [PATCH 21/59] enhance: use `user` instead of `system` to supports OpenAI's o1-preview and o1-mini model (#725) Signed-off-by: leo --- src/Models/OpenAI.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/OpenAI.cs b/src/Models/OpenAI.cs index 58f26792..516a9423 100644 --- a/src/Models/OpenAI.cs +++ b/src/Models/OpenAI.cs @@ -150,7 +150,7 @@ namespace SourceGit.Models public OpenAIChatResponse Chat(string prompt, string question, CancellationToken cancellation) { var chat = new OpenAIChatRequest() { Model = Model }; - chat.AddMessage("system", prompt); + chat.AddMessage("user", prompt); chat.AddMessage("user", question); var client = new HttpClient() { Timeout = TimeSpan.FromSeconds(60) }; From a980cc987d60c038e0ce92eee8fb972fb4737ac6 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 09:57:43 +0800 Subject: [PATCH 22/59] fix: wired ordering when cherry-pick multiple commits (#726) Since the items in `ListBox.SelectedItems` are not ordered by their position in the list, but in the order user selected, it need be sorted before `cherry-pick` Signed-off-by: leo --- src/ViewModels/Histories.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 55b04713..2f597849 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -243,6 +243,12 @@ namespace SourceGit.ViewModels if (canCherryPick) { + // Sort selected commits in order. + selected.Sort((l, r) => + { + return _commits.IndexOf(r) - _commits.IndexOf(l); + }); + var cherryPickMultiple = new MenuItem(); cherryPickMultiple.Header = App.Text("CommitCM.CherryPickMultiple"); cherryPickMultiple.Icon = App.CreateMenuIcon("Icons.CherryPick"); From 22157a5c98bee2121ff20b87787ba1b1063bdf5e Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 10:04:44 +0800 Subject: [PATCH 23/59] fix: tooltip of parent SHA textblock is not closed properly (#727) Signed-off-by: leo --- src/Views/CommitBaseInfo.axaml.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Views/CommitBaseInfo.axaml.cs b/src/Views/CommitBaseInfo.axaml.cs index 6a4af344..64fb4189 100644 --- a/src/Views/CommitBaseInfo.axaml.cs +++ b/src/Views/CommitBaseInfo.axaml.cs @@ -136,10 +136,12 @@ namespace SourceGit.Views else { var c = await Task.Run(() => detail.GetParent(sha)); - if (c != null) + if (c != null && ctl.IsVisible && ctl.DataContext is string newSHA && newSHA == sha) { ToolTip.SetTip(ctl, c); - ToolTip.SetIsOpen(ctl, ctl.IsPointerOver); + + if (ctl.IsPointerOver) + ToolTip.SetIsOpen(ctl, true); } } } From 8342702103477917f78c92d37755873fc29c30fd Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 10:19:00 +0800 Subject: [PATCH 24/59] feature: add save as path menu item for commit change (#724) Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index e874b09b..05b60e2f 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -315,12 +315,40 @@ namespace SourceGit.ViewModels ev.Handled = true; }; + var patch = new MenuItem(); + patch.Header = App.Text("FileCM.SaveAsPatch"); + patch.Icon = App.CreateMenuIcon("Icons.Diff"); + patch.Click += async (_, e) => + { + var storageProvider = App.GetStorageProvider(); + if (storageProvider == null) + return; + + var options = new FilePickerSaveOptions(); + options.Title = App.Text("FileCM.SaveAsPatch"); + options.DefaultExtension = ".patch"; + options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }]; + + var baseRevision = _commit.Parents.Count == 0 ? "4b825dc642cb6eb9a060e54bf8d69288fbee4904" : _commit.Parents[0]; + var storageFile = await storageProvider.SaveFilePickerAsync(options); + if (storageFile != null) + { + var saveTo = storageFile.Path.LocalPath; + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessRevisionCompareChanges(_repo.FullPath, [change], baseRevision, _commit.SHA, saveTo)); + if (succ) + App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); + } + + e.Handled = true; + }; + var menu = new ContextMenu(); menu.Items.Add(diffWithMerger); menu.Items.Add(explore); menu.Items.Add(new MenuItem { Header = "-" }); menu.Items.Add(history); menu.Items.Add(blame); + menu.Items.Add(patch); menu.Items.Add(new MenuItem { Header = "-" }); var resetToThisRevision = new MenuItem(); From d3eca59036b118e22d0b8fabc7fffcaa235497ab Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 12:14:11 +0800 Subject: [PATCH 25/59] refactor: rewrite the way to make sure scan repositories panel shows at least 0.5s (#728) Signed-off-by: leo --- src/ViewModels/ScanRepositories.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/ScanRepositories.cs b/src/ViewModels/ScanRepositories.cs index 115edf2d..7b52c670 100644 --- a/src/ViewModels/ScanRepositories.cs +++ b/src/ViewModels/ScanRepositories.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Threading.Tasks; + using Avalonia.Threading; namespace SourceGit.ViewModels @@ -28,8 +30,8 @@ namespace SourceGit.ViewModels return Task.Run(() => { - // If it is too fast, the panel will disappear very quickly, then we'll have a bad experience. - Task.Delay(500).Wait(); + var watch = new Stopwatch(); + watch.Start(); var rootDir = new DirectoryInfo(RootDir); var founded = new List(); @@ -62,6 +64,12 @@ namespace SourceGit.ViewModels Welcome.Instance.Refresh(); }); + // Make sure this task takes at least 0.5s to avoid that the popup panel do not disappear very quickly. + var remain = 500 - (int)watch.Elapsed.TotalMilliseconds; + watch.Stop(); + if (remain > 0) + Task.Delay(remain).Wait(); + return true; }); } From 069dc255d1d9892cb1a3cef35bab5af18091f09f Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 12:56:12 +0800 Subject: [PATCH 26/59] enhance: skip scanning sub folders if current is not a git repository but has `.git` subfolder/file (#728) Signed-off-by: leo --- src/ViewModels/ScanRepositories.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ViewModels/ScanRepositories.cs b/src/ViewModels/ScanRepositories.cs index 7b52c670..923413a3 100644 --- a/src/ViewModels/ScanRepositories.cs +++ b/src/ViewModels/ScanRepositories.cs @@ -103,11 +103,11 @@ namespace SourceGit.ViewModels if (test.IsSuccess && !string.IsNullOrEmpty(test.StdOut)) { var normalized = test.StdOut.Trim().Replace("\\", "/"); - if (!_managed.Contains(normalizedSelf)) + if (!_managed.Contains(normalized)) outs.Add(normalized); - - continue; } + + continue; } if (depth < 8) From b407dd97a176d7d8eaa9acfc5dc4f04b8b7d8bf3 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 14:18:41 +0800 Subject: [PATCH 27/59] enhance: reduce repository scanning time (#728) * skip special folders, such as `node_modules`, `.svn`, `.vs` .etc. * change max scanning depth to 5 Signed-off-by: leo --- src/ViewModels/ScanRepositories.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/ScanRepositories.cs b/src/ViewModels/ScanRepositories.cs index 923413a3..be8af5ab 100644 --- a/src/ViewModels/ScanRepositories.cs +++ b/src/ViewModels/ScanRepositories.cs @@ -90,6 +90,13 @@ namespace SourceGit.ViewModels var subdirs = dir.GetDirectories("*", opts); foreach (var subdir in subdirs) { + if (subdir.Name.Equals("node_modules", StringComparison.Ordinal) || + subdir.Name.Equals(".svn", StringComparison.Ordinal) || + subdir.Name.Equals(".vs", StringComparison.Ordinal) || + subdir.Name.Equals(".vscode", StringComparison.Ordinal) || + subdir.Name.Equals(".idea", StringComparison.Ordinal)) + continue; + SetProgressDescription($"Scanning {subdir.FullName}..."); var normalizedSelf = subdir.FullName.Replace("\\", "/"); @@ -110,7 +117,7 @@ namespace SourceGit.ViewModels continue; } - if (depth < 8) + if (depth < 5) GetUnmanagedRepositories(subdir, outs, opts, depth + 1); } } From d98765364d2c81bab1891c01504ff7381c43a573 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 14:49:32 +0800 Subject: [PATCH 28/59] feature: supports using local repository as remote (#706) Signed-off-by: leo --- src/Models/Remote.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Models/Remote.cs b/src/Models/Remote.cs index dcf30ddc..98749c51 100644 --- a/src/Models/Remote.cs +++ b/src/Models/Remote.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Text.RegularExpressions; namespace SourceGit.Models @@ -49,7 +50,7 @@ namespace SourceGit.Models return true; } - return false; + return Directory.Exists(url); } public bool TryGetVisitURL(out string url) From f0d82854165519133b4d35298e00bfe2f8e97d8e Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 14:53:43 +0800 Subject: [PATCH 29/59] enhance: only supports using local bare repository as remote (#706) Signed-off-by: leo --- src/Models/Remote.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/Remote.cs b/src/Models/Remote.cs index 98749c51..a65fa345 100644 --- a/src/Models/Remote.cs +++ b/src/Models/Remote.cs @@ -50,7 +50,7 @@ namespace SourceGit.Models return true; } - return Directory.Exists(url); + return url.EndsWith(".git", StringComparison.Ordinal) && Directory.Exists(url); } public bool TryGetVisitURL(out string url) From e6e1e4e82ebd6fd883612a71c2000bbe39db181d Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 19:23:59 +0800 Subject: [PATCH 30/59] fix: can not type characters with accent (#716) Leaves the `X11PlatformOptions.EnableIme` unsetted, since Avalonia will auto enable it when `LANG` contains `zh`/`ja`/`vi`/`ko` Signed-off-by: leo --- src/Native/Linux.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index 55b7b43b..76711bf2 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -13,10 +13,7 @@ namespace SourceGit.Native { public void SetupApp(AppBuilder builder) { - builder.With(new X11PlatformOptions() - { - EnableIme = true, - }); + builder.With(new X11PlatformOptions()); } public string FindGitExecutable() From 8bd5bd864e7b90cf8f2539b55fb72838bd446e69 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 20:50:51 +0800 Subject: [PATCH 31/59] feature: add context menu to switch histories filter mode to selected commit Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/ViewModels/Histories.cs | 111 ++++++++++++++++++++++++++++++ src/ViewModels/Repository.cs | 7 ++ 5 files changed, 121 insertions(+) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 462cdf90..705d7c6f 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -542,6 +542,7 @@ Enable '--reflog' Option Open in File Browser Search Branches/Tags/Submodules + Visibility in Graph Unset Hide in commit graph Filter in commit graph diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 0c0ccf14..21837119 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -546,6 +546,7 @@ 启用 --reflog 选项 在文件浏览器中打开 快速查找分支/标签/子模块 + 设置在列表中的可见性 不指定 在提交列表中隐藏 使用其对提交列表过滤 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 31015ae7..59b0afe0 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -545,6 +545,7 @@ 啟用 [--reflog] 選項 在檔案瀏覽器中開啟 快速搜尋分支/標籤/子模組 + 設定在列表中的可視性 不指定 在提交清單中隱藏 使用其來篩選提交清單 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 2f597849..92524f62 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -703,12 +703,117 @@ namespace SourceGit.ViewModels return menu; } + private Models.FilterMode GetFilterMode(string pattern) + { + foreach (var filter in _repo.Settings.HistoriesFilters) + { + if (filter.Pattern.Equals(pattern, StringComparison.Ordinal)) + return filter.Mode; + } + + return Models.FilterMode.None; + } + + private void FillBranchVisibilityMenu(MenuItem submenu, Models.Branch branch) + { + var visibility = new MenuItem(); + visibility.Icon = App.CreateMenuIcon("Icons.Eye"); + visibility.Header = App.Text("Repository.FilterCommits"); + + var exclude = new MenuItem(); + exclude.Icon = App.CreateMenuIcon("Icons.EyeClose"); + exclude.Header = App.Text("Repository.FilterCommits.Exclude"); + exclude.Click += (_, e) => + { + _repo.SetBranchFilterMode(branch, Models.FilterMode.Excluded); + e.Handled = true; + }; + + var filterMode = GetFilterMode(branch.FullName); + if (filterMode == Models.FilterMode.None) + { + var include = new MenuItem(); + include.Icon = App.CreateMenuIcon("Icons.Filter"); + include.Header = App.Text("Repository.FilterCommits.Include"); + include.Click += (_, e) => + { + _repo.SetBranchFilterMode(branch, Models.FilterMode.Included); + e.Handled = true; + }; + visibility.Items.Add(include); + visibility.Items.Add(exclude); + } + else + { + var unset = new MenuItem(); + unset.Header = App.Text("Repository.FilterCommits.Default"); + unset.Click += (_, e) => + { + _repo.SetBranchFilterMode(branch, Models.FilterMode.None); + e.Handled = true; + }; + visibility.Items.Add(exclude); + visibility.Items.Add(unset); + } + + submenu.Items.Add(visibility); + submenu.Items.Add(new MenuItem() { Header = "-" }); + } + + private void FillTagVisibilityMenu(MenuItem submenu, Models.Tag tag) + { + var visibility = new MenuItem(); + visibility.Icon = App.CreateMenuIcon("Icons.Eye"); + visibility.Header = App.Text("Repository.FilterCommits"); + + var exclude = new MenuItem(); + exclude.Icon = App.CreateMenuIcon("Icons.EyeClose"); + exclude.Header = App.Text("Repository.FilterCommits.Exclude"); + exclude.Click += (_, e) => + { + _repo.SetTagFilterMode(tag, Models.FilterMode.Excluded); + e.Handled = true; + }; + + var filterMode = GetFilterMode(tag.Name); + if (filterMode == Models.FilterMode.None) + { + var include = new MenuItem(); + include.Icon = App.CreateMenuIcon("Icons.Filter"); + include.Header = App.Text("Repository.FilterCommits.Include"); + include.Click += (_, e) => + { + _repo.SetTagFilterMode(tag, Models.FilterMode.Included); + e.Handled = true; + }; + visibility.Items.Add(include); + visibility.Items.Add(exclude); + } + else + { + var unset = new MenuItem(); + unset.Header = App.Text("Repository.FilterCommits.Default"); + unset.Click += (_, e) => + { + _repo.SetTagFilterMode(tag, Models.FilterMode.None); + e.Handled = true; + }; + visibility.Items.Add(exclude); + visibility.Items.Add(unset); + } + + submenu.Items.Add(visibility); + submenu.Items.Add(new MenuItem() { Header = "-" }); + } + private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current) { var submenu = new MenuItem(); submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = current.Name; + FillBranchVisibilityMenu(submenu, current); + if (!string.IsNullOrEmpty(current.Upstream)) { var upstream = current.Upstream.Substring(13); @@ -786,6 +891,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = branch.Name; + FillBranchVisibilityMenu(submenu, branch); + var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -858,6 +965,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = name; + FillBranchVisibilityMenu(submenu, branch); + var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -903,6 +1012,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Tag"); submenu.MinWidth = 200; + FillTagVisibilityMenu(submenu, tag); + var push = new MenuItem(); push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name); push.Icon = App.CreateMenuIcon("Icons.Push"); diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index ab7924d5..3182ab6f 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -707,6 +707,13 @@ namespace SourceGit.ViewModels RefreshHistoriesFilters(); } + public void SetBranchFilterMode(Models.Branch branch, Models.FilterMode mode) + { + var node = FindBranchNode(branch.IsLocal ? _localBranchTrees : _remoteBranchTrees, branch.FullName); + if (node != null) + SetBranchFilterMode(node, mode); + } + public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode) { var isLocal = node.Path.StartsWith("refs/heads/", StringComparison.Ordinal); From f545ceeb709acc55215525c3c87afeaee66053a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 21 Nov 2024 12:51:19 +0000 Subject: [PATCH 32/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 74cc6e3e..e2a613f3 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.29%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.43%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.86%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.71%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.29%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.14%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.29%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.72%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.57%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.14%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index d5061a30..6997f12a 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 99.29% +### de_DE.axaml: 99.14%
@@ -6,13 +6,14 @@ - Text.CommitDetail.Info.Children - Text.Preference.General.ShowChildren +- Text.Repository.FilterCommits - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo
-### es_ES.axaml: 98.43% +### es_ES.axaml: 98.29%
@@ -23,6 +24,7 @@ - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor - Text.Preference.General.ShowChildren +- Text.Repository.FilterCommits - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include @@ -32,7 +34,7 @@
-### fr_FR.axaml: 97.86% +### fr_FR.axaml: 97.72%
@@ -46,6 +48,7 @@ - Text.Preference.Appearance.FontSize.Editor - Text.Preference.General.ShowChildren - Text.Repository.CustomActions +- Text.Repository.FilterCommits - Text.Repository.FilterCommits.Default - Text.Repository.FilterCommits.Exclude - Text.Repository.FilterCommits.Include @@ -56,7 +59,7 @@
-### pt_BR.axaml: 99.71% +### pt_BR.axaml: 99.57%
@@ -64,10 +67,11 @@ - Text.CommitDetail.Info.Children - Text.Preference.General.ShowChildren +- Text.Repository.FilterCommits
-### ru_RU.axaml: 99.29% +### ru_RU.axaml: 99.14%
@@ -75,6 +79,7 @@ - Text.CommitDetail.Info.Children - Text.Preference.General.ShowChildren +- Text.Repository.FilterCommits - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo From 8a95a17b0eeaa2fdf76bd8344be42dc0168f215b Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 20:55:59 +0800 Subject: [PATCH 33/59] ux: re-order menu items Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 2 +- src/ViewModels/Histories.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 705d7c6f..6ff69ba9 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -542,7 +542,7 @@ Enable '--reflog' Option Open in File Browser Search Branches/Tags/Submodules - Visibility in Graph + Set visibility Unset Hide in commit graph Filter in commit graph diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 92524f62..2bbe83bb 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -812,8 +812,6 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = current.Name; - FillBranchVisibilityMenu(submenu, current); - if (!string.IsNullOrEmpty(current.Upstream)) { var upstream = current.Upstream.Substring(13); @@ -871,6 +869,8 @@ namespace SourceGit.ViewModels submenu.Items.Add(new MenuItem() { Header = "-" }); } + FillBranchVisibilityMenu(submenu, current); + var rename = new MenuItem(); rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name); rename.Icon = App.CreateMenuIcon("Icons.Rename"); @@ -891,8 +891,6 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = branch.Name; - FillBranchVisibilityMenu(submenu, branch); - var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -932,6 +930,8 @@ namespace SourceGit.ViewModels submenu.Items.Add(new MenuItem() { Header = "-" }); } + FillBranchVisibilityMenu(submenu, branch); + var rename = new MenuItem(); rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name); rename.Icon = App.CreateMenuIcon("Icons.Rename"); @@ -965,8 +965,6 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = name; - FillBranchVisibilityMenu(submenu, branch); - var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -991,6 +989,8 @@ namespace SourceGit.ViewModels submenu.Items.Add(merge); submenu.Items.Add(new MenuItem() { Header = "-" }); + FillBranchVisibilityMenu(submenu, branch); + var delete = new MenuItem(); delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name); delete.Icon = App.CreateMenuIcon("Icons.Clear"); @@ -1012,8 +1012,6 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Tag"); submenu.MinWidth = 200; - FillTagVisibilityMenu(submenu, tag); - var push = new MenuItem(); push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name); push.Icon = App.CreateMenuIcon("Icons.Push"); @@ -1039,6 +1037,8 @@ namespace SourceGit.ViewModels submenu.Items.Add(merge); submenu.Items.Add(new MenuItem() { Header = "-" }); + FillTagVisibilityMenu(submenu, tag); + var delete = new MenuItem(); delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name); delete.Icon = App.CreateMenuIcon("Icons.Clear"); From 13504d18318e2a3bf721b276c157bb6c50af868d Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 21:01:06 +0800 Subject: [PATCH 34/59] ux: make sure Icons.Eye center aligned Signed-off-by: leo --- src/Resources/Icons.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 413d2df9..8d66a250 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -32,7 +32,7 @@ M469 235V107h85v128h-85zm-162-94 85 85-60 60-85-85 60-60zm469 60-85 85-60-60 85-85 60 60zm-549 183A85 85 0 01302 341H722a85 85 0 0174 42l131 225A85 85 0 01939 652V832a85 85 0 01-85 85H171a85 85 0 01-85-85v-180a85 85 0 0112-43l131-225zM722 427H302l-100 171h255l10 29a59 59 0 002 5c2 4 5 9 9 14 8 9 18 17 34 17 16 0 26-7 34-17a72 72 0 0011-18l0-0 10-29h255l-100-171zM853 683H624a155 155 0 01-12 17C593 722 560 747 512 747c-48 0-81-25-99-47a155 155 0 01-12-17H171v149h683v-149z M576 832C576 867 547 896 512 896 477 896 448 867 448 832 448 797 477 768 512 768 547 768 576 797 576 832ZM512 256C477 256 448 285 448 320L448 640C448 675 477 704 512 704 547 704 576 675 576 640L576 320C576 285 547 256 512 256ZM1024 896C1024 967 967 1024 896 1024L128 1024C57 1024 0 967 0 896 0 875 5 855 14 837L14 837 398 69 398 69C420 28 462 0 512 0 562 0 604 28 626 69L1008 835C1018 853 1024 874 1024 896ZM960 896C960 885 957 875 952 865L952 864 951 863 569 98C557 77 536 64 512 64 488 64 466 77 455 99L452 105 92 825 93 825 71 867C66 876 64 886 64 896 64 931 93 960 128 960L896 960C931 960 960 931 960 896Z M928 128l-416 0-32-64-352 0-64 128 896 0zM904 704l75 0 45-448-1024 0 64 640 484 0c-105-38-180-138-180-256 0-150 122-272 272-272s272 122 272 272c0 22-3 43-8 64zM1003 914l-198-175c17-29 27-63 27-99 0-106-86-192-192-192s-192 86-192 192 86 192 192 192c36 0 70-10 99-27l175 198c23 27 62 28 87 3l6-6c25-25 23-64-3-87zM640 764c-68 0-124-56-124-124s56-124 124-124 124 56 124 124-56 124-124 124z - M520 168C291 168 95 311 16 512c79 201 275 344 504 344 229 0 425-143 504-344-79-201-275-344-504-344zm0 573c-126 0-229-103-229-229s103-229 229-229c126 0 229 103 229 229s-103 229-229 229zm0-367c-76 0-137 62-137 137s62 137 137 137S657 588 657 512s-62-137-137-137z + M0 512M1024 512M512 0M512 1024M520 168C291 168 95 311 16 512c79 201 275 344 504 344 229 0 425-143 504-344-79-201-275-344-504-344zm0 573c-126 0-229-103-229-229s103-229 229-229c126 0 229 103 229 229s-103 229-229 229zm0-367c-76 0-137 62-137 137s62 137 137 137S657 588 657 512s-62-137-137-137z M734 128c-33-19-74-8-93 25l-41 70c-28-6-58-9-90-9-294 0-445 298-445 298s82 149 231 236l-31 54c-19 33-8 74 25 93 33 19 74 8 93-25L759 222C778 189 767 147 734 128zM305 512c0-115 93-208 207-208 14 0 27 1 40 4l-37 64c-1 0-2 0-2 0-77 0-140 63-140 140 0 26 7 51 20 71l-37 64C324 611 305 564 305 512zM771 301 700 423c13 27 20 57 20 89 0 110-84 200-192 208l-51 89c12 1 24 2 36 2 292 0 446-298 446-298S895 388 771 301z M826 498 538 250c-11-9-26-1-26 14v496c0 15 16 23 26 14L826 526c8-7 8-21 0-28zm-320 0L218 250c-11-9-26-1-26 14v496c0 15 16 23 26 14L506 526c4-4 6-9 6-14 0-5-2-10-6-14z M1024 896v128H0V704h128v192h768V704h128v192zM576 555 811 320 896 405l-384 384-384-384L213 320 448 555V0h128v555z From 1e148c032d2cccbe1d3ed91c8af259fd8dd01055 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Nov 2024 21:10:15 +0800 Subject: [PATCH 35/59] localization: update English translations Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 6ff69ba9..799288ef 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -115,7 +115,7 @@ Revert Commit Reword Save as Patch... - Squash Into Parent + Squash into Parent Squash Child Commits to Here CHANGES Search Changes... @@ -542,7 +542,7 @@ Enable '--reflog' Option Open in File Browser Search Branches/Tags/Submodules - Set visibility + Visibility in Graph Unset Hide in commit graph Filter in commit graph From c1c743f2ff92fb6a9362806baddc4bb47534ffc8 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 22 Nov 2024 09:17:56 +0800 Subject: [PATCH 36/59] readme: add tips for Linux users Signed-off-by: leo --- README.md | 1 + src/Native/Linux.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e2a613f3..cd5d869d 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ For **Linux** users: * `xdg-open` must be installed to support open native file manager. * Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your linux. * Maybe you need to set environment variable `AVALONIA_SCREEN_SCALE_FACTORS`. See https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI. +* If you can NOT type accented characters, such as `ê`, `ó`, try to set the environment variable `AVALONIA_IM_MODULE` to `none`. ## OpenAI diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index 76711bf2..a24f1b65 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -13,7 +13,7 @@ namespace SourceGit.Native { public void SetupApp(AppBuilder builder) { - builder.With(new X11PlatformOptions()); + builder.With(new X11PlatformOptions() { EnableIme = true }); } public string FindGitExecutable() From 153a1f30b28bbc37ebf3e8851fa69cd042b9f3cf Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 22 Nov 2024 09:39:50 +0800 Subject: [PATCH 37/59] feature: supports toggle `--force` option for `git fetch` command (#721) * Background auto fetch will always disable this option * This option is not add to pull operation Signed-off-by: leo --- src/Commands/Fetch.cs | 5 ++++- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/ViewModels/AddRemote.cs | 2 +- src/ViewModels/Fetch.cs | 12 ++++++++++-- src/ViewModels/Pull.cs | 1 + src/ViewModels/Repository.cs | 2 +- src/Views/Fetch.axaml | 8 ++++++-- 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index 834cd7fc..1c3e78cb 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -4,7 +4,7 @@ namespace SourceGit.Commands { public class Fetch : Command { - public Fetch(string repo, string remote, bool noTags, bool prune, Action outputHandler) + public Fetch(string repo, string remote, bool noTags, bool prune, bool force, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; @@ -18,6 +18,9 @@ namespace SourceGit.Commands else Args += "--tags "; + if (force) + Args += "--force "; + if (prune) Args += "--prune "; diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 799288ef..0a0af997 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -268,6 +268,7 @@ Fast-Forward (without checkout) Fetch Fetch all remotes + Enable '--force' option Fetch without tags Remote: Fetch Remote Changes diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 21837119..1b549c83 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -271,6 +271,7 @@ 快进(fast-forward,无需checkout) 拉取(fetch) 拉取所有的远程仓库 + 启用 --force 选项 不拉取远程标签 远程仓库 : 拉取远程仓库内容 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 59b0afe0..f4ec03ad 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -271,6 +271,7 @@ 快進 (fast-forward,無需 checkout) 提取 (fetch) 提取所有的遠端存放庫 + 啟用 [--force] 選項 不提取遠端標籤 遠端存放庫: 提取遠端存放庫內容 diff --git a/src/ViewModels/AddRemote.cs b/src/ViewModels/AddRemote.cs index d6424572..2ca7449f 100644 --- a/src/ViewModels/AddRemote.cs +++ b/src/ViewModels/AddRemote.cs @@ -100,7 +100,7 @@ namespace SourceGit.ViewModels { SetProgressDescription("Fetching from added remote ..."); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); - new Commands.Fetch(_repo.FullPath, _name, false, false, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, _name, false, false, false, SetProgressDescription).Exec(); } CallUIThread(() => { diff --git a/src/ViewModels/Fetch.cs b/src/ViewModels/Fetch.cs index 7f54680d..a93304f7 100644 --- a/src/ViewModels/Fetch.cs +++ b/src/ViewModels/Fetch.cs @@ -28,10 +28,17 @@ namespace SourceGit.ViewModels set => _repo.Settings.FetchWithoutTags = value; } + public bool Force + { + get; + set; + } + public Fetch(Repository repo, Models.Remote preferedRemote = null) { _repo = repo; _fetchAllRemotes = preferedRemote == null; + Force = false; SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0]; View = new Views.Fetch() { DataContext = this }; } @@ -42,6 +49,7 @@ namespace SourceGit.ViewModels var notags = _repo.Settings.FetchWithoutTags; var prune = _repo.Settings.EnablePruneOnFetch; + var force = Force; return Task.Run(() => { if (FetchAllRemotes) @@ -49,13 +57,13 @@ namespace SourceGit.ViewModels foreach (var remote in _repo.Remotes) { SetProgressDescription($"Fetching remote: {remote.Name}"); - new Commands.Fetch(_repo.FullPath, remote.Name, notags, prune, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, remote.Name, notags, prune, force, SetProgressDescription).Exec(); } } else { SetProgressDescription($"Fetching remote: {SelectedRemote.Name}"); - new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, prune, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, notags, prune, force, SetProgressDescription).Exec(); } CallUIThread(() => diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 6c493449..e7c62980 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -152,6 +152,7 @@ namespace SourceGit.ViewModels _selectedRemote.Name, NoTags, _repo.Settings.EnablePruneOnFetch, + false, SetProgressDescription).Exec(); if (!rs) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 3182ab6f..a5d48648 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -2194,7 +2194,7 @@ namespace SourceGit.ViewModels IsAutoFetching = true; Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching))); - new Commands.Fetch(_fullpath, "--all", false, _settings.EnablePruneOnFetch, null) { RaiseError = false }.Exec(); + new Commands.Fetch(_fullpath, "--all", false, _settings.EnablePruneOnFetch, false, null) { RaiseError = false }.Exec(); _lastFetchTime = DateTime.Now; IsAutoFetching = false; Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching))); diff --git a/src/Views/Fetch.axaml b/src/Views/Fetch.axaml index a9c2fd90..f9380ab0 100644 --- a/src/Views/Fetch.axaml +++ b/src/Views/Fetch.axaml @@ -11,7 +11,7 @@ - + + + - From 378e8d3ea33051ec86eeb301fccc6e4e5c236e52 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 22 Nov 2024 01:40:15 +0000 Subject: [PATCH 38/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cd5d869d..ffc15541 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.14%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.29%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.72%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.57%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.14%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.00%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.15%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.43%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.00%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 6997f12a..274f0341 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,10 +1,11 @@ -### de_DE.axaml: 99.14% +### de_DE.axaml: 99.00%
Missing Keys - Text.CommitDetail.Info.Children +- Text.Fetch.Force - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.Repository.HistoriesOrder @@ -13,13 +14,14 @@
-### es_ES.axaml: 98.29% +### es_ES.axaml: 98.15%
Missing Keys - Text.CommitDetail.Info.Children +- Text.Fetch.Force - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor @@ -34,7 +36,7 @@
-### fr_FR.axaml: 97.72% +### fr_FR.axaml: 97.58%
@@ -43,6 +45,7 @@ - Text.CherryPick.AppendSourceToMessage - Text.CherryPick.Mainline.Tips - Text.CommitCM.CherryPickMultiple +- Text.Fetch.Force - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor @@ -59,25 +62,27 @@
-### pt_BR.axaml: 99.57% +### pt_BR.axaml: 99.43%
Missing Keys - Text.CommitDetail.Info.Children +- Text.Fetch.Force - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits
-### ru_RU.axaml: 99.14% +### ru_RU.axaml: 99.00%
Missing Keys - Text.CommitDetail.Info.Children +- Text.Fetch.Force - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.Repository.HistoriesOrder From c50508d4ac117a62c3596219ed88cfd857ed5096 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 22 Nov 2024 10:42:39 +0800 Subject: [PATCH 39/59] fix: try to fix the issue that the branch tree did not update after deleting multiple branches (#729) Signed-off-by: leo --- src/ViewModels/DeleteMultipleBranches.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/DeleteMultipleBranches.cs b/src/ViewModels/DeleteMultipleBranches.cs index 6048ec68..87bb3122 100644 --- a/src/ViewModels/DeleteMultipleBranches.cs +++ b/src/ViewModels/DeleteMultipleBranches.cs @@ -42,7 +42,12 @@ namespace SourceGit.ViewModels } } - CallUIThread(() => _repo.SetWatcherEnabled(true)); + CallUIThread(() => + { + _repo.MarkBranchesDirtyManually(); + _repo.SetWatcherEnabled(true); + }); + return true; }); } From c78e2e59d91d5b4322b0b9c03dc698735cb5e775 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 22 Nov 2024 18:40:59 +0800 Subject: [PATCH 40/59] enhance: `git format-patch` * use `--output=` instead of `-o ` to avoid failure because the directory cannot be created * make generated patches in order when format multiple commits Signed-off-by: leo --- src/Commands/FormatPatch.cs | 2 +- src/ViewModels/Histories.cs | 50 +++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/Commands/FormatPatch.cs b/src/Commands/FormatPatch.cs index 2c7359c0..b3ec2e4a 100644 --- a/src/Commands/FormatPatch.cs +++ b/src/Commands/FormatPatch.cs @@ -6,7 +6,7 @@ { WorkingDirectory = repo; Context = repo; - Args = $"format-patch {commit} -1 -o \"{saveTo}\""; + Args = $"format-patch {commit} -1 --output=\"{saveTo}\""; } } } diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 2bbe83bb..f77fc87b 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -239,16 +239,16 @@ namespace SourceGit.ViewModels } } + // Sort selected commits in order. + selected.Sort((l, r) => + { + return _commits.IndexOf(r) - _commits.IndexOf(l); + }); + var multipleMenu = new ContextMenu(); if (canCherryPick) { - // Sort selected commits in order. - selected.Sort((l, r) => - { - return _commits.IndexOf(r) - _commits.IndexOf(l); - }); - var cherryPickMultiple = new MenuItem(); cherryPickMultiple.Header = App.Text("CommitCM.CherryPickMultiple"); cherryPickMultiple.Icon = App.CreateMenuIcon("Icons.CherryPick"); @@ -277,11 +277,11 @@ namespace SourceGit.ViewModels var picker = await storageProvider.OpenFolderPickerAsync(options); if (picker.Count == 1) { - var saveTo = $"{picker[0].Path.LocalPath}/patches"; var succ = false; - foreach (var c in selected) + for (var i = 0; i < selected.Count; i++) { - succ = await Task.Run(() => new Commands.FormatPatch(_repo.FullPath, c.SHA, saveTo).Exec()); + var saveTo = GetPatchFileName(picker[0].Path.LocalPath, selected[i], i); + succ = await Task.Run(() => new Commands.FormatPatch(_repo.FullPath, selected[i].SHA, saveTo).Exec()); if (!succ) break; } @@ -621,7 +621,8 @@ namespace SourceGit.ViewModels var selected = await storageProvider.OpenFolderPickerAsync(options); if (selected.Count == 1) { - var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, selected[0].Path.LocalPath).Exec(); + var saveTo = GetPatchFileName(selected[0].Path.LocalPath, commit); + var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, saveTo).Exec(); if (succ) App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); } @@ -1053,6 +1054,35 @@ namespace SourceGit.ViewModels menu.Items.Add(submenu); } + private string GetPatchFileName(string dir, Models.Commit commit, int index = 0) + { + var ignore_chars = new HashSet { '/', '\\', ':', ',', '*', '?', '\"', '<', '>', '|', '`', '$', '^', '%', '[', ']', '+', '-' }; + var builder = new StringBuilder(); + builder.Append(index.ToString("D4")); + builder.Append('-'); + + var chars = commit.Subject.ToCharArray(); + var len = 0; + foreach (var c in chars) + { + if (!ignore_chars.Contains(c)) + { + if (c == ' ' || c == '\t') + builder.Append('-'); + else + builder.Append(c); + + len++; + + if (len >= 48) + break; + } + } + builder.Append(".patch"); + + return System.IO.Path.Combine(dir, builder.ToString()); + } + private Repository _repo = null; private bool _isLoading = true; private List _commits = new List(); From 3ae3c587d8bc387a6fb5e755d8c61efdefc71131 Mon Sep 17 00:00:00 2001 From: Martin Garstenauer Date: Fri, 22 Nov 2024 11:43:45 +0100 Subject: [PATCH 41/59] fix: typo in English (#731) --- src/Resources/Locales/en_US.axaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 0a0af997..23c43692 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -168,8 +168,8 @@ Result URL: Please use $1, $2 to access regex groups values. AI - Prefered Service: - If the 'Prefered Service' is set, SourceGit will only use it in this repository. Otherwise, if there is more than one service available, a context menu to choose one of them will be shown. + Preferred Service: + If the 'Preferred Service' is set, SourceGit will only use it in this repository. Otherwise, if there is more than one service available, a context menu to choose one of them will be shown. HTTP Proxy HTTP proxy used by this repository User Name @@ -452,7 +452,7 @@ Check for updates on startup Language History Commits - Show author time intead of commit time in graph + Show author time instead of commit time in graph Show children in the comment details Subject Guide Length GIT From cd96a2854520ed7e7807abe688427642f1e21fa2 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 22 Nov 2024 18:47:06 +0800 Subject: [PATCH 42/59] fix: typo in English (#731) Signed-off-by: leo --- src/Resources/Locales/de_DE.axaml | 4 ++-- src/Resources/Locales/en_US.axaml | 4 ++-- src/Resources/Locales/es_ES.axaml | 4 ++-- src/Resources/Locales/fr_FR.axaml | 4 ++-- src/Resources/Locales/pt_BR.axaml | 4 ++-- src/Resources/Locales/ru_RU.axaml | 4 ++-- src/Resources/Locales/zh_CN.axaml | 4 ++-- src/Resources/Locales/zh_TW.axaml | 4 ++-- src/Views/RepositoryConfigure.axaml | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 200d3638..3b722aa8 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -170,8 +170,8 @@ Ergebnis-URL: Verwende bitte $1, $2 um auf Regex-Gruppenwerte zuzugreifen. OPEN AI - Bevorzugter Service: - Der ausgewählte 'Bevorzugte Service' wird nur in diesem Repository gesetzt und verwendet. Wenn keiner gesetzt ist und mehrere Servies verfügbar sind wird ein Kontextmenü zur Auswahl angezeigt. + Bevorzugter Service: + Der ausgewählte 'Bevorzugte Service' wird nur in diesem Repository gesetzt und verwendet. Wenn keiner gesetzt ist und mehrere Servies verfügbar sind wird ein Kontextmenü zur Auswahl angezeigt. HTTP Proxy HTTP Proxy für dieses Repository Benutzername diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 23c43692..444007c2 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -168,8 +168,8 @@ Result URL: Please use $1, $2 to access regex groups values. AI - Preferred Service: - If the 'Preferred Service' is set, SourceGit will only use it in this repository. Otherwise, if there is more than one service available, a context menu to choose one of them will be shown. + Preferred Service: + If the 'Preferred Service' is set, SourceGit will only use it in this repository. Otherwise, if there is more than one service available, a context menu to choose one of them will be shown. HTTP Proxy HTTP proxy used by this repository User Name diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index f69fc934..06f295d3 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -172,8 +172,8 @@ URL Resultante: Por favor, use $1, $2 para acceder a los valores de los grupos regex. OPEN AI - Servicio Preferido: - Si el 'Servicio Preferido' está establecido, SourceGit sólo lo usará en este repositorio. De lo contrario, si hay más de un servicio disponible, se mostrará un menú de contexto para elegir uno. + Servicio Preferido: + Si el 'Servicio Preferido' está establecido, SourceGit sólo lo usará en este repositorio. De lo contrario, si hay más de un servicio disponible, se mostrará un menú de contexto para elegir uno. Proxy HTTP Proxy HTTP utilizado por este repositorio Nombre de Usuario diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 5a1a8e7b..ef416e0b 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -169,8 +169,8 @@ URL résultant: Veuillez utiliser $1, $2 pour accéder aux valeurs des groupes regex. IA - Service préféré: - Si le 'Service préféré' est défini, SourceGit l'utilisera seulement dans ce repository. Sinon, si plus d'un service est disponible, un menu contextuel permettant de choisir l'un d'eux sera affiché. + Service préféré: + Si le 'Service préféré' est défini, SourceGit l'utilisera seulement dans ce repository. Sinon, si plus d'un service est disponible, un menu contextuel permettant de choisir l'un d'eux sera affiché. Proxy HTTP Proxy HTTP utilisé par ce dépôt Nom d'utilisateur diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 744fc0cc..428579bd 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -195,8 +195,8 @@ URL de Resultado: Por favor, use $1, $2 para acessar os valores de grupos do regex. IA - Serviço desejado: - Se o 'Serviço desejado' for definido, SourceGit usará ele neste Repositório. Senão, caso haja mais de um serviço disponível, será exibido um menu para seleção. + Serviço desejado: + Se o 'Serviço desejado' for definido, SourceGit usará ele neste Repositório. Senão, caso haja mais de um serviço disponível, será exibido um menu para seleção. Proxy HTTP Proxy HTTP usado por este repositório Nome de Usuário diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 3d03e850..123c921f 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -170,8 +170,8 @@ Адрес результата: Пожалуйста, используйте $1, $2 для доступа к значениям групп регулярных выражений. ОТКРЫТЬ ИИ - Предпочитаемый сервис: - Если «Предпочитаемый сервис» установлен, SourceGit будет использовать только этот хранилище. В противном случае, если доступно более одной услуги, будет отображено контекстное меню для выбора одной из них. + Предпочитаемый сервис: + Если «Предпочитаемый сервис» установлен, SourceGit будет использовать только этот хранилище. В противном случае, если доступно более одной услуги, будет отображено контекстное меню для выбора одной из них. HTTP-прокси HTTP-прокси, используемый этим хранилищем Имя пользователя diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 1b549c83..fe71caa7 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -171,8 +171,8 @@ 为ISSUE生成的URL链接 : 可在URL中使用$1,$2等变量填入正则表达式匹配的内容 AI - 启用特定服务 : - 当【启用特定服务】被设置时,SourceGit将在本仓库中仅使用该服务。否则将弹出可用的AI服务列表供用户选择。 + 启用特定服务 : + 当【启用特定服务】被设置时,SourceGit将在本仓库中仅使用该服务。否则将弹出可用的AI服务列表供用户选择。 HTTP代理 HTTP网络代理 用户名 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index f4ec03ad..f1ba12a6 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -171,8 +171,8 @@ 為 Issue 產生的網址連結: 可在網址中使用 $1、$2 等變數填入正規表達式相符的內容 AI - 偏好服務: - 設定 [偏好服務] 後,SourceGit 將於此存放庫中使用該服務,否則會顯示 AI 服務列表供使用者選擇。 + 偏好服務: + 設定 [偏好服務] 後,SourceGit 將於此存放庫中使用該服務,否則會顯示 AI 服務列表供使用者選擇。 HTTP 代理 HTTP 網路代理 使用者名稱 diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml index c596f9e7..10603319 100644 --- a/src/Views/RepositoryConfigure.axaml +++ b/src/Views/RepositoryConfigure.axaml @@ -458,7 +458,7 @@ + Text="{DynamicResource Text.Configure.OpenAI.Preferred}"/> From 546f6284705cd9c8551812476cc64612e257dd36 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 24 Nov 2024 01:32:47 +0000 Subject: [PATCH 43/59] fix: don't reverse commit order when cherry-picking (#736) Fixes #726. Looks like a980cc987d60c038e0ce92eee8fb972fb4737ac6 isn't sufficient. It sorts the commits according to the ordering in history, but then CherryPick ViewModel reverses the order. This commit changes CherryPick ViewModel to use string.Join on the commit list without reordering, so that the ordering is controlled entirely by the caller. --- src/ViewModels/CherryPick.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ViewModels/CherryPick.cs b/src/ViewModels/CherryPick.cs index dde43662..ea601d5a 100644 --- a/src/ViewModels/CherryPick.cs +++ b/src/ViewModels/CherryPick.cs @@ -85,13 +85,9 @@ namespace SourceGit.ViewModels } else { - var builder = new StringBuilder(); - for (int i = Targets.Count - 1; i >= 0; i--) - builder.Append($"{Targets[i].SHA} "); - succ = new Commands.CherryPick( _repo.FullPath, - builder.ToString(), + string.Join(' ', Targets.ConvertAll(c => c.SHA)), !AutoCommit, AppendSourceToMessage, string.Empty).Exec(); From e3d6ee0f40e693da7f77ef8a10d2b679ca776632 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 24 Nov 2024 02:15:17 +0000 Subject: [PATCH 44/59] fix: better https regex (#735) Fixes #733 --- src/Models/Remote.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/Remote.cs b/src/Models/Remote.cs index a65fa345..2b88c3be 100644 --- a/src/Models/Remote.cs +++ b/src/Models/Remote.cs @@ -6,7 +6,7 @@ namespace SourceGit.Models { public partial class Remote { - [GeneratedRegex(@"^http[s]?://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-/~%]+/[\w\-\.%]+(\.git)?$")] + [GeneratedRegex(@"^https?://([-a-zA-Z0-9:%._\+~#=]+@)?[-a-zA-Z0-9:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(:[0-9]{1,5})?\b(/[-a-zA-Z0-9()@:%_\+.~#?&=]*)*(\.git)?$")] private static partial Regex REG_HTTPS(); [GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-/~%]+/[\w\-\.%]+(\.git)?$")] private static partial Regex REG_SSH1(); From 693940368b256f0251a1cb2cb6f6b52a3b5fe4c0 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 24 Nov 2024 10:20:40 +0800 Subject: [PATCH 45/59] code_style: remove unused variable Signed-off-by: leo --- src/ViewModels/Repository.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index a5d48648..92bfb288 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -834,7 +834,6 @@ namespace SourceGit.ViewModels if (_enableFirstParentInHistories) builder.Append("--first-parent "); - var invalidFilters = new List(); var filters = _settings.BuildHistoriesFilter(); if (string.IsNullOrEmpty(filters)) builder.Append("--branches --remotes --tags"); @@ -2129,7 +2128,7 @@ namespace SourceGit.ViewModels if (node.Path.Equals(path, StringComparison.Ordinal)) return node; - if (path.StartsWith(node.Path, StringComparison.Ordinal)) + if (path!.StartsWith(node.Path, StringComparison.Ordinal)) { var founded = FindBranchNode(node.Children, path); if (founded != null) From 12f75315bd9174233d8c7010a30769ba3f86cc22 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 24 Nov 2024 02:53:16 +0000 Subject: [PATCH 46/59] feat: context menu for a commit in commit message (#734) * feat: context menu for a commit in commit message When a commit message happens to contain a commit link and the user elects to right-click it, instead of navigating them to the commit, present a menu with options to navigate to it or to copy SHA. * feat: show commit tooltip as well `_lastHover` in the `if` is also swapped for `match`for consistency with the block body --- src/Resources/Locales/de_DE.axaml | 1 + src/Resources/Locales/en_US.axaml | 2 ++ src/Resources/Locales/es_ES.axaml | 1 + src/Resources/Locales/fr_FR.axaml | 1 + src/Resources/Locales/pt_BR.axaml | 1 + src/Resources/Locales/ru_RU.axaml | 2 ++ src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/CommitMessagePresenter.cs | 43 +++++++++++++++++++++++++++-- 9 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 3b722aa8..6293e5f0 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -597,6 +597,7 @@ Diese Version überspringen Software Update Es sind momentan kein Updates verfügbar. + SHA kopieren Squash Commits In: SSH privater Schlüssel: diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 444007c2..8a0ee04e 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -601,6 +601,8 @@ Skip This Version Software Update There are currently no updates available. + Copy SHA + Go to Squash Commits Into: SSH Private Key: diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 06f295d3..563419be 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -592,6 +592,7 @@ Omitir Esta Versión Actualización de Software Actualmente no hay actualizaciones disponibles. + Copiar SHA Squash Commits En: Clave Privada SSH: diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index ef416e0b..a9a18be3 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -590,6 +590,7 @@ Passer cette version Mise à jour du logiciel Il n'y a pas de mise à jour pour le moment. + Copier le SHA Squash Commits Dans : SSH Private Key: diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 428579bd..4d011b32 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -625,6 +625,7 @@ Ignorar esta versão Atualização de Software Não há atualizações disponíveis no momento. + Copiar SHA Squash Commits Squash commits em: Chave SSH Privada: diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 123c921f..5b908a17 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -592,6 +592,8 @@ Исправление успешно сохранено! Сканирование хранилищ Корневой каталог: + Копировать SHA + Перейти Проверка для обновления... Доступна новая версия этого программного обеспечения: Не удалось проверить наличие обновлений! diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index fe71caa7..5493434c 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -605,6 +605,7 @@ 忽略此版本 软件更新 当前已是最新版本。 + 复制提交指纹 压缩为单个提交 合并入: SSH密钥 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index f1ba12a6..de431e16 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -604,6 +604,7 @@ 忽略此版本 軟體更新 目前已是最新版本。 + 複製提交編號 壓縮為單個提交 合併入: SSH 金鑰: diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 862ce9e1..c4da7e94 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -7,6 +7,7 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Documents; using Avalonia.Input; +using Avalonia.Platform.Storage; using Avalonia.VisualTree; namespace SourceGit.Views @@ -149,11 +150,16 @@ namespace SourceGit.Views SetCurrentValue(CursorProperty, Cursor.Parse("Hand")); _lastHover = match; - if (!_lastHover.IsCommitSHA) + if (!match.IsCommitSHA) { ToolTip.SetTip(this, match.Link); ToolTip.SetIsOpen(this, true); } + else if (this.FindAncestorOfType() is { DataContext: ViewModels.CommitDetail detail } && detail.GetParent(match.Link) is Models.Commit c) + { + ToolTip.SetTip(this, c); + ToolTip.SetIsOpen(this, true); + } return; } @@ -172,7 +178,40 @@ namespace SourceGit.Views { var parentView = this.FindAncestorOfType(); if (parentView is { DataContext: ViewModels.CommitDetail detail }) - detail.NavigateTo(_lastHover.Link); + { + var point = e.GetCurrentPoint(this); + var link = _lastHover.Link; + + if (point.Properties.IsLeftButtonPressed) + { + detail.NavigateTo(_lastHover.Link); + } + else if (point.Properties.IsRightButtonPressed) + { + var open = new MenuItem(); + open.Header = App.Text("SHALinkCM.NavigateTo"); + open.Icon = App.CreateMenuIcon("Icons.Commit"); + open.Click += (_, ev) => + { + detail.NavigateTo(_lastHover.Link); + ev.Handled = true; + }; + + var copy = new MenuItem(); + copy.Header = App.Text("SHALinkCM.CopySHA"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, ev) => + { + App.CopyText(link); + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(open); + menu.Items.Add(copy); + menu.Open(this); + } + } } else { From 53220f9a3658a16499dbde96388072642c3543c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 Nov 2024 02:53:30 +0000 Subject: [PATCH 47/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ffc15541..0d8e53e6 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.00%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.15%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.43%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.00%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 274f0341..5b9f456a 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 99.00% +### de_DE.axaml: 98.86%
@@ -11,10 +11,11 @@ - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo +- Text.SHALinkCM.NavigateTo
-### es_ES.axaml: 98.15% +### es_ES.axaml: 98.01%
@@ -33,10 +34,11 @@ - Text.Repository.HistoriesOrder - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo +- Text.SHALinkCM.NavigateTo
-### fr_FR.axaml: 97.58% +### fr_FR.axaml: 97.44%
@@ -59,10 +61,11 @@ - Text.Repository.HistoriesOrder.ByDate - Text.Repository.HistoriesOrder.Topo - Text.ScanRepositories +- Text.SHALinkCM.NavigateTo
-### pt_BR.axaml: 99.43% +### pt_BR.axaml: 99.29%
@@ -72,10 +75,11 @@ - Text.Fetch.Force - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits +- Text.SHALinkCM.NavigateTo
-### ru_RU.axaml: 99.00% +### ru_RU.axaml: 99.01%
@@ -91,22 +95,22 @@
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.86%
Missing Keys - +- Text.SHALinkCM.NavigateTo
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.86%
Missing Keys - +- Text.SHALinkCM.NavigateTo
From 457a1e79c7cf53263ad96e7d660bc4ed8e5eb289 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 24 Nov 2024 11:04:59 +0800 Subject: [PATCH 48/59] code_review: PR #734 * remove unnecessary namespace using * do NOT set tooltip currently, because CommitDetail.GetParent may cause UI lags and the tooltip DataTemplate is not provided. * add translations for zh_CN and zh_TW Signed-off-by: leo --- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/CommitMessagePresenter.cs | 8 +------- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 5493434c..a5af3400 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -606,6 +606,7 @@ 软件更新 当前已是最新版本。 复制提交指纹 + 跳转到提交 压缩为单个提交 合并入: SSH密钥 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index de431e16..3989259d 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -605,6 +605,7 @@ 軟體更新 目前已是最新版本。 複製提交編號 + 導覽到提交 壓縮為單個提交 合併入: SSH 金鑰: diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index c4da7e94..a022ae99 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -7,7 +7,6 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Documents; using Avalonia.Input; -using Avalonia.Platform.Storage; using Avalonia.VisualTree; namespace SourceGit.Views @@ -115,7 +114,7 @@ namespace SourceGit.Views { base.OnPointerMoved(e); - if (e.Pointer.Captured == this) + if (Equals(e.Pointer.Captured, this)) { var relativeSelfY = e.GetPosition(this).Y; if (relativeSelfY <= 0 || relativeSelfY > Bounds.Height) @@ -155,11 +154,6 @@ namespace SourceGit.Views ToolTip.SetTip(this, match.Link); ToolTip.SetIsOpen(this, true); } - else if (this.FindAncestorOfType() is { DataContext: ViewModels.CommitDetail detail } && detail.GetParent(match.Link) is Models.Commit c) - { - ToolTip.SetTip(this, c); - ToolTip.SetIsOpen(this, true); - } return; } From f820c0ccacf993cc9d7ee29c293fa1e830205d02 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 Nov 2024 03:06:15 +0000 Subject: [PATCH 49/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d8e53e6..587f722e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 5b9f456a..76eff2ff 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -95,22 +95,22 @@
-### zh_CN.axaml: 99.86% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.SHALinkCM.NavigateTo +
-### zh_TW.axaml: 99.86% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.SHALinkCM.NavigateTo +
From 637f138d6393968efba176d1a74b5d9725e1a98c Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 24 Nov 2024 20:28:12 +0800 Subject: [PATCH 50/59] code_style: remove Rider warning Signed-off-by: leo --- src/Views/CommitBaseInfo.axaml | 2 +- src/Views/CommitBaseInfo.axaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index b58c3daf..fdccbf99 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -199,7 +199,7 @@ - Date: Sun, 24 Nov 2024 21:22:04 +0800 Subject: [PATCH 51/59] feature: add tooltip for SHA in commit message presenter (#734) Signed-off-by: leo --- src/Models/OpenAI.cs | 2 +- src/Views/CommitBaseInfo.axaml | 14 ++++++++ src/Views/CommitMessagePresenter.cs | 55 +++++++++++++++++++++++++++++ src/Views/TextDiffView.axaml.cs | 20 +++++------ 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/src/Models/OpenAI.cs b/src/Models/OpenAI.cs index 516a9423..df67ff66 100644 --- a/src/Models/OpenAI.cs +++ b/src/Models/OpenAI.cs @@ -175,7 +175,7 @@ namespace SourceGit.Models var body = reader.Result; if (!rsp.IsSuccessStatusCode) { - throw new Exception($"AI service returns error code {rsp.StatusCode}. Body: {body??string.Empty}"); + throw new Exception($"AI service returns error code {rsp.StatusCode}. Body: {body ?? string.Empty}"); } return JsonSerializer.Deserialize(reader.Result, JsonCodeGen.Default.OpenAIChatResponse); diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index fdccbf99..d850932c 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -211,6 +211,20 @@ + + + + + + + + + + + + + +
diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index a022ae99..59543af8 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using System.Threading.Tasks; using Avalonia; using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Controls.Documents; using Avalonia.Input; +using Avalonia.Threading; using Avalonia.VisualTree; namespace SourceGit.Views @@ -43,7 +45,9 @@ namespace SourceGit.Views if (change.Property == MessageProperty || change.Property == IssueTrackerRulesProperty) { Inlines!.Clear(); + _inlineCommits.Clear(); _matches = null; + _lastHover = null; ClearHoveredIssueLink(); var message = Message; @@ -154,6 +158,10 @@ namespace SourceGit.Views ToolTip.SetTip(this, match.Link); ToolTip.SetIsOpen(this, true); } + else + { + ProcessHoverCommitLink(match); + } return; } @@ -256,6 +264,52 @@ namespace SourceGit.Views ClearHoveredIssueLink(); } + private void ProcessHoverCommitLink(Models.Hyperlink link) + { + var sha = link.Link; + + // If we have already queried this SHA, just use it. + if (_inlineCommits.TryGetValue(sha, out var exist)) + { + if (exist != null) + { + ToolTip.SetTip(this, exist); + ToolTip.SetIsOpen(this, true); + } + + return; + } + + var parentView = this.FindAncestorOfType(); + if (parentView is { DataContext: ViewModels.CommitDetail detail }) + { + // Record the SHA of current viewing commit in the CommitDetail panel to determine if it is changed after + // asynchronous queries. + var lastDetailCommit = detail.Commit.SHA; + Task.Run(() => + { + var c = detail.GetParent(sha); + Dispatcher.UIThread.Invoke(() => + { + // Make sure the DataContext of CommitBaseInfo is not changed. + var currentParent = this.FindAncestorOfType(); + if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } && + currentDetail.Commit.SHA == lastDetailCommit) + { + _inlineCommits.Add(sha, c); + + // Make sure user still hovers the target SHA. + if (_lastHover == link) + { + ToolTip.SetTip(this, c); + ToolTip.SetIsOpen(this, true); + } + } + }); + }); + } + } + private void ClearHoveredIssueLink() { if (_lastHover != null) @@ -268,5 +322,6 @@ namespace SourceGit.Views private List _matches = null; private Models.Hyperlink _lastHover = null; + private Dictionary _inlineCommits = new(); } } diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 544453f5..da2d9ed1 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -476,7 +476,7 @@ namespace SourceGit.Views get => GetValue(SelectedChunkProperty); set => SetValue(SelectedChunkProperty, value); } - + public static readonly StyledProperty DisplayRangeProperty = AvaloniaProperty.Register(nameof(DisplayRange), new TextDiffViewRange(0, 0)); @@ -523,7 +523,7 @@ namespace SourceGit.Views var firstLineIdx = DisplayRange.StartIdx; if (firstLineIdx <= 1) return; - + var lines = GetLines(); var firstLineType = lines[firstLineIdx].Type; var prevLineType = lines[firstLineIdx - 1].Type; @@ -761,7 +761,7 @@ namespace SourceGit.Views if (start > index) start = index; } - + SetCurrentValue(DisplayRangeProperty, new TextDiffViewRange(start, start + count)); } @@ -1313,9 +1313,9 @@ namespace SourceGit.Views private ScrollViewer _scrollViewer = null; } - + public class TextDiffViewMinimap : Control - { + { public static readonly StyledProperty AddedLineBrushProperty = AvaloniaProperty.Register(nameof(AddedLineBrush), new SolidColorBrush(Color.FromArgb(60, 0, 255, 0))); @@ -1333,7 +1333,7 @@ namespace SourceGit.Views get => GetValue(DeletedLineBrushProperty); set => SetValue(DeletedLineBrushProperty, value); } - + public static readonly StyledProperty DisplayRangeProperty = AvaloniaProperty.Register(nameof(DisplayRange), new TextDiffViewRange(0, 0)); @@ -1342,7 +1342,7 @@ namespace SourceGit.Views get => GetValue(DisplayRangeProperty); set => SetValue(DisplayRangeProperty, value); } - + public static readonly StyledProperty DisplayRangeColorProperty = AvaloniaProperty.Register(nameof(DisplayRangeColor), Colors.RoyalBlue); @@ -1376,7 +1376,7 @@ namespace SourceGit.Views total = diff.Lines.Count; RenderSingleSide(context, diff.Lines, 0, Bounds.Width); } - + var range = DisplayRange; if (range.EndIdx == 0) return; @@ -1416,7 +1416,7 @@ namespace SourceGit.Views lastLineTypeStart = i; } } - + RenderBlock(context, lastLineType, lastLineTypeStart, total - lastLineTypeStart, total, x, width); } @@ -1431,7 +1431,7 @@ namespace SourceGit.Views } } } - + public partial class TextDiffView : UserControl { public static readonly StyledProperty UseSideBySideDiffProperty = From 4160f8ab9c9de0a7798122a2bf40bfe4e674d91a Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 24 Nov 2024 21:43:31 +0800 Subject: [PATCH 52/59] fix: only set tooltip if commit exists Signed-off-by: leo --- src/Views/CommitMessagePresenter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 59543af8..281cb38c 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -299,7 +299,7 @@ namespace SourceGit.Views _inlineCommits.Add(sha, c); // Make sure user still hovers the target SHA. - if (_lastHover == link) + if (_lastHover == link && c != null) { ToolTip.SetTip(this, c); ToolTip.SetIsOpen(this, true); From bf4080b77303d12ae0126e9a15dd190b441c372e Mon Sep 17 00:00:00 2001 From: Nils van Rijsinge Date: Mon, 25 Nov 2024 02:24:16 +0100 Subject: [PATCH 53/59] fix: crash on goto to SHA, NullReferenceException (#741) --- src/Views/CommitMessagePresenter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 281cb38c..7ca823dc 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -195,7 +195,7 @@ namespace SourceGit.Views open.Icon = App.CreateMenuIcon("Icons.Commit"); open.Click += (_, ev) => { - detail.NavigateTo(_lastHover.Link); + detail.NavigateTo(link); ev.Handled = true; }; From 831462b5946871e9a7534fb6dac32056555c69da Mon Sep 17 00:00:00 2001 From: Nils van Rijsinge Date: Mon, 25 Nov 2024 02:28:09 +0100 Subject: [PATCH 54/59] Add missing de_DE keys (#737) * localization: add missing de_DE keys - CommitDetail.Info.Children, General.ShowChildren were added in cc5bb5f - Text.Fetch.Force was added in 153a1f3 - Repository.HistoriesOrder... were added in b25f9bd - SHALinkCM.NavigateTo was added in 12f7531 * localization: fix invalid XAML --- src/Resources/Locales/de_DE.axaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 6293e5f0..4714a652 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -128,6 +128,7 @@ INFORMATION AUTOR GEÄNDERT + NACHFOLGER COMMITTER Prüfe Refs, die diesen Commit enthalten COMMIT ENTHALTEN IN @@ -270,6 +271,7 @@ Fast-Forward (ohne Auschecken) Fetch Alle Remotes fetchen + Aktiviere '--force' Option Ohne Tags fetchen Remote: Remote-Änderungen fetchen @@ -454,6 +456,7 @@ Sprache Commit-Historie Zeige Autor Zeitpunkt anstatt Commit Zeitpunkt + Zeige Nachfolger in den Commit Details Längenvorgabe für Commit-Nachrichten GIT Aktiviere Auto-CRLF @@ -546,6 +549,9 @@ Aufheben Im Graph ausblenden Im Graph filtern + Sortierungsmodus wechseln + Commit Zeitpunkt (--date-order) + Topologie (--topo-order) LOKALE BRANCHES Zum HEAD wechseln Aktiviere '--first-parent' Option @@ -598,6 +604,7 @@ Software Update Es sind momentan kein Updates verfügbar. SHA kopieren + Zum Commit wechseln Squash Commits In: SSH privater Schlüssel: From 55e3bfa2d41a040faa2bdf61a1d4104f66f60fa9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 Nov 2024 01:28:22 +0000 Subject: [PATCH 55/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 587f722e..affe87e6 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 76eff2ff..719f5b65 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,17 +1,10 @@ -### de_DE.axaml: 98.86% +### de_DE.axaml: 99.86%
Missing Keys -- Text.CommitDetail.Info.Children -- Text.Fetch.Force -- Text.Preference.General.ShowChildren - Text.Repository.FilterCommits -- Text.Repository.HistoriesOrder -- Text.Repository.HistoriesOrder.ByDate -- Text.Repository.HistoriesOrder.Topo -- Text.SHALinkCM.NavigateTo
From 772f1a93b43ebd4964fc3885f486a4227841ffeb Mon Sep 17 00:00:00 2001 From: AquariusStar <48148723+AquariusStar@users.noreply.github.com> Date: Mon, 25 Nov 2024 04:28:36 +0300 Subject: [PATCH 56/59] localiztion: update (#738) --- src/Resources/Locales/ru_RU.axaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 5b908a17..a9de62e7 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -128,6 +128,7 @@ ИНФОРМАЦИЯ АВТОР ИЗМЕНЁННЫЙ + ДОЧЕРНИЙ ИСПОЛНИТЕЛЬ Проверить ссылки, содержащие эту фиксацию ФИКСАЦИЯ СОДЕРЖИТСЯ В @@ -271,6 +272,7 @@ Быстрая перемотка вперёд (без проверки) Извлечь Извлечь все внешние хранилища + Разрешить опцию '--force' Извлечь без меток Внешнее хранилище: Извлечь внешние изменения @@ -455,6 +457,7 @@ Язык История фиксаций Показывать время автора вместо времени фиксации на графике + Показать наследника в деталях комментария Длина темы фиксации GIT Включить автозавершение CRLF @@ -544,10 +547,14 @@ Разрешить опцию --reflog Открыть в файловом менеджере Поиск веток, меток и подмодулей + Видимость на графике Не установлен (По-умолчанию) Скрыть в графе фиксации Фильтр в графе фиксации ОТФИЛЬТРОВАНО: + Переключить режим запроса + Дата фиксации (--date-order) + Топологически (--topo-order) ЛОКАЛЬНЫЕ ВЕТКИ Навигация по заголовку Включить опцию --first-parent From d0f9e994bbbe8ba89efdacb9b43c68a11ef25c70 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 25 Nov 2024 01:28:48 +0000 Subject: [PATCH 57/59] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index affe87e6..45d6bbf5 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.01%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 719f5b65..03b26e1b 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -72,19 +72,13 @@
-### ru_RU.axaml: 99.01% +### ru_RU.axaml: 100.00%
Missing Keys -- Text.CommitDetail.Info.Children -- Text.Fetch.Force -- Text.Preference.General.ShowChildren -- Text.Repository.FilterCommits -- Text.Repository.HistoriesOrder -- Text.Repository.HistoriesOrder.ByDate -- Text.Repository.HistoriesOrder.Topo +
From 57d4842435ef1a332326de674fbafa887f970af7 Mon Sep 17 00:00:00 2001 From: Chiahong <36815907+ChiahongHong@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:28:55 +0800 Subject: [PATCH 58/59] localization: update zh_TW.axaml (#739) --- src/Resources/Locales/zh_TW.axaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 3989259d..bf8b32e1 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -241,7 +241,7 @@ 下一個差異 沒有變更或僅有換行字元差異 上一個差異 - 另存為修補檔 + 另存為修補檔 (patch) 顯示隱藏符號 並排對比 子模組 @@ -367,12 +367,12 @@ 提交暫存區變更 提交暫存區變更並推送 自動暫存全部變更並提交 - 根據選取的提交建立新的分支 + 基於選取的提交建立新分支 捨棄選取的變更 提取 (fetch) 遠端的變更 切換左邊欄為分支/標籤等顯示模式 (預設) 拉取 (pull) 遠端的變更 - 推送 (push) 本地變更到遠端存放庫 + 推送 (push) 本機變更到遠端存放庫 強制重新載入存放庫 暫存或取消暫存選取的變更 切換左邊欄為歷史搜尋模式 @@ -396,8 +396,8 @@ 互動式重定基底 目標分支: 起始提交: - 在瀏覽器中存取網址 - 複製網址 + 在瀏覽器中開啟連結 + 複製連結 發生錯誤 系統提示 合併分支 @@ -456,7 +456,7 @@ 顯示語言 最大歷史提交數 在提交路線圖中顯示修改時間而非提交時間 - 在提交詳細面板中顯示後續提交 + 在提交詳細資訊中顯示後續提交 提交標題字數偵測 Git 設定 自動換行轉換 @@ -546,13 +546,13 @@ 啟用 [--reflog] 選項 在檔案瀏覽器中開啟 快速搜尋分支/標籤/子模組 - 設定在列表中的可視性 - 不指定 - 在提交清單中隱藏 - 使用其來篩選提交清單 + 篩選以顯示或隱藏 + 取消指定 + 在提交列表中隱藏 + 以其篩選提交列表 切換排序方式 - 按提交时间排序 (--date-order) - 按拓扑排序 (--topo-order) + 依提交時間排序 (--date-order) + 依拓撲排序 (--topo-order) 本機分支 回到 HEAD 啟用 [--first-parent] 選項 @@ -605,7 +605,7 @@ 軟體更新 目前已是最新版本。 複製提交編號 - 導覽到提交 + 前往此提交 壓縮為單個提交 合併入: SSH 金鑰: From 12deb1d2c399a3664b35afc23f480d894f1aaad4 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 25 Nov 2024 09:37:02 +0800 Subject: [PATCH 59/59] version: Release 8.40 Signed-off-by: leo --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index fb6559a3..081fd762 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.39 \ No newline at end of file +8.40 \ No newline at end of file