From 774ec65ef693d2a313465782d80ad287c7e8afd5 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 11:01:02 +0800 Subject: [PATCH 01/53] ux: layout for font size settings Signed-off-by: leo --- src/Resources/Locales/de_DE.axaml | 3 +- src/Resources/Locales/en_US.axaml | 5 ++-- src/Resources/Locales/es_ES.axaml | 2 -- src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 2 -- src/Resources/Locales/ru_RU.axaml | 2 -- src/Resources/Locales/zh_CN.axaml | 4 ++- src/Resources/Locales/zh_TW.axaml | 5 ++-- src/Views/Preference.axaml | 49 ++++++++++++++++++------------- 9 files changed, 39 insertions(+), 34 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index d1f43695..c7cd3200 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -73,7 +73,7 @@ ABBRECHEN Auf diese Revision zurücksetzen Auf Vorgänger-Revision zurücksetzen - Generiere Commit-Nachricht + Generiere Commit-Nachricht ANZEIGE MODUS ÄNDERN Zeige als Datei- und Ordnerliste Zeige als Pfadliste @@ -429,7 +429,6 @@ Modell DARSTELLUNG Standardschriftart - Standardschriftgröße Monospace-Schriftart Verwende die Monospace-Schriftart nur im Texteditor Design diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 3803bd39..281f13a3 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -434,8 +434,9 @@ Server APPEARANCE Default Font - Default Font Size - Editor Font Size + Font Size + Default + Editor Monospace Font Only use monospace font in text editor Theme diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 6bc96dd1..365cebfb 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -438,8 +438,6 @@ Servidor APARIENCIA Fuente por defecto - Tamaño de fuente por defecto - Tamaño de fuente del editor Fuente Monospace Usar solo fuente monospace en el editor de texto Tema diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 043e8f97..5668db44 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -371,7 +371,6 @@ Préférences APPARENCE Police par défaut - Taille de police par défaut Police monospace N'utiliser que des polices monospace pour l'éditeur de texte Thème diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 61ded334..ecd1654c 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -460,8 +460,6 @@ Servidor INTELIGÊNCIA ARTIFICIAL Fonte Padrão - Tamanho da fonte padrão - Tamanho da fonte do editor Fonte Monoespaçada Usar fonte monoespaçada apenas no editor de texto Tema diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 3ea6a922..7c558db2 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -438,8 +438,6 @@ Сервер ВИД Шрифт по-умолчанию - Размер шрифта по-умолчанию - Размер шрифта редактора Моноширный шрифт В текстовом редакторе используется только моноширный шрифт Тема diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 3df54899..5b1f1403 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -437,7 +437,9 @@ 服务地址 外观配置 缺省字体 - 默认字体大小 + 字体大小 + 默认 + 代码编辑器 代码字体大小 等宽字体 仅在文本编辑器中使用等宽字体 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 4dcb31aa..0587f089 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -437,8 +437,9 @@ 產生提交訊息提示詞 外觀設定 預設字型 - 預設字型大小 - 程式碼字型大小 + 字型大小 + 預設 + 程式碼 等寬字型 僅在文字編輯器中使用等寬字型 佈景主題 diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 73be0f7c..9b84604a 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -121,7 +121,7 @@ - + - + + Value="{Binding DefaultFontSize, Mode=TwoWay}"> + + + + + + + + + + + + + + - - - - @@ -196,16 +205,16 @@ - - - Date: Mon, 11 Nov 2024 03:01:20 +0000 Subject: [PATCH 02/53] 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 e464f74c..63d84a13 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.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%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-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-98.41%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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.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 587ba99a..45d6cbe9 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 98.70% +### de_DE.axaml: 98.41%
@@ -12,21 +12,25 @@ - Text.Hotkeys.Repo.Push - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink -- Text.Preference.Appearance.EditorFontSize +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor
-### es_ES.axaml: 100.00% +### es_ES.axaml: 99.57%
Missing Keys - +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor
-### fr_FR.axaml: 86.58% +### fr_FR.axaml: 86.31%
@@ -99,7 +103,9 @@ - Text.Preference.AI.Model - Text.Preference.AI.Name - Text.Preference.AI.Server -- Text.Preference.Appearance.EditorFontSize +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor - Text.Preference.General.ShowAuthorTime - Text.Preference.Integration - Text.Preference.Shell @@ -128,23 +134,27 @@
-### pt_BR.axaml: 100.00% +### pt_BR.axaml: 99.57%
Missing Keys - +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.57%
Missing Keys - +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor
From 050b1d1188ad39b707621b17106d0699c6e4cdb6 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 12:16:20 +0800 Subject: [PATCH 03/53] enhance: supports issue link in keywords (#678) Signed-off-by: leo --- src/Commands/Diff.cs | 2 +- src/Commands/ExecuteCustomAction.cs | 2 +- src/ViewModels/CommitDetail.cs | 2 +- src/Views/Histories.axaml.cs | 61 ++++++++++++++++++---------- src/Views/RepositoryToolbar.axaml.cs | 6 +-- 5 files changed, 45 insertions(+), 28 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index 04103d68..cb9e6a18 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -129,7 +129,7 @@ namespace SourceGit.Commands _oldLine = int.Parse(match.Groups[1].Value); _newLine = int.Parse(match.Groups[2].Value); _result.TextDiff.Lines.Add(new Models.TextDiffLine(Models.TextDiffLineType.Indicator, line, 0, 0)); - } + } } else { diff --git a/src/Commands/ExecuteCustomAction.cs b/src/Commands/ExecuteCustomAction.cs index f5fec82c..4981b2f9 100644 --- a/src/Commands/ExecuteCustomAction.cs +++ b/src/Commands/ExecuteCustomAction.cs @@ -44,7 +44,7 @@ namespace SourceGit.Commands { outputHandler?.Invoke(e.Data); builder.AppendLine(e.Data); - } + } }; try diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index e56ea3fd..71b9ddb6 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -118,7 +118,7 @@ namespace SourceGit.ViewModels var trimmedUrl = url; if (url.EndsWith(".git")) trimmedUrl = url.Substring(0, url.Length - 4); - + if (url.StartsWith("https://github.com/", StringComparison.Ordinal)) WebLinks.Add(new Models.CommitLink() { Name = $"Github ({trimmedUrl.Substring(19)})", URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://gitlab.", StringComparison.Ordinal)) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 9f436346..85092b64 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -192,35 +192,26 @@ namespace SourceGit.Views if (string.IsNullOrEmpty(subject)) return; - var offset = 0; var keywordMatch = REG_KEYWORD_FORMAT1().Match(subject); if (!keywordMatch.Success) keywordMatch = REG_KEYWORD_FORMAT2().Match(subject); - if (keywordMatch.Success) - { - var keyword = new Run(subject.Substring(0, keywordMatch.Length)); - keyword.FontWeight = FontWeight.Bold; - Inlines.Add(keyword); - - offset = keywordMatch.Length; - subject = subject.Substring(offset); - } - - var rules = IssueTrackerRules; - if (rules == null || rules.Count == 0) - { - Inlines.Add(new Run(subject)); - return; - } - + var rules = IssueTrackerRules ?? []; var matches = new List(); foreach (var rule in rules) rule.Matches(matches, subject); if (matches.Count == 0) { - Inlines.Add(new Run(subject)); + if (keywordMatch.Success) + { + Inlines.Add(new Run(subject.Substring(0, keywordMatch.Length)) { FontWeight = FontWeight.Bold }); + Inlines.Add(new Run(subject.Substring(keywordMatch.Length))); + } + else + { + Inlines.Add(new Run(subject)); + } return; } @@ -232,18 +223,44 @@ namespace SourceGit.Views foreach (var match in matches) { if (match.Start > pos) - inlines.Add(new Run(subject.Substring(pos, match.Start - pos))); + { + if (keywordMatch.Success && pos < keywordMatch.Length) + { + if (keywordMatch.Length < match.Start) + { + inlines.Add(new Run(subject.Substring(pos, keywordMatch.Length - pos)) { FontWeight = FontWeight.Bold }); + inlines.Add(new Run(subject.Substring(keywordMatch.Length, match.Start - keywordMatch.Length))); + } + else + { + inlines.Add(new Run(subject.Substring(pos, match.Start - pos)) { FontWeight = FontWeight.Bold }); + } + } + else + { + inlines.Add(new Run(subject.Substring(pos, match.Start - pos))); + } + } var link = new Run(subject.Substring(match.Start, match.Length)); link.Classes.Add("issue_link"); inlines.Add(link); pos = match.Start + match.Length; - match.Start += offset; // Because we use this index of whole subject to detect mouse event. } if (pos < subject.Length) - inlines.Add(new Run(subject.Substring(pos))); + { + if (keywordMatch.Success && pos < keywordMatch.Length) + { + inlines.Add(new Run(subject.Substring(pos, keywordMatch.Length - pos)) { FontWeight = FontWeight.Bold }); + inlines.Add(new Run(subject.Substring(keywordMatch.Length))); + } + else + { + inlines.Add(new Run(subject.Substring(pos))); + } + } Inlines.AddRange(inlines); } diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index e2c7df8c..afc8ac5a 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -52,7 +52,7 @@ namespace SourceGit.Views var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); - + repo.Fetch(startDirectly); e.Handled = true; } @@ -66,7 +66,7 @@ namespace SourceGit.Views var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); - + repo.Pull(startDirectly); e.Handled = true; } @@ -80,7 +80,7 @@ namespace SourceGit.Views var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); - + repo.Push(startDirectly); e.Handled = true; } From d3e1796492919800f93e07f89078fb629d46a4fe Mon Sep 17 00:00:00 2001 From: AquariusStar <48148723+AquariusStar@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:22:16 +0300 Subject: [PATCH 04/53] localization: update translation for russian (#680) --- src/Resources/Locales/ru_RU.axaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 7c558db2..ac94ee77 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -438,6 +438,9 @@ Сервер ВИД Шрифт по-умолчанию + Размер шрифта + По-умолчанию + Редактор Моноширный шрифт В текстовом редакторе используется только моноширный шрифт Тема From db66ba82a627449b0da2bcafd901fa2049e2bc36 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 Nov 2024 06:22:28 +0000 Subject: [PATCH 05/53] 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 63d84a13..a0fe4147 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.41%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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.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-98.41%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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-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 45d6cbe9..b85511df 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -146,15 +146,13 @@ -### ru_RU.axaml: 99.57% +### ru_RU.axaml: 100.00%
Missing Keys -- Text.Preference.Appearance.FontSize -- Text.Preference.Appearance.FontSize.Default -- Text.Preference.Appearance.FontSize.Editor +
From 503f700fc2ad6530525cd8cdaae7c6322176c167 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 20:24:17 +0800 Subject: [PATCH 06/53] refactor: open selected revision file (#681) * Instead of opening the file from current worktree, save the selected revision file to the temp dir and the open it with default editor * Do NOT set the `IsEnable` property, since the revision file is always available Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 71b9ddb6..51056f67 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -381,10 +381,13 @@ namespace SourceGit.ViewModels var openWith = new MenuItem(); openWith.Header = App.Text("OpenWith"); openWith.Icon = App.CreateMenuIcon("Icons.OpenWith"); - openWith.IsEnabled = File.Exists(fullPath); openWith.Click += (_, ev) => { - Native.OS.OpenWithDefaultEditor(fullPath); + var fileName = Path.GetFileNameWithoutExtension(fullPath) ?? ""; + var fileExt = Path.GetExtension(fullPath) ?? ""; + var tmpFile = Path.Combine(Path.GetTempPath(), $"{fileName}~{_commit.SHA.Substring(0, 10)}{fileExt}"); + Commands.SaveRevisionFile.Run(_repo.FullPath, _commit.SHA, file.Path, tmpFile); + Native.OS.OpenWithDefaultEditor(tmpFile); ev.Handled = true; }; From 1f158eeded62b87043211fb441621261e331cc9b Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 12 Nov 2024 09:27:53 +0800 Subject: [PATCH 07/53] refactor: use `--tags` instead of `--force` for `git fetch` command if `Fetch without tags` is turned off (#684) Signed-off-by: leo --- src/Commands/Fetch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index 08d2d1c6..834cd7fc 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -16,7 +16,7 @@ namespace SourceGit.Commands if (noTags) Args += "--no-tags "; else - Args += "--force "; + Args += "--tags "; if (prune) Args += "--prune "; From 6e4f9717336a31e5e2d7fa98da9d04a5da8593b3 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 12 Nov 2024 17:59:50 +0800 Subject: [PATCH 08/53] feature: show tooltip of parent commit when hover the parent SHA Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 5 +++++ src/Views/CommitBaseInfo.axaml | 23 ++++++++++++++++++++++- src/Views/CommitBaseInfo.axaml.cs | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 51056f67..ef060f04 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -169,6 +169,11 @@ namespace SourceGit.ViewModels SearchChangeFilter = string.Empty; } + public Models.Commit GetParent(string sha) + { + return new Commands.QuerySingleCommit(_repo.FullPath, sha).Result(); + } + public List GetRevisionFilesUnderFolder(string parentFolder) { return new Commands.QueryRevisionObjects(_repo.FullPath, _commit.SHA, parentFolder).Result(); diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 76ea0227..3eece45f 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -117,7 +117,28 @@ TextDecorations="Underline" Cursor="Hand" Margin="0,0,16,0" - PointerPressed="OnSHAPressed"/> + PointerEntered="OnSHAPointerEntered" + PointerPressed="OnSHAPressed"> + + + + + + + + + + + + + + + + + +
diff --git a/src/Views/CommitBaseInfo.axaml.cs b/src/Views/CommitBaseInfo.axaml.cs index 228fbe8e..6eb31a60 100644 --- a/src/Views/CommitBaseInfo.axaml.cs +++ b/src/Views/CommitBaseInfo.axaml.cs @@ -1,3 +1,5 @@ +using System.Threading.Tasks; + using Avalonia; using Avalonia.Collections; using Avalonia.Controls; @@ -113,6 +115,29 @@ namespace SourceGit.Views e.Handled = true; } + private async void OnSHAPointerEntered(object sender, PointerEventArgs e) + { + if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha } ctl) + { + var tooltip = ToolTip.GetTip(ctl); + if (tooltip is Models.Commit commit && commit.SHA == sha) + { + ToolTip.SetIsOpen(ctl, true); + } + else + { + var c = await Task.Run(() => detail.GetParent(sha)); + if (c != null) + { + ToolTip.SetTip(ctl, c); + ToolTip.SetIsOpen(ctl, true); + } + } + } + + e.Handled = true; + } + private void OnSHAPressed(object sender, PointerPressedEventArgs e) { if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha }) From b0a5a033c6a4183829b5df918dd3c439caafdab8 Mon Sep 17 00:00:00 2001 From: Nils van Rijsinge Date: Tue, 12 Nov 2024 11:09:28 +0100 Subject: [PATCH 09/53] Add missing de_DE keys (#687) * localization: add missing de_DE keys - SaveAsPatch: 6486095 - VisualLine: 1a8acbf - Hotkeys (Fetch, Pull, Push, CreateBranchOnCommit): d50b2c0 - IssueLinkCM: 163e8cc - Appearance.FontSize: 774ec65 * doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 14 ++------------ src/Resources/Locales/de_DE.axaml | 11 +++++++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a0fe4147..85e3ae64 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.41%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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-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-100.00%25-brightgreen)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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-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 b85511df..59b496f7 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,20 +1,10 @@ -### de_DE.axaml: 98.41% +### de_DE.axaml: 100.00%
Missing Keys -- Text.Diff.SaveAsPatch -- Text.Diff.VisualLines.All -- Text.Hotkeys.Repo.CreateBranchOnCommit -- Text.Hotkeys.Repo.Fetch -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink -- Text.Preference.Appearance.FontSize -- Text.Preference.Appearance.FontSize.Default -- Text.Preference.Appearance.FontSize.Editor +
diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index c7cd3200..ae2e89d7 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -240,6 +240,7 @@ Nächste Änderung KEINE ÄNDERUNG ODER NUR ZEILEN-ENDE ÄNDERUNGEN Vorherige Änderung + Als Patch speichern Zeige versteckte Symbole Nebeneinander SUBMODUL @@ -248,6 +249,7 @@ Syntax Hervorhebung Zeilenumbruch Öffne in Merge Tool + Alle Zeilen anzeigen Weniger Zeilen anzeigen Mehr Zeilen anzeigen WÄHLE EINE DATEI AUS UM ÄNDERUNGEN ANZUZEIGEN @@ -364,8 +366,12 @@ Gestagte Änderungen committen Gestagte Änderungen committen und pushen Alle Änderungen stagen und committen + Neuen Branch basierend auf ausgewählten Commit erstellen Ausgewählte Änderungen verwerfen + Fetch, wird direkt ausgeführt Dashboard Modus (Standard) + Pull, wird direkt ausgeführt + Push, wird direkt ausgeführt Erzwinge Neuladen des Repositorys Ausgewählte Änderungen stagen/unstagen Commit-Suchmodus @@ -389,6 +395,8 @@ Interaktiver Rebase Ziel Branch: Auf: + In Browser öffnen + Link kopieren FEHLER INFO Branch mergen @@ -429,6 +437,9 @@ Modell DARSTELLUNG Standardschriftart + Schriftgröße + Standard + Texteditor Monospace-Schriftart Verwende die Monospace-Schriftart nur im Texteditor Design From f66e9c828a5ac1c760beb5ce2bbc28b63dfe5bdb Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 12 Nov 2024 18:14:00 +0800 Subject: [PATCH 10/53] ux: layout for parent commit tooltip Signed-off-by: leo --- src/Views/CommitBaseInfo.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 3eece45f..d8b77a18 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -121,7 +121,7 @@ PointerPressed="OnSHAPressed"> @@ -134,7 +134,7 @@
- + From 5e60780c9f6377ec37bf10e7510918126e941f42 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 12 Nov 2024 18:28:35 +0800 Subject: [PATCH 11/53] ux: new tooltip style Signed-off-by: leo --- src/Resources/Styles.axaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 50f4d830..88aca6b0 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -168,12 +168,13 @@ - + From 146f383aae214bec7877ac9d803ebd6efcf60e1a Mon Sep 17 00:00:00 2001 From: aikawayataro Date: Tue, 12 Nov 2024 11:50:16 +0000 Subject: [PATCH 12/53] enhance: depend on SO in rpm package (#688) * enhance: ensure LF line endings used with package manifests * enhance: depend on shared object instead of package Back in 211c263, I changed the dependencies to depend on package instead of shared object. This worked well, but introduced some problems for distros other than Fedora (81f76f0). I did this because of problems with the arm64 package, but now I think `__isa_bits` is a reasonable workaround. * refactor: remove pointless variable checks `set -u` was introduced in 6461765 --- .editorconfig | 4 ++++ .gitattributes | 4 +++- build/resources/rpm/SPECS/build.spec | 4 ++-- build/scripts/package.linux.sh | 10 ---------- build/scripts/package.osx-app.sh | 10 ---------- build/scripts/package.windows-portable.sh | 10 ---------- 6 files changed, 9 insertions(+), 33 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3ad9d05b..83b15884 100644 --- a/.editorconfig +++ b/.editorconfig @@ -293,6 +293,10 @@ end_of_line = lf [*.{cmd,bat}] end_of_line = crlf +# Package manifests +[{*.spec,control}] +end_of_line = lf + # YAML files [*.{yml,yaml}] indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 7410eb08..bd1dfea9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,10 +3,12 @@ *.png binary *.ico binary *.sh text eol=lf +*.spec text eol=lf +control text eol=lf *.bat text eol=crlf *.cmd text eol=crlf *.ps1 text eol=crlf *.json text .gitattributes export-ignore -.gitignore export-ignore \ No newline at end of file +.gitignore export-ignore diff --git a/build/resources/rpm/SPECS/build.spec b/build/resources/rpm/SPECS/build.spec index 9dda5f96..d31b6587 100644 --- a/build/resources/rpm/SPECS/build.spec +++ b/build/resources/rpm/SPECS/build.spec @@ -5,8 +5,8 @@ Summary: Open-source & Free Git Gui Client License: MIT URL: https://sourcegit-scm.github.io/ Source: https://github.com/sourcegit-scm/sourcegit/archive/refs/tags/v%_version.tar.gz -Requires: (libX11 or libX11-6) -Requires: (libSM or libSM6) +Requires: libX11.so.6()(%{__isa_bits}bit) +Requires: libSM.so.6()(%{__isa_bits}bit) %define _build_id_links none diff --git a/build/scripts/package.linux.sh b/build/scripts/package.linux.sh index 5ffd5a27..5abb058b 100755 --- a/build/scripts/package.linux.sh +++ b/build/scripts/package.linux.sh @@ -5,16 +5,6 @@ set -o set -u set pipefail -if [[ -z "$VERSION" ]]; then - echo "Provide the version as environment variable VERSION" - exit 1 -fi - -if [[ -z "$RUNTIME" ]]; then - echo "Provide the runtime as environment variable RUNTIME" - exit 1 -fi - arch= appimage_arch= target= diff --git a/build/scripts/package.osx-app.sh b/build/scripts/package.osx-app.sh index 4a50a860..2d43e24a 100755 --- a/build/scripts/package.osx-app.sh +++ b/build/scripts/package.osx-app.sh @@ -5,16 +5,6 @@ set -o set -u set pipefail -if [[ -z "$VERSION" ]]; then - echo "Provide the version as environment variable VERSION" - exit 1 -fi - -if [[ -z "$RUNTIME" ]]; then - echo "Provide the runtime as environment variable RUNTIME" - exit 1 -fi - cd build mkdir -p SourceGit.app/Contents/Resources diff --git a/build/scripts/package.windows-portable.sh b/build/scripts/package.windows-portable.sh index 9ba29216..6bd3879b 100755 --- a/build/scripts/package.windows-portable.sh +++ b/build/scripts/package.windows-portable.sh @@ -5,16 +5,6 @@ set -o set -u set pipefail -if [[ -z "$VERSION" ]]; then - echo "Provide the version as environment variable VERSION" - exit 1 -fi - -if [[ -z "$RUNTIME" ]]; then - echo "Provide the runtime as environment variable RUNTIME" - exit 1 -fi - cd build rm -rf SourceGit/*.pdb From c16a412aa388684ce1e0d2217820abc8ad7c267b Mon Sep 17 00:00:00 2001 From: aikawayataro Date: Tue, 12 Nov 2024 11:55:42 +0000 Subject: [PATCH 13/53] fix: SourceGit misspelled as "Source Git" (#689) --- .github/workflows/package.yml | 2 +- build/resources/_common/applications/sourcegit.desktop | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 53affe3d..e973c1ab 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -3,7 +3,7 @@ on: workflow_call: inputs: version: - description: Source Git package version + description: SourceGit package version required: true type: string jobs: diff --git a/build/resources/_common/applications/sourcegit.desktop b/build/resources/_common/applications/sourcegit.desktop index ff7ef135..bcf9c813 100644 --- a/build/resources/_common/applications/sourcegit.desktop +++ b/build/resources/_common/applications/sourcegit.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Name=Source Git +Name=SourceGit Comment=Open-source & Free Git GUI Client Exec=/opt/sourcegit/sourcegit Icon=/usr/share/icons/sourcegit.png From 8935bdd4c94b9aa1111affd29fdb1668a9e04051 Mon Sep 17 00:00:00 2001 From: Alberto de la Cruz <32411964+albertodlc@users.noreply.github.com> Date: Wed, 13 Nov 2024 02:33:35 +0100 Subject: [PATCH 14/53] feat: delete orphan remote tracking branches (#692) * feat: remove orphan remote-tracking branches - Allow user remove local remote-tracking branches without remotes (ie. remote was removed on merge request). - Included 'DeleteRemoteTracking' and 'HasRemote' util methods to handle this case. * fix: delete both case (local & remote-tracking) - We have local and remote-tracking but not a remote branch. We need to remove both or only the tracking based on the checkbox and on the 'hasRemote' condition --- src/Commands/Branch.cs | 22 ++++++++++++++++++++++ src/ViewModels/DeleteBranch.cs | 31 +++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/Commands/Branch.cs b/src/Commands/Branch.cs index 890b54ee..30e216e4 100644 --- a/src/Commands/Branch.cs +++ b/src/Commands/Branch.cs @@ -52,5 +52,27 @@ cmd.Args = $"push {remote} --delete {name}"; return cmd.Exec(); } + + public static bool DeleteRemoteTracking(string repo, string name) + { + var cmd = new Command(); + cmd.WorkingDirectory = repo; + cmd.Context = repo; + cmd.Args = $"branch -D -r {name}"; + return cmd.Exec(); + } + + public static bool HasRemote(string repo, string remote, string name) + { + var cmd = new Command(); + cmd.WorkingDirectory = repo; + cmd.Context = repo; + cmd.SSHKey = new Config(repo).Get($"remote.{remote}.sshkey"); + cmd.Args = $"ls-remote {remote} {name}"; + + var rs = cmd.ReadToEnd(); + + return rs.StdOut.Length > 0; + } } } diff --git a/src/ViewModels/DeleteBranch.cs b/src/ViewModels/DeleteBranch.cs index ba1aa839..27e60bbd 100644 --- a/src/ViewModels/DeleteBranch.cs +++ b/src/ViewModels/DeleteBranch.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; namespace SourceGit.ViewModels { @@ -56,12 +57,34 @@ namespace SourceGit.ViewModels if (_alsoDeleteTrackingRemote && TrackingRemoteBranch != null) { - SetProgressDescription("Deleting tracking remote branch..."); - Commands.Branch.DeleteRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name); + + if (Commands.Branch.HasRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name)) + { + SetProgressDescription("Deleting remote-tracking branch and remote branch..."); + + Commands.Branch.DeleteRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name); + } + else + { + SetProgressDescription("Deleting remote-tracking branch..."); + + var remoteTrackingBranch = $"{TrackingRemoteBranch.Remote}/{TrackingRemoteBranch.Name}"; + + Commands.Branch.DeleteRemoteTracking(_repo.FullPath, remoteTrackingBranch); + } + } } - else + else if(!Commands.Branch.HasRemote(_repo.FullPath, Target.Remote, Target.Name)) { + SetProgressDescription("Remote branch not found. Deleting remote-tracking branch..."); + var remoteTrackingBranch = $"{Target.Remote}/{Target.Name}"; + + Commands.Branch.DeleteRemoteTracking(_repo.FullPath, remoteTrackingBranch); + } + else + { + SetProgressDescription("Deleting remote-tracking branch..."); Commands.Branch.DeleteRemote(_repo.FullPath, Target.Remote, Target.Name); } From fd5c1f5105f4bf5ccccc3c4f928c707d01a66655 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 13 Nov 2024 10:04:28 +0800 Subject: [PATCH 15/53] code_review: PR #692 * remove unnecessary namespace using * move `Commands.Branch.HasRemote` to `Commands.Remote.HasBranch` * remove `Commands.Branch.DeleteRemoteTracking` and check branch in `Commands.Branch.DeleteRemote` directly Signed-off-by: leo --- src/Commands/Branch.cs | 34 +++++++++++----------------------- src/Commands/Remote.cs | 9 +++++++++ src/ViewModels/DeleteBranch.cs | 31 ++++--------------------------- 3 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/Commands/Branch.cs b/src/Commands/Branch.cs index 30e216e4..4ec8da82 100644 --- a/src/Commands/Branch.cs +++ b/src/Commands/Branch.cs @@ -48,31 +48,19 @@ var cmd = new Command(); cmd.WorkingDirectory = repo; cmd.Context = repo; - cmd.SSHKey = new Config(repo).Get($"remote.{remote}.sshkey"); - cmd.Args = $"push {remote} --delete {name}"; - return cmd.Exec(); - } - public static bool DeleteRemoteTracking(string repo, string name) - { - var cmd = new Command(); - cmd.WorkingDirectory = repo; - cmd.Context = repo; - cmd.Args = $"branch -D -r {name}"; - return cmd.Exec(); - } + bool exists = new Remote(repo).HasBranch(remote, name); + if (exists) + { + cmd.SSHKey = new Config(repo).Get($"remote.{remote}.sshkey"); + cmd.Args = $"push {remote} --delete {name}"; + } + else + { + cmd.Args = $"branch -D -r {remote}/{name}"; + } - public static bool HasRemote(string repo, string remote, string name) - { - var cmd = new Command(); - cmd.WorkingDirectory = repo; - cmd.Context = repo; - cmd.SSHKey = new Config(repo).Get($"remote.{remote}.sshkey"); - cmd.Args = $"ls-remote {remote} {name}"; - - var rs = cmd.ReadToEnd(); - - return rs.StdOut.Length > 0; + return cmd.Exec(); } } } diff --git a/src/Commands/Remote.cs b/src/Commands/Remote.cs index f2e8d09e..beaf412b 100644 --- a/src/Commands/Remote.cs +++ b/src/Commands/Remote.cs @@ -45,5 +45,14 @@ Args = "remote set-url" + (isPush ? " --push " : " ") + $"{name} {url}"; return Exec(); } + + public bool HasBranch(string remote, string branch) + { + SSHKey = new Config(WorkingDirectory).Get($"remote.{remote}.sshkey"); + Args = $"ls-remote {remote} {branch}"; + + var rs = ReadToEnd(); + return rs.IsSuccess && rs.StdOut.Trim().Length > 0; + } } } diff --git a/src/ViewModels/DeleteBranch.cs b/src/ViewModels/DeleteBranch.cs index 27e60bbd..e7136a0d 100644 --- a/src/ViewModels/DeleteBranch.cs +++ b/src/ViewModels/DeleteBranch.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace SourceGit.ViewModels { @@ -57,34 +56,12 @@ namespace SourceGit.ViewModels if (_alsoDeleteTrackingRemote && TrackingRemoteBranch != null) { - - if (Commands.Branch.HasRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name)) - { - SetProgressDescription("Deleting remote-tracking branch and remote branch..."); - - Commands.Branch.DeleteRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name); - } - else - { - SetProgressDescription("Deleting remote-tracking branch..."); - - var remoteTrackingBranch = $"{TrackingRemoteBranch.Remote}/{TrackingRemoteBranch.Name}"; - - Commands.Branch.DeleteRemoteTracking(_repo.FullPath, remoteTrackingBranch); - } - + SetProgressDescription("Deleting remote-tracking branch..."); + Commands.Branch.DeleteRemote(_repo.FullPath, TrackingRemoteBranch.Remote, TrackingRemoteBranch.Name); } } - else if(!Commands.Branch.HasRemote(_repo.FullPath, Target.Remote, Target.Name)) + else { - SetProgressDescription("Remote branch not found. Deleting remote-tracking branch..."); - var remoteTrackingBranch = $"{Target.Remote}/{Target.Name}"; - - Commands.Branch.DeleteRemoteTracking(_repo.FullPath, remoteTrackingBranch); - } - else - { - SetProgressDescription("Deleting remote-tracking branch..."); Commands.Branch.DeleteRemote(_repo.FullPath, Target.Remote, Target.Name); } From ea4e968404577dd82ef3da31bd84e6e8a7dcabb9 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 13 Nov 2024 11:35:48 +0800 Subject: [PATCH 16/53] ux: repository left panel layout Signed-off-by: leo --- src/Views/Repository.axaml | 4 ++-- src/Views/TagsView.axaml | 5 +++-- src/Views/TagsView.axaml.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index bb34a821..eab0d28a 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -256,7 +256,7 @@ @@ -70,8 +71,8 @@ ContextRequested="OnRowContextRequested" ToolTip.Tip="{Binding Message}"> Date: Thu, 14 Nov 2024 02:18:09 +0100 Subject: [PATCH 17/53] Add missing fr_FR keys (#696) * localization: add missing fr_FR keys --------- Co-authored-by: Theo GAUTHIER --- TRANSLATION.md | 95 -------- src/Resources/Locales/fr_FR.axaml | 349 +++++++++++++++++++----------- 2 files changed, 221 insertions(+), 223 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 59b496f7..812a117b 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -26,101 +26,6 @@
Missing Keys -- Text.About.Chart -- Text.AIAssistant -- Text.AIAssistant.Tip -- Text.BranchCM.FetchInto -- Text.ChangeCM.GenerateCommitMessage -- Text.CherryPick.AppendSourceToMessage -- Text.CherryPick.Mainline -- Text.CherryPick.Mainline.Tips -- Text.CommitCM.CherryPickMultiple -- Text.CommitCM.CustomAction -- Text.CommitCM.SquashCommitsSinceThis -- Text.CommitDetail.Info.WebLinks -- Text.Configure.CustomAction -- Text.Configure.CustomAction.Arguments -- Text.Configure.CustomAction.Arguments.Tip -- Text.Configure.CustomAction.Executable -- Text.Configure.CustomAction.Name -- Text.Configure.CustomAction.Scope -- Text.Configure.CustomAction.Scope.Commit -- Text.Configure.CustomAction.Scope.Repository -- Text.Configure.Git.DefaultRemote -- Text.Configure.Git.EnablePruneOnFetch -- Text.Configure.Git.EnableSignOff -- Text.Configure.IssueTracker.AddSampleGitLabIssue -- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest -- Text.Configure.OpenAI -- Text.Configure.OpenAI.Prefered -- Text.Configure.OpenAI.Prefered.Tip -- Text.ConfigureWorkspace -- Text.ConfigureWorkspace.Color -- Text.ConfigureWorkspace.Restore -- Text.ConventionalCommit -- Text.ConventionalCommit.BreakingChanges -- Text.ConventionalCommit.ClosedIssue -- Text.ConventionalCommit.Detail -- Text.ConventionalCommit.Scope -- Text.ConventionalCommit.ShortDescription -- Text.ConventionalCommit.Type -- Text.Diff.IgnoreWhitespace -- Text.Diff.SaveAsPatch -- Text.Diff.VisualLines.All -- Text.Discard.IncludeIgnored -- Text.ExecuteCustomAction -- Text.ExecuteCustomAction.Name -- Text.FileHistory.FileChange -- Text.GitLFS.Locks.OnlyMine -- Text.Histories.Header.AuthorTime -- Text.Histories.Tips -- Text.Histories.Tips.MacOS -- Text.Histories.Tips.Prefix -- Text.Hotkeys.Repo.CommitWithAutoStage -- Text.Hotkeys.Repo.CreateBranchOnCommit -- Text.Hotkeys.Repo.DiscardSelected -- Text.Hotkeys.Repo.Fetch -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink -- Text.MoveRepositoryNode -- Text.MoveRepositoryNode.Target -- Text.Preference.AI -- Text.Preference.AI.AnalyzeDiffPrompt -- Text.Preference.AI.ApiKey -- Text.Preference.AI.GenerateSubjectPrompt -- Text.Preference.AI.Model -- Text.Preference.AI.Name -- Text.Preference.AI.Server -- Text.Preference.Appearance.FontSize -- Text.Preference.Appearance.FontSize.Default -- Text.Preference.Appearance.FontSize.Editor -- Text.Preference.General.ShowAuthorTime -- Text.Preference.Integration -- Text.Preference.Shell -- Text.Preference.Shell.Type -- Text.Preference.Shell.Path -- Text.Repository.AutoFetching -- Text.Repository.CustomActions -- Text.Repository.CustomActions.Empty -- Text.Repository.EnableReflog -- Text.Repository.Search.InCurrentBranch -- Text.ScanRepositories -- Text.ScanRepositories.RootDir -- Text.Squash.Into -- Text.Stash.KeepIndex -- Text.Stash.OnlyStagedChanges -- Text.Stash.TipForSelectedFiles -- Text.Statistics.Overview -- Text.TagCM.CopyMessage -- Text.Welcome.Move -- Text.Welcome.ScanDefaultCloneDir -- Text.WorkingCopy.CommitTip -- Text.WorkingCopy.CommitWithAutoStage -- Text.WorkingCopy.ConfirmCommitWithoutFiles -- Text.Workspace -- Text.Workspace.Configure
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 5668db44..e1562523 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -3,23 +3,26 @@ À propos + À propos de SourceGit • Compilé avec + • Le graphique est rendu par © 2024 sourcegit-scm • TextEditor de • Les polices Monospace proviennent de - À propos de SourceGit • Le code source est disponible sur Client Git Open Source et Gratuit Ajouter un Worktree + What to Checkout: + Créer une nouvelle branche + Branche existante Emplacement : Chemin vers ce worktree. Relatif supporté. Nom de branche: Optionnel. Nom du dossier de destination par défaut. Suivre la branche : Suivi de la branche distante - What to Checkout: - Créer une nouvelle branche - Branche existante + Assistant IA + Utiliser l'IA pour générer un message de commit Appliquer Erreur Soulever les erreurs et refuser d'appliquer le patch @@ -55,6 +58,7 @@ Supprimer {0} branches sélectionnées Rejeter tous les changements Fast-Forward vers ${0}$ + Fetch ${0}$ vers ${1}$... Git Flow - Terminer ${0}$ Fusionner ${0}$ dans ${1}$... Tirer ${0}$ @@ -69,6 +73,7 @@ ANNULER Réinitialiser à la révision parente Réinitialiser à cette révision + Générer un message de commit CHANGER LE MODE D'AFFICHAGE Afficher comme liste de dossiers/fichiers Afficher comme liste de chemins @@ -77,6 +82,7 @@ Checkout ce commit Commit : Avertissement: un checkout vers un commit aboutiera vers un HEAD détaché + Branche: Changements locaux : Annuler Ne rien faire @@ -85,9 +91,11 @@ Cherry-Pick de ce commit Commit : Commit tous les changements + Ligne principale : Cherry Pick Supprimer les stashes Vous essayez de supprimer tous les stashes. Êtes-vous sûr de vouloir continuer ? + Cloner repository distant Paramètres supplémentaires : Arguments additionnels au clônage. Optionnel. Nom local : @@ -103,6 +111,7 @@ Comparer avec le worktree Copier les informations Copier le SHA + Action personnalisée Rebase interactif de ${0}$ ici Rebaser ${0}$ ici Réinitialiser ${0}$ ici @@ -110,6 +119,7 @@ Reformuler Enregistrer en tant que patch... Squash dans le parent + Squash les commits enfants ici CHANGEMENTS Rechercher les changements... FICHIERS @@ -126,29 +136,56 @@ PARENTS REFS SHA - Description + Ouvrir dans le navigateur Entrez le message du commit + Description Configurer le dépôt MODÈLE DE COMMIT - Contenu de modèle: Nom de modèle: + Contenu de modèle: + ACTION PERSONNALISÉE + Arguments : + ${REPO} - Chemin du repository; ${SHA} - SHA du commit sélectionné + Fichier exécutable : + Nom : + Portée : + Commit + Repository Adresse e-mail Adresse e-mail GIT Fetch les dépôts distants automatiquement minute(s) + Dépôt par défaut + Activer --prune pour fetch + Activer --signoff pour commit SUIVI DES PROBLÈMES Ajouter une règle d'exemple Github Ajouter une règle d'exemple Jira + Ajouter une règle d'exemple pour Incidents GitLab + Ajouter une règle d'exemple pour Merge Request GitLab Nouvelle règle Issue Regex Expression: Nom de règle : - Veuillez utiliser $1, $2 pour accéder aux valeurs des groupes regex. 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é. Proxy HTTP Proxy HTTP utilisé par ce dépôt Nom d'utilisateur Nom d'utilisateur pour ce dépôt + Espaces de travail + Couleur + Restaurer les onglets au démarrage + Assistant Commits Conventionnels + Changement Radical : + Incident Clos : + Détail des Modifications : + Portée : + Courte Description : + Type de Changement : Copier Copier tout le texte Copier le nom de fichier @@ -198,10 +235,12 @@ ANCIEN Copier Mode de fichier changé + Ignorer les changements d'espaces CHANGEMENT D'OBJET LFS Différence suivante PAS DE CHANGEMENT OU SEULEMENT EN FIN DE LIGNE Différence précédente + Enregistrer en tant que patch Afficher les caractères invisibles Diff côte-à-côte SOUS-MODULE @@ -210,6 +249,7 @@ Coloration syntaxique Retour à la ligne Ouvrir dans l'outil de fusion + Voir toutes les lignes Réduit le nombre de ligne visibles Augmente le nombre de ligne visibles SÉLECTIONNEZ UN FICHIER POUR VOIR LES CHANGEMENTS @@ -217,6 +257,7 @@ Rejeter les changements Tous les changements dans la copie de travail. Changements : + Inclure les fichiers ignorés {0} changements seront rejetés Vous ne pouvez pas annuler cette action !!! Signet : @@ -224,6 +265,8 @@ Cible : Éditer le groupe sélectionné Éditer le dépôt sélectionné + Lancer action personnalisée + Nom de l'action : Fast-Forward (sans checkout) Fetch Fetch toutes les branches distantes @@ -248,63 +291,69 @@ Utiliser les leurs (checkout --theirs) Historique du fichier CONTENU + MODIFICATION FILTRER Git-Flow - Development Branch: + Branche de développement : Feature: Feature Prefix: - FLOW - Finish Feature - FLOW - Finish Hotfix - FLOW - Finish Release - Target: + FLOW - Terminer Feature + FLOW - Terminer Hotfix + FLOW - Terminer Release + Cible: Hotfix: Hotfix Prefix: - Initialize Git-Flow - Keep branch - Production Branch: - Release: - Release Prefix: - Start Feature... - FLOW - Start Feature - Start Hotfix... - FLOW - Start Hotfix - Enter name - Start Release... - FLOW - Start Release - Version Tag Prefix: + Initialiser Git-Flow + Garder la branche + Branche de production : + Release : + Release Prefix : + Commencer Feature... + FLOW - Commencer Feature + Commencer Hotfix... + FLOW - Commencer Hotfix + Saisir le nom + Commencer Release... + FLOW - Commencer Release + Préfixe Tag de Version : Git LFS - Add Track Pattern... - Pattern is file name - Custom Pattern: - Add Track Pattern to Git LFS + Ajouter un pattern de suivi... + Le pattern est un nom de fichier + Pattern personnalisé : + Ajouter un pattern de suivi à Git LFS Fetch - Fetch LFS Objects - Run `git lfs fetch` to download Git LFS objects. This does not update the working copy. - Install Git LFS hooks - Show Locks - No Locked Files - Lock - LFS Locks - Unlock - Force Unlock + Fetch les objets LFS + Lancer `git lfs fetch` pour télécharger les objets Git LFS. Cela ne met pas à jour la copie de travail. + Installer les hooks Git LFS + Afficher les verrous + Pas de fichiers verrouillés + Verrouiller + Afficher seulement mes verrous + Verrous LFS + Déverouiller + Forcer le déverouillage Prune - Run `git lfs prune` to delete old LFS files from local storage + Lancer `git lfs prune` pour supprimer les anciens fichier LFS du stockage local Pull - Pull LFS Objects - Run `git lfs pull` to download all Git LFS files for current ref & checkout + Pull les objets LFS + Lancer `git lfs pull` pour télécharger tous les fichier Git LFS de la référence actuelle & checkout Push - Push LFS Objects - Push queued large files to the Git LFS endpoint - Remote: - Track files named '{0}' - Track all *{0} files + Push les objets LFS + Transférer les fichiers volumineux en file d'attente vers le point de terminaison Git LFS + Dépôt : + Suivre les fichiers appelés '{0}' + Suivre tous les fichiers *{0} Historique Basculer entre dispositions Horizontal/Vertical AUTEUR + HEURE DE L'AUTEUR GRAPHE & SUJET SHA HEURE DE COMMIT {0} COMMITS SÉLECTIONNÉS + Maintenir 'Ctrl' ou 'Shift' enfoncée pour sélectionner plusieurs commits. + Maintenir ⌘ ou ⇧ enfoncée pour sélectionner plusieurs commits. + CONSEILS: Référence des raccourcis clavier GLOBAL Annuler le popup en cours @@ -316,7 +365,13 @@ DÉPÔT Commit les changements de l'index Commit et pousser les changements de l'index + Ajouter tous les changements et commit + Créer une nouvelle branche basée sur le commit actuel + Rejeter les changements sélectionnés + Fetch, démarre directement Mode tableau de bord (Défaut) + Pull, démarre directement + Push, démarre directement Forcer le rechargement du dépôt Ajouter/Retirer les changements sélectionnés de l'index Recherche de commit @@ -331,26 +386,30 @@ Stage Retirer de l'index Rejeter - Initialize Repository - Path: - Cherry-Pick in progress. Press 'Abort' to restore original HEAD. - Merge request in progress. Press 'Abort' to restore original HEAD. - Rebase in progress. Press 'Abort' to restore original HEAD. - Revert in progress. Press 'Abort' to restore original HEAD. - Interactive Rebase - Target Branch: - On: - ERROR + Initialiser le repository + Chemin : + Cherry-Pick en cours. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. + Merge request in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. + Rebase in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. + Revert in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. + Rebase interactif + Branche cible : + Sur : + Ouvrir dans le navigateur + Copier le lien + ERREUR NOTICE - Merge Branch - Into: - Merge Option: - Source Branch: + Merger la branche + Dans : + Option de merge: + Branche source : + Déplacer le noeud du repository + Sélectionnier le noeud parent pour : Nom : Git n'a PAS été configuré. Veuillez d'abord le faire dans le menu Préférence. Ouvrir le dossier AppData - Open With... - Optional. + Ouvrir avec... + Optionnel. Créer un nouvel onglet Bookmark Fermer l'onglet @@ -369,8 +428,17 @@ L'an dernier il y a {0} ans Préférences + IA + Analyser Diff Prompt + Clé d'API + Générer le sujet de Prompt + Modèle + Nom + Serveur APPARENCE Police par défaut + Taille de police par défaut + Taille de police de l'éditeur Police monospace N'utiliser que des polices monospace pour l'éditeur de texte Thème @@ -385,6 +453,7 @@ Vérifier les mises à jour au démarrage Language Historique de commits + Afficher l'heure de l'auteur au lieu de l'heure de validation dans le graphique Guide de longueur du sujet GIT Activer auto CRLF @@ -404,6 +473,10 @@ Saisir le chemin d'installation vers le programme GPG Clé de signature de l'utilisateur Clé de signature GPG de l'utilisateur + INTEGRATION + SHELL/TERMINAL + Shell/Terminal + Chemin Élaguer une branche distant Cible : Élaguer les Worktrees @@ -417,87 +490,92 @@ Ne rien faire Stash & Réappliquer Fetch sans les tags - Distant : + Dépôt distant : Pull (Fetch & Merge) - Use rebase instead of merge + Utiliser rebase au lieu de merge Push - Make sure submodules have been pushed + Assurez-vous que les submodules ont été poussés Force push - Local Branch: - Remote: - Push Changes To Remote - Remote Branch: - Set as tracking branch - Push all tags + Branche locale : + Dépôt distant : + Pousser les changements vers le dépôt distant + Branche distante : + Définir comme branche de suivi + Push tous les tags Push Tag To Remote - Push to all remotes - Remote: - Tag: - Quit - Rebase Current Branch - Stash & reapply local changes - On: - Rebase: - Refresh - Add Remote - Edit Remote - Name: - Remote name - Repository URL: - Remote git repository URL - Copy URL - Delete... - Edit... + Push tous les dépôts distants + Dépôt distant : + Tag : + Quitter + Rebase la branche actuelle + Stash & réappliquer changements locaux + Sur : + Rebase : + Rafraîchir + Ajouter dépôt distant + Modifier dépôt distant + Nom : + Nom du dépôt distant + URL du repository : + URL du dépôt distant + Copier l'URL + Supprimer... + Editer... Fetch - Open In Browser + Ouvrir dans le navigateur Prune - Confirm to Remove Worktree - Enable `--force` Option - Target: - Rename Branch - New Name: - Unique name for this branch - Branch: + Confirmer la suppression du Worktree + Activer l'option `--force` + Cible : + la branche + Nouveau nom : + Nom unique pour cette branche + Branche : ABORT - Cleanup(GC & Prune) - Run `git gc` command for this repository. - Clear all - Configure this repository - CONTINUE + Fetch automatique des changements depuis les dépôts... + Nettoyage(GC & Prune) + Lancer `git gc` pour ce repository. + Tout effacer + Configurer ce repository + CONTINUER Ouvrir dans l'explorateur Windows - Search Branches/Tags/Submodules - FILTERED BY: - LOCAL BRANCHES - Navigate To HEAD - Enable '--first-parent' Option - Create Branch - Open In {0} - Open In External Tools - Refresh - REMOTES - ADD REMOTE - RESOLVE - Search Commit - File + Pas d'actions personnalisées + Activer l'option '--reflog' + Ouvrir dans l'explorateur de fichiers + Rechercher Branches/Tags/Submodules + FILTRE PAR : + BRANCHES LOCALES + Naviguer vers le HEAD + Activer l'option '--first-parent' + Créer une branche + Ouvrir dans {0} + Ouvrir dans un outil externe + Rafraîchir + DEPOTS DISTANTS + AJOUTER DEPOT DISTANT + RESOUDRE + Rechercher un commit + Fichier Message SHA - Author & Committer - Show Tags as Tree - Statistics + Auteur & Committer + Branche actuelle + Voir les Tags en tant qu'arbre + Statistiques SUBMODULES - ADD SUBMODULE - UPDATE SUBMODULE + AJOUTER SUBMODULE + METTRE A JOUR SUBMODULE TAGS - NEW TAG + NOUVEAU TAG Ouvrir dans un terminal WORKTREES - ADD WORKTREE + AJOUTER WORKTREE PRUNE - Git Repository URL - Reset Current Branch To Revision + URL du repository Git + Reset branche actuelle à la révision Reset Mode: - Move To: - Current Branch: + Déplacer vers : + Branche actuelle : Ouvrir dans l'explorateur de fichier Revert le Commit Commit : @@ -509,6 +587,8 @@ Sauvegarder en tant que... Le patch a été sauvegardé ! Vérifier les mises à jour... + Dossier racine : + Rechercher des mises à jour... Une nouvelle version du logiciel est disponible : La vérification de mise à jour à échouée ! Télécharger @@ -516,13 +596,17 @@ Mise à jour du logiciel Il n'y a pas de mise à jour pour le moment. Squash Commits + Dans : SSH Private Key: Private SSH key store path START Stash Include untracked files - Message: + Garder les fichiers staged + Message : Optionnel. Nom de ce stash + Seulement les changements staged + Les modifications staged et unstaged des fichiers sélectionnés seront stockées!!! Stash les changements locaux Appliquer Effacer @@ -539,6 +623,7 @@ WEEK COMMITS: AUTHORS: + APERCU SUBMODULES Add Submodule Copy Relative Path @@ -549,6 +634,7 @@ Delete Submodule OK Copy Tag Name + Copier le message du tag Delete ${0}$... Fusionner ${0}$ dans ${1}$... Push ${0}$... @@ -567,9 +653,11 @@ Supprimer GLISSER / DEPOSER DE DOSSIER SUPPORTÉ. GROUPAGE PERSONNALISÉ SUPPORTÉ. Éditer + Déplacer vers un autre groupe Ouvrir tous les dépôts Ouvrir un dépôt Ouvrir le terminal + Réanalyser les repositories dans le dossier de clonage par défaut Chercher des dépôts... Trier Changements @@ -583,6 +671,9 @@ COMMIT COMMIT & PUSH Modèles/Historiques + Trigger click event + Stage tous les changements et commit + Un commit vide a été détecté ! Voulez-vous continuer (--allow-empty) ? CONFLITS DÉTECTÉS LES CONFLITS DE FICHIER SONT RÉSOLUS INCLURE LES FICHIERS NON-SUIVIS @@ -597,6 +688,8 @@ VOIR LES FICHIERS PRÉSUMÉS INCHANGÉS Modèle: ${0}$ Faites un clique droit sur les fichiers sélectionnés et faites vos choix pour la résoluion des conflits. + ESPACE DE TRAVAIL : + Configurer les espaces de travail... WORKTREE Copier le chemin Verrouiller From 3c5a4741bfb67e4583b1f2c36ec2e59f0f835406 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 14 Nov 2024 01:18:29 +0000 Subject: [PATCH 18/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85e3ae64..71643636 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.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.31%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-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-100.00%25-brightgreen)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.85%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-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 812a117b..93ee2875 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -20,12 +20,20 @@ -### fr_FR.axaml: 86.31% +### fr_FR.axaml: 98.85%
Missing Keys +- Text.CherryPick.AppendSourceToMessage +- Text.CherryPick.Mainline.Tips +- Text.CommitCM.CherryPickMultiple +- Text.Preference.Appearance.FontSize +- Text.Preference.Appearance.FontSize.Default +- Text.Preference.Appearance.FontSize.Editor +- Text.Repository.CustomActions +- Text.ScanRepositories
From e3ffe3ef6cb69d761e026772c42e15abb803d121 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 14 Nov 2024 14:56:21 +0800 Subject: [PATCH 19/53] enhance: supports Azure OpenAI REST API (#695) Signed-off-by: leo --- src/Models/OpenAI.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Models/OpenAI.cs b/src/Models/OpenAI.cs index e9c7b5ed..0a83d8dc 100644 --- a/src/Models/OpenAI.cs +++ b/src/Models/OpenAI.cs @@ -155,7 +155,12 @@ namespace SourceGit.Models var client = new HttpClient() { Timeout = TimeSpan.FromSeconds(60) }; if (!string.IsNullOrEmpty(ApiKey)) - client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}"); + { + if (Server.Contains("openai.azure.com/", StringComparison.Ordinal)) + client.DefaultRequestHeaders.Add("api-key", ApiKey); + else + client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}"); + } var req = new StringContent(JsonSerializer.Serialize(chat, JsonCodeGen.Default.OpenAIChatRequest), Encoding.UTF8, "application/json"); try From ca5bc4b4dfec6a6e210bb28d02422f3b354abc01 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 13 Nov 2024 21:45:28 +0800 Subject: [PATCH 20/53] refactor: rewrite the histories filter function to supports both `include` and `exclude` modes (#690) Signed-off-by: leo --- src/Converters/FilterModeConverters.cs | 22 ++ src/Models/Filter.cs | 60 +++++ src/Models/RepositorySettings.cs | 184 ++++++++++++- src/Models/Tag.cs | 21 +- src/Models/Watcher.cs | 17 +- src/Resources/Locales/de_DE.axaml | 3 +- src/Resources/Locales/en_US.axaml | 6 +- src/Resources/Locales/es_ES.axaml | 3 +- src/Resources/Locales/fr_FR.axaml | 3 +- src/Resources/Locales/pt_BR.axaml | 3 +- src/Resources/Locales/ru_RU.axaml | 3 +- src/Resources/Locales/zh_CN.axaml | 6 +- src/Resources/Locales/zh_TW.axaml | 6 +- src/Resources/Styles.axaml | 29 --- src/ViewModels/BranchTreeNode.cs | 62 ++--- src/ViewModels/Checkout.cs | 2 +- src/ViewModels/CreateBranch.cs | 2 +- src/ViewModels/RenameBranch.cs | 16 +- src/ViewModels/Repository.cs | 156 ++++------- src/ViewModels/TagCollection.cs | 10 - src/Views/BranchTree.axaml | 17 +- src/Views/BranchTree.axaml.cs | 39 --- src/Views/FilterModeSwitchButton.axaml | 32 +++ src/Views/FilterModeSwitchButton.axaml.cs | 299 ++++++++++++++++++++++ src/Views/Repository.axaml | 20 +- src/Views/TagsView.axaml | 38 ++- src/Views/TagsView.axaml.cs | 17 -- 27 files changed, 767 insertions(+), 309 deletions(-) create mode 100644 src/Converters/FilterModeConverters.cs create mode 100644 src/Models/Filter.cs create mode 100644 src/Views/FilterModeSwitchButton.axaml create mode 100644 src/Views/FilterModeSwitchButton.axaml.cs diff --git a/src/Converters/FilterModeConverters.cs b/src/Converters/FilterModeConverters.cs new file mode 100644 index 00000000..402a287d --- /dev/null +++ b/src/Converters/FilterModeConverters.cs @@ -0,0 +1,22 @@ +using Avalonia.Data.Converters; +using Avalonia.Media; + +namespace SourceGit.Converters +{ + public static class FilterModeConverters + { + public static readonly FuncValueConverter ToBorderBrush = + new FuncValueConverter(v => + { + switch (v) + { + case Models.FilterMode.Included: + return Brushes.Green; + case Models.FilterMode.Excluded: + return Brushes.Red; + default: + return Brushes.Transparent; + } + }); + } +} diff --git a/src/Models/Filter.cs b/src/Models/Filter.cs new file mode 100644 index 00000000..8ffd27c7 --- /dev/null +++ b/src/Models/Filter.cs @@ -0,0 +1,60 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace SourceGit.Models +{ + public enum FilterType + { + LocalBranch = 0, + LocalBranchFolder, + RemoteBranch, + RemoteBranchFolder, + Tag, + } + + public enum FilterMode + { + None = 0, + Included, + Excluded, + } + + public class Filter : ObservableObject + { + public string Pattern + { + get => _pattern; + set => SetProperty(ref _pattern, value); + } + + public FilterType Type + { + get; + set; + } = FilterType.LocalBranch; + + public FilterMode Mode + { + get => _mode; + set => SetProperty(ref _mode, value); + } + + public bool IsBranch + { + get => Type != FilterType.Tag; + } + + public Filter() + { + } + + public Filter(string pattern, FilterType type, FilterMode mode) + { + _pattern = pattern; + _mode = mode; + Type = type; + } + + private string _pattern = string.Empty; + private FilterMode _mode = FilterMode.None; + } +} diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index 77c58ee7..f5f02e46 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -1,4 +1,9 @@ -using Avalonia.Collections; +using System; +using System.Collections.Generic; +using System.Text; + +using Avalonia.Collections; +using Avalonia.Threading; namespace SourceGit.Models { @@ -76,11 +81,11 @@ namespace SourceGit.Models set; } = true; - public AvaloniaList Filters + public AvaloniaList HistoriesFilters { get; set; - } = new AvaloniaList(); + } = new AvaloniaList(); public AvaloniaList CommitTemplates { @@ -148,6 +153,179 @@ namespace SourceGit.Models set; } = "---"; + public FilterMode GetHistoriesFilterMode(string pattern, FilterType type) + { + foreach (var filter in HistoriesFilters) + { + if (filter.Type != type) + continue; + + if (filter.Pattern.Equals(pattern, StringComparison.Ordinal)) + return filter.Mode; + } + + return FilterMode.None; + } + + public bool UpdateHistoriesFilter(string pattern, FilterType type, FilterMode mode) + { + for (int i = 0; i < HistoriesFilters.Count; i++) + { + var filter = HistoriesFilters[i]; + if (filter.Type != type) + continue; + + if (filter.Pattern.Equals(pattern, StringComparison.Ordinal)) + { + if (mode == FilterMode.None) + { + HistoriesFilters.RemoveAt(i); + return true; + } + + if (mode != filter.Mode) + { + filter.Mode = mode; + return true; + } + } + } + + if (mode != FilterMode.None) + { + HistoriesFilters.Add(new Filter(pattern, type, mode)); + return true; + } + + return false; + } + + public string BuildHistoriesFilter() + { + var builder = new StringBuilder(); + + var excludedBranches = new List(); + var excludedRemotes = new List(); + var excludedTags = new List(); + var includedBranches = new List(); + var includedRemotes = new List(); + var includedTags = new List(); + foreach (var filter in HistoriesFilters) + { + if (filter.Type == FilterType.LocalBranch) + { + var name = filter.Pattern.Substring(11); + var b = $"{name.Substring(0, name.Length - 1)}[{name[^1]}]"; + + if (filter.Mode == FilterMode.Included) + includedBranches.Add(b); + else if (filter.Mode == FilterMode.Excluded) + excludedBranches.Add(b); + } + else if (filter.Type == FilterType.LocalBranchFolder) + { + if (filter.Mode == FilterMode.Included) + includedBranches.Add($"{filter.Pattern.Substring(11)}/*"); + else if (filter.Mode == FilterMode.Excluded) + excludedBranches.Add($"{filter.Pattern.Substring(11)}/*"); + } + else if (filter.Type == FilterType.RemoteBranch) + { + var name = filter.Pattern.Substring(13); + var r = $"{name.Substring(0, name.Length - 1)}[{name[^1]}]"; + + if (filter.Mode == FilterMode.Included) + includedRemotes.Add(r); + else if (filter.Mode == FilterMode.Excluded) + excludedRemotes.Add(r); + } + else if (filter.Type == FilterType.RemoteBranchFolder) + { + if (filter.Mode == FilterMode.Included) + includedRemotes.Add($"{filter.Pattern.Substring(13)}/*"); + else if (filter.Mode == FilterMode.Excluded) + excludedRemotes.Add($"{filter.Pattern.Substring(13)}/*"); + } + else if (filter.Type == FilterType.Tag) + { + var name = filter.Pattern; + var t = $"{name.Substring(0, name.Length - 1)}[{name[^1]}]"; + + if (filter.Mode == FilterMode.Included) + includedTags.Add(t); + else if (filter.Mode == FilterMode.Excluded) + excludedTags.Add(t); + } + } + + foreach (var b in excludedBranches) + { + builder.Append("--exclude="); + builder.Append(b); + builder.Append(' '); + } + + if (includedBranches.Count > 0) + { + foreach (var b in includedBranches) + { + builder.Append("--branches="); + builder.Append(b); + builder.Append(' '); + } + } + else if (excludedBranches.Count > 0 || (includedRemotes.Count == 0 && includedTags.Count == 0)) + { + builder.Append("--exclude=HEA[D] "); + builder.Append("--branches "); + } + + foreach (var r in excludedRemotes) + { + builder.Append("--exclude="); + builder.Append(r); + builder.Append(' '); + } + + if (includedRemotes.Count > 0) + { + foreach (var r in includedRemotes) + { + builder.Append("--remotes="); + builder.Append(r); + builder.Append(' '); + } + } + else if (excludedRemotes.Count > 0 || (includedBranches.Count == 0 && includedTags.Count == 0)) + { + builder.Append("--exclude=origin/HEA[D] "); + builder.Append("--remotes "); + } + + foreach (var t in excludedTags) + { + builder.Append("--exclude="); + builder.Append(t); + builder.Append(' '); + } + + if (includedTags.Count > 0) + { + foreach (var t in includedTags) + { + builder.Append("--tags="); + builder.Append(t); + builder.Append(' '); + } + } + else if (excludedTags.Count > 0 || (includedBranches.Count == 0 && includedRemotes.Count == 0)) + { + builder.Append("--tags "); + } + + return builder.ToString(); + } + public void PushCommitMessage(string message) { var existIdx = CommitMessages.IndexOf(message); diff --git a/src/Models/Tag.cs b/src/Models/Tag.cs index 2ec9e093..2e8f2c8e 100644 --- a/src/Models/Tag.cs +++ b/src/Models/Tag.cs @@ -1,10 +1,19 @@ -namespace SourceGit.Models +using CommunityToolkit.Mvvm.ComponentModel; + +namespace SourceGit.Models { - public class Tag + public class Tag : ObservableObject { - public string Name { get; set; } - public string SHA { get; set; } - public string Message { get; set; } - public bool IsFiltered { get; set; } + public string Name { get; set; } = string.Empty; + public string SHA { get; set; } = string.Empty; + public string Message { get; set; } = string.Empty; + + public FilterMode FilterMode + { + get => _filterMode; + set => SetProperty(ref _filterMode, value); + } + + private FilterMode _filterMode = FilterMode.None; } } diff --git a/src/Models/Watcher.cs b/src/Models/Watcher.cs index 6665250c..710b307d 100644 --- a/src/Models/Watcher.cs +++ b/src/Models/Watcher.cs @@ -113,22 +113,11 @@ namespace SourceGit.Models if (_updateTags > 0) { _updateTags = 0; - Task.Run(() => - { - _repo.RefreshTags(); - _repo.RefreshBranches(); - _repo.RefreshCommits(); - }); - } - else - { - Task.Run(() => - { - _repo.RefreshBranches(); - _repo.RefreshCommits(); - }); + Task.Run(_repo.RefreshTags); } + Task.Run(_repo.RefreshBranches); + Task.Run(_repo.RefreshCommits); Task.Run(_repo.RefreshWorkingCopyChanges); Task.Run(_repo.RefreshWorktrees); } diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index ae2e89d7..4e94bb67 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -292,7 +292,6 @@ Datei Historie INHALT ÄNDERUNGEN - FILTER Git-Flow Development-Branch: Feature: @@ -544,7 +543,7 @@ Aktiviere '--reflog' Option Öffne im Datei-Browser Suche Branches/Tags/Submodule - GEFILTERT: + GEFILTERT: LOKALE BRANCHES Zum HEAD wechseln Aktiviere '--first-parent' Option diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 281f13a3..da860d05 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -289,7 +289,6 @@ File History CONTENT CHANGE - FILTER Git-Flow Development Branch: Feature: @@ -541,7 +540,10 @@ Enable '--reflog' Option Open in File Browser Search Branches/Tags/Submodules - FILTERED BY: + Unset (Default) + Hide in commit graph + Filter in commit graph + FILTERED BY: LOCAL BRANCHES Navigate to HEAD Enable '--first-parent' Option diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 365cebfb..5e3ed9a9 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -294,7 +294,6 @@ Historial de Archivos CONTENIDO CAMBIO - FILTRO Git-Flow Rama de Desarrollo: Feature: @@ -542,7 +541,7 @@ Habilitar Opción '--reflog' Abrir en el Explorador Buscar Ramas/Etiquetas/Submódulos - FILTRAR POR: + FILTRAR POR: RAMAS LOCALES Navegar a HEAD Habilitar Opción '--first-parent' diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index e1562523..c07a6ee5 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -292,7 +292,6 @@ Historique du fichier CONTENU MODIFICATION - FILTRER Git-Flow Branche de développement : Feature: @@ -543,7 +542,7 @@ Activer l'option '--reflog' Ouvrir dans l'explorateur de fichiers Rechercher Branches/Tags/Submodules - FILTRE PAR : + FILTRE PAR : BRANCHES LOCALES Naviguer vers le HEAD Activer l'option '--first-parent' diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index ecd1654c..987b3398 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -317,7 +317,6 @@ Histórico de Arquivos CONTEUDO MUDANÇA - FILTRO Branch de Desenvolvimento: Feature: Prefixo da Feature: @@ -566,7 +565,7 @@ Habilitar opção '--reflog' Abrir no Navegador de Arquivos Pesquisar Branches/Tags/Submódulos - FILTRADO POR: + FILTRADO POR: Habilitar opção '--first-parent' BRANCHES LOCAIS Navegar para HEAD diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index ac94ee77..e86dbbe7 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -293,7 +293,6 @@ История файлов СОДЕРЖИМОЕ ИЗМЕНИТЬ - ФИЛЬТР Git-поток Ветка разработчика: Свойство: @@ -545,7 +544,7 @@ Разрешить опцию --reflog Открыть в файловом менеджере Поиск веток, меток и подмодулей - ОТФИЛЬТРОВАНО: + ОТФИЛЬТРОВАНО: ЛОКАЛЬНЫЕ ВЕТКИ Навигация по заголовку Включить опцию --first-parent diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 5b1f1403..4fd32a37 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -292,7 +292,6 @@ 文件历史 文件内容 文件变更 - 过滤 GIT工作流 开发分支 : 特性分支 : @@ -545,7 +544,10 @@ 启用 --reflog 选项 在文件浏览器中打开 快速查找分支/标签/子模块 - 过滤规则 : + 未指定(默认行为) + 在提交列表中隐藏 + 使用其对提交列表过滤 + 过滤规则 : 本地分支 定位HEAD 启用 --first-parent 过滤选项 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 0587f089..b5d9aea8 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -292,7 +292,6 @@ 檔案歷史 檔案内容 檔案變更 - 篩選 Git 工作流 開發分支: 功能分支: @@ -544,7 +543,10 @@ 啟用 [--reflog] 選項 在檔案瀏覽器中開啟 快速搜尋分支/標籤/子模組 - 篩選規則: + 未指定 (預設) + 在提交清單中隱藏 + 使用其來篩選提交清單 + 篩選規則: 本機分支 回到 HEAD 啟用 [--first-parent] 選項 diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 88aca6b0..8fdfaa3c 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -1038,35 +1038,6 @@ - - - - + + @@ -67,15 +71,10 @@ Foreground="{DynamicResource Brush.BadgeFG}" Background="{DynamicResource Brush.Badge}"/> - - + +
diff --git a/src/Views/BranchTree.axaml.cs b/src/Views/BranchTree.axaml.cs index e96b2594..92c2b043 100644 --- a/src/Views/BranchTree.axaml.cs +++ b/src/Views/BranchTree.axaml.cs @@ -428,28 +428,6 @@ namespace SourceGit.Views } } - private void OnToggleFilterClicked(object sender, RoutedEventArgs e) - { - if (DataContext is ViewModels.Repository repo && - sender is ToggleButton toggle && - toggle.DataContext is ViewModels.BranchTreeNode { Backend: Models.Branch branch } node) - { - bool filtered = toggle.IsChecked == true; - List filters = [branch.FullName]; - if (branch.IsLocal && !string.IsNullOrEmpty(branch.Upstream)) - { - filters.Add(branch.Upstream); - - node.IsFiltered = filtered; - UpdateUpstreamFilterState(repo.RemoteBranchTrees, branch.Upstream, filtered); - } - - repo.UpdateFilters(filters, filtered); - } - - e.Handled = true; - } - private void MakeRows(List rows, List nodes, int depth) { foreach (var node in nodes) @@ -477,23 +455,6 @@ namespace SourceGit.Views CollectBranchesInNode(outs, sub); } - private bool UpdateUpstreamFilterState(List collection, string upstream, bool isFiltered) - { - foreach (var node in collection) - { - if (node.Backend is Models.Branch b && b.FullName == upstream) - { - node.IsFiltered = isFiltered; - return true; - } - - if (node.Backend is Models.Remote r && upstream.StartsWith($"refs/remotes/{r.Name}/", StringComparison.Ordinal)) - return UpdateUpstreamFilterState(node.Children, upstream, isFiltered); - } - - return false; - } - private bool _disableSelectionChangingEvent = false; } } diff --git a/src/Views/FilterModeSwitchButton.axaml b/src/Views/FilterModeSwitchButton.axaml new file mode 100644 index 00000000..0fbbbf8e --- /dev/null +++ b/src/Views/FilterModeSwitchButton.axaml @@ -0,0 +1,32 @@ + + + diff --git a/src/Views/FilterModeSwitchButton.axaml.cs b/src/Views/FilterModeSwitchButton.axaml.cs new file mode 100644 index 00000000..e8e4ad6a --- /dev/null +++ b/src/Views/FilterModeSwitchButton.axaml.cs @@ -0,0 +1,299 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.VisualTree; + +namespace SourceGit.Views +{ + public partial class FilterModeSwitchButton : UserControl + { + public static readonly StyledProperty ModeProperty = + AvaloniaProperty.Register(nameof(Mode)); + + public Models.FilterMode Mode + { + get => GetValue(ModeProperty); + set => SetValue(ModeProperty, value); + } + + public static readonly StyledProperty IsNoneVisibleProperty = + AvaloniaProperty.Register(nameof(IsNoneVisible)); + + public bool IsNoneVisible + { + get => GetValue(IsNoneVisibleProperty); + set => SetValue(IsNoneVisibleProperty, value); + } + + public static readonly StyledProperty IsContextMenuOpeningProperty = + AvaloniaProperty.Register(nameof(IsContextMenuOpening)); + + public bool IsContextMenuOpening + { + get => GetValue(IsContextMenuOpeningProperty); + set => SetValue(IsContextMenuOpeningProperty, value); + } + + public FilterModeSwitchButton() + { + IsVisible = false; + InitializeComponent(); + } + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == ModeProperty || + change.Property == IsNoneVisibleProperty || + change.Property == IsContextMenuOpeningProperty) + { + var visible = (Mode != Models.FilterMode.None || IsNoneVisible || IsContextMenuOpening); + SetCurrentValue(IsVisibleProperty, visible); + } + } + + private void OnChangeFilterModeButtonClicked(object sender, RoutedEventArgs e) + { + var repoView = this.FindAncestorOfType(); + if (repoView == null) + return; + + var repo = repoView.DataContext as ViewModels.Repository; + if (repo == null) + return; + + var button = sender as Button; + if (button == null) + return; + + if (DataContext is Models.Tag tag) + { + var mode = tag.FilterMode; + + var none = new MenuItem(); + none.Icon = App.CreateMenuIcon("Icons.Eye"); + none.Header = App.Text("Repository.FilterCommits.Default"); + none.IsEnabled = mode != Models.FilterMode.None; + none.Click += (_, ev) => + { + UpdateTagFilterMode(repo, tag, Models.FilterMode.None); + ev.Handled = true; + }; + + var include = new MenuItem(); + include.Icon = App.CreateMenuIcon("Icons.Filter"); + include.Header = App.Text("Repository.FilterCommits.Include"); + include.IsEnabled = mode != Models.FilterMode.Included; + include.Click += (_, ev) => + { + UpdateTagFilterMode(repo, tag, Models.FilterMode.Included); + ev.Handled = true; + }; + + var exclude = new MenuItem(); + exclude.Icon = App.CreateMenuIcon("Icons.EyeClose"); + exclude.Header = App.Text("Repository.FilterCommits.Exclude"); + exclude.IsEnabled = mode != Models.FilterMode.Excluded; + exclude.Click += (_, ev) => + { + UpdateTagFilterMode(repo, tag, Models.FilterMode.Excluded); + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(none); + menu.Items.Add(include); + menu.Items.Add(exclude); + + if (mode == Models.FilterMode.None) + { + IsContextMenuOpening = true; + menu.Closed += (_, _) => IsContextMenuOpening = false; + } + + menu.Open(button); + } + else if (DataContext is ViewModels.BranchTreeNode node) + { + var mode = node.FilterMode; + + var none = new MenuItem(); + none.Icon = App.CreateMenuIcon("Icons.Eye"); + none.Header = App.Text("Repository.FilterCommits.Default"); + none.IsEnabled = mode != Models.FilterMode.None; + none.Click += (_, ev) => + { + UpdateBranchFilterMode(repo, node, Models.FilterMode.None); + ev.Handled = true; + }; + + var include = new MenuItem(); + include.Icon = App.CreateMenuIcon("Icons.Filter"); + include.Header = App.Text("Repository.FilterCommits.Include"); + include.IsEnabled = mode != Models.FilterMode.Included; + include.Click += (_, ev) => + { + UpdateBranchFilterMode(repo, node, Models.FilterMode.Included); + ev.Handled = true; + }; + + var exclude = new MenuItem(); + exclude.Icon = App.CreateMenuIcon("Icons.EyeClose"); + exclude.Header = App.Text("Repository.FilterCommits.Exclude"); + exclude.IsEnabled = mode != Models.FilterMode.Excluded; + exclude.Click += (_, ev) => + { + UpdateBranchFilterMode(repo, node, Models.FilterMode.Excluded); + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(none); + menu.Items.Add(include); + menu.Items.Add(exclude); + + if (mode == Models.FilterMode.None) + { + IsContextMenuOpening = true; + menu.Closed += (_, _) => IsContextMenuOpening = false; + } + + menu.Open(button); + } + + e.Handled = true; + } + + private void UpdateTagFilterMode(ViewModels.Repository repo, Models.Tag tag, Models.FilterMode mode) + { + var changed = repo.Settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode); + if (changed) + { + tag.FilterMode = mode; + Task.Run(repo.RefreshCommits); + } + } + + private void UpdateBranchFilterMode(ViewModels.Repository repo, ViewModels.BranchTreeNode node, Models.FilterMode mode) + { + var isLocal = node.Path.StartsWith("refs/heads/", StringComparison.Ordinal); + var type = isLocal ? Models.FilterType.LocalBranch : Models.FilterType.RemoteBranch; + var tree = isLocal ? repo.LocalBranchTrees : repo.RemoteBranchTrees; + + if (node.Backend is Models.Branch branch) + { + var changed = repo.Settings.UpdateHistoriesFilter(node.Path, type, mode); + if (!changed) + return; + + node.FilterMode = mode; + + // Try to update its upstream. + if (isLocal && !string.IsNullOrEmpty(branch.Upstream) && mode != Models.FilterMode.Excluded) + { + var upstream = branch.Upstream; + var upstreamNode = FindBranchNode(repo.RemoteBranchTrees, upstream); + if (upstreamNode != null) + { + var canUpdateUpstream = true; + foreach (var filter in repo.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) + { + changed = repo.Settings.UpdateHistoriesFilter(upstream, Models.FilterType.RemoteBranch, mode); + if (changed) + upstreamNode.FilterMode = mode; + } + } + } + } + else + { + var changed = repo.Settings.UpdateHistoriesFilter(node.Path, isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder, mode); + if (!changed) + return; + + node.FilterMode = mode; + ResetChildrenBranchNodeFilterMode(repo, node, isLocal); + } + + var parentType = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder; + var cur = node; + do + { + var lastSepIdx = cur.Path.LastIndexOf('/'); + if (lastSepIdx <= 0) + break; + + var parentPath = cur.Path.Substring(0, lastSepIdx); + var parent = FindBranchNode(tree, parentPath); + if (parent == null) + break; + + repo.Settings.UpdateHistoriesFilter(parent.Path, parentType, Models.FilterMode.None); + parent.FilterMode = Models.FilterMode.None; + cur = parent; + } while (true); + + Task.Run(repo.RefreshCommits); + } + + private void ResetChildrenBranchNodeFilterMode(ViewModels.Repository repo, ViewModels.BranchTreeNode node, bool isLocal) + { + foreach (var child in node.Children) + { + child.FilterMode = Models.FilterMode.None; + + if (child.IsBranch) + { + var type = isLocal ? Models.FilterType.LocalBranch : Models.FilterType.RemoteBranch; + repo.Settings.UpdateHistoriesFilter(child.Path, type, Models.FilterMode.None); + } + else + { + var type = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder; + repo.Settings.UpdateHistoriesFilter(child.Path, type, Models.FilterMode.None); + ResetChildrenBranchNodeFilterMode(repo, child, isLocal); + } + } + } + + private ViewModels.BranchTreeNode FindBranchNode(List nodes, string path) + { + foreach (var node in nodes) + { + if (node.Path.Equals(path, StringComparison.Ordinal)) + return node; + + if (path.StartsWith(node.Path, StringComparison.Ordinal)) + { + var founded = FindBranchNode(node.Children, path); + if (founded != null) + return founded; + } + } + + return null; + } + } +} + + diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index eab0d28a..4ec328f5 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -577,14 +577,14 @@ - + - + - + @@ -592,9 +592,17 @@ - - - + + + + + + + diff --git a/src/Views/TagsView.axaml b/src/Views/TagsView.axaml index b50ef481..5dedb661 100644 --- a/src/Views/TagsView.axaml +++ b/src/Views/TagsView.axaml @@ -12,6 +12,10 @@ + + @@ -43,15 +47,14 @@ Classes="primary" Text="{Binding FullPath, Converter={x:Static c:PathConverters.PureFileName}}" Margin="8,0,0,0"/> - - + + + + + + + + @@ -60,33 +63,28 @@ - + Margin="8,0,0,0" + TextTrimming="CharacterEllipsis"/> - + diff --git a/src/Views/TagsView.axaml.cs b/src/Views/TagsView.axaml.cs index bde5ae32..c83cfd28 100644 --- a/src/Views/TagsView.axaml.cs +++ b/src/Views/TagsView.axaml.cs @@ -247,23 +247,6 @@ namespace SourceGit.Views } } - private void OnToggleFilterClicked(object sender, RoutedEventArgs e) - { - if (sender is ToggleButton toggle && DataContext is ViewModels.Repository repo) - { - var target = null as Models.Tag; - if (toggle.DataContext is ViewModels.TagTreeNode node) - target = node.Tag; - else if (toggle.DataContext is Models.Tag tag) - target = tag; - - if (target != null) - repo.UpdateFilters([target.Name], toggle.IsChecked == true); - } - - e.Handled = true; - } - private void MakeTreeRows(List rows, List nodes) { foreach (var node in nodes) From bb90c86649c1a6c0e43ac40f9915799c453b1571 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 14 Nov 2024 07:21:47 +0000 Subject: [PATCH 21/53] 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 71643636..6a989d89 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.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.85%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-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-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-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 93ee2875..5d7385cf 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.FilterCommits.Default +- Text.Repository.FilterCommits.Exclude +- Text.Repository.FilterCommits.Include
-### es_ES.axaml: 99.57% +### es_ES.axaml: 99.14%
@@ -17,10 +19,13 @@ - 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
-### fr_FR.axaml: 98.85% +### fr_FR.axaml: 98.42%
@@ -33,11 +38,14 @@ - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor - Text.Repository.CustomActions +- Text.Repository.FilterCommits.Default +- Text.Repository.FilterCommits.Exclude +- Text.Repository.FilterCommits.Include - Text.ScanRepositories
-### pt_BR.axaml: 99.57% +### pt_BR.axaml: 99.14%
@@ -46,16 +54,21 @@ - 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
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.57%
Missing Keys - +- Text.Repository.FilterCommits.Default +- Text.Repository.FilterCommits.Exclude +- Text.Repository.FilterCommits.Include
From a53787c754d2236cbd9203afeaf224e96dbae00c Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 14 Nov 2024 19:19:44 +0800 Subject: [PATCH 22/53] fix: `git rebase --continue` fail (#693) * fix the exit code when start `SourceGit` as core editor (rebasing). * redesign the layout of working copy page for in-progress states. Signed-off-by: leo --- src/App.axaml.cs | 8 +-- src/Resources/Styles.axaml | 6 +++ src/ViewModels/Repository.cs | 65 ++---------------------- src/ViewModels/WorkingCopy.cs | 94 +++++++++++++++++++++++++++++++++-- src/Views/Repository.axaml | 10 +--- src/Views/WorkingCopy.axaml | 12 +++++ 6 files changed, 119 insertions(+), 76 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index dfec763b..0615724a 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -478,17 +478,20 @@ namespace SourceGit if (args.Length <= 1 || !args[0].Equals("--rebase-message-editor", StringComparison.Ordinal)) return false; + exitCode = 0; + var file = args[1]; var filename = Path.GetFileName(file); if (!filename.Equals("COMMIT_EDITMSG", StringComparison.OrdinalIgnoreCase)) return true; - var jobsFile = Path.Combine(Path.GetDirectoryName(file)!, "sourcegit_rebase_jobs.json"); + var gitDir = Path.GetDirectoryName(file)!; + var jobsFile = Path.Combine(gitDir, "sourcegit_rebase_jobs.json"); if (!File.Exists(jobsFile)) return true; var collection = JsonSerializer.Deserialize(File.ReadAllText(jobsFile), JsonCodeGen.Default.InteractiveRebaseJobCollection); - var doneFile = Path.Combine(Path.GetDirectoryName(file)!, "rebase-merge", "done"); + var doneFile = Path.Combine(gitDir, "rebase-merge", "done"); if (!File.Exists(doneFile)) return true; @@ -499,7 +502,6 @@ namespace SourceGit var job = collection.Jobs[done.Length - 1]; File.WriteAllText(file, job.Message); - exitCode = 0; return true; } diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 8fdfaa3c..82970549 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -512,6 +512,12 @@ + +