From 0a877c6730ecc44ca16e32b670dd4bcf348c42d3 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Mar 2025 10:03:27 +0800 Subject: [PATCH 01/35] project: upgrade `OpenAI` and `Azure.AI.OpenAI` to `2.2.0-beta.4` Signed-off-by: leo --- src/SourceGit.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj index 3578d59f..2a4b3c91 100644 --- a/src/SourceGit.csproj +++ b/src/SourceGit.csproj @@ -48,10 +48,10 @@ - + - + From fc85dd3269bb3c122b36d8b43f7612dd8e242d03 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 24 Mar 2025 19:28:16 +0800 Subject: [PATCH 02/35] enhance: improve `Repository.Open()` performance (#1121) Signed-off-by: leo --- src/ViewModels/Launcher.cs | 47 +++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 06479394..9ae99b33 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -275,22 +275,16 @@ namespace SourceGit.ViewModels if (!Path.Exists(node.Id)) { - var ctx = page == null ? ActivePage.Node.Id : page.Node.Id; - App.RaiseException(ctx, "Repository does NOT exists any more. Please remove it."); + App.RaiseException(node.Id, "Repository does NOT exists any more. Please remove it."); return; } var isBare = new Commands.IsBareRepository(node.Id).Result(); - var gitDir = node.Id; - if (!isBare) + var gitDir = isBare ? node.Id : GetRepositoryGitDir(node.Id); + if (string.IsNullOrEmpty(gitDir)) { - gitDir = new Commands.QueryGitDir(node.Id).Result(); - if (string.IsNullOrEmpty(gitDir)) - { - var ctx = page == null ? ActivePage.Node.Id : page.Node.Id; - App.RaiseException(ctx, "Given path is not a valid git repository!"); - return; - } + App.RaiseException(node.Id, "Given path is not a valid git repository!"); + return; } var repo = new Repository(isBare, node.Id, gitDir); @@ -469,6 +463,37 @@ namespace SourceGit.ViewModels return menu; } + private string GetRepositoryGitDir(string repo) + { + var fullpath = Path.Combine(repo, ".git"); + if (Directory.Exists(fullpath)) + { + if (Directory.Exists(Path.Combine(fullpath, "refs")) && + Directory.Exists(Path.Combine(fullpath, "objects")) && + File.Exists(Path.Combine(fullpath, "HEAD"))) + return fullpath; + + return null; + } + + if (File.Exists(fullpath)) + { + var redirect = File.ReadAllText(fullpath).Trim(); + if (redirect.StartsWith("gitdir: ", StringComparison.Ordinal)) + redirect = redirect.Substring(8); + + if (!Path.IsPathRooted(redirect)) + redirect = Path.GetFullPath(Path.Combine(repo, redirect)); + + if (Directory.Exists(redirect)) + return redirect; + + return null; + } + + return new Commands.QueryGitDir(repo).Result(); + } + private void SwitchWorkspace(Workspace to) { foreach (var one in Pages) From 380e6713b5418ee9f27a7b9bb5dd7e6c4556de82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Mart=C3=ADnez=20M=2E?= <56406225+jjesus-dev@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:51:22 -0600 Subject: [PATCH 03/35] localization: update spanish translations (#1124) --- src/Resources/Locales/es_ES.axaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index e7e953e5..2f4a7230 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -475,6 +475,7 @@ Commits en el historial Mostrar hora del autor en lugar de la hora del commit en el gráfico Mostrar hijos en los detalles de commit + Mostrar etiquetas en el gráfico de commit Longitud de la guía del asunto GIT Habilitar Auto CRLF @@ -604,7 +605,7 @@ Por Fecha de Creación Por Nombre (Ascendiente) Por Nombre (Descendiente) - Sort + Ordenar Abrir en Terminal Usar tiempo relativo en las historias WORKTREES From 467089aec55005918bd42ba1294234bb06ee8bd0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 25 Mar 2025 01:51:33 +0000 Subject: [PATCH 04/35] doc: Update translation status and missing keys --- TRANSLATION.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index a96f0fc6..30a2a679 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -22,14 +22,7 @@ This document shows the translation status of each locale file in the repository -### ![es__ES](https://img.shields.io/badge/es__ES-99.87%25-yellow) - -
-Missing keys in es_ES.axaml - -- Text.Preferences.General.ShowTagsInGraph - -
+### ![es__ES](https://img.shields.io/badge/es__ES-%E2%88%9A-brightgreen) ### ![fr__FR](https://img.shields.io/badge/fr__FR-%E2%88%9A-brightgreen) From f37ac904b9b2babddbba5b970f45de583e30fc33 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 25 Mar 2025 10:33:39 +0800 Subject: [PATCH 05/35] =?UTF-8?q?enhance:=20do=20not=20create=20crash=20lo?= =?UTF-8?q?g=20for=20unobserved=20task=20exceptions=20(#1121=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: leo --- src/App.axaml.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index af5e6177..86c5200c 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -37,7 +37,6 @@ namespace SourceGit TaskScheduler.UnobservedTaskException += (_, e) => { - LogException(e.Exception); e.SetObserved(); }; From ca0fb7ae1090068de4a7a42de113d0c9c4e203ff Mon Sep 17 00:00:00 2001 From: Iacopo Sbalchiero Date: Wed, 26 Mar 2025 02:27:10 +0100 Subject: [PATCH 06/35] Adding template for Azure DevOps workitems (#1128) * feat: add Azure DevOps issue tracker integration * localization: add Azure DevOps sample rule to issue tracker in multiple languages --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/es_ES.axaml | 1 + src/Resources/Locales/fr_FR.axaml | 1 + src/Resources/Locales/it_IT.axaml | 1 + src/Resources/Locales/pt_BR.axaml | 1 + src/Resources/Locales/ru_RU.axaml | 1 + src/ViewModels/RepositoryConfigure.cs | 5 +++++ src/Views/RepositoryConfigure.axaml | 1 + 8 files changed, 12 insertions(+) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index f24d6c65..75d312ea 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -160,6 +160,7 @@ Add Sample GitLab Issue Rule Add Sample GitLab Merge Request Rule Add Sample Jira Rule + Add Sample Azure DevOps Rule New Rule Issue Regex Expression: Rule Name: diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 2f4a7230..e1eccaa7 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -161,6 +161,7 @@ Añadir Regla de Ejemplo para Pull Requests de Gitee Añadir Regla de Ejemplo para Github Añadir Regla de Ejemplo para Jira + Añadir Regla de Ejemplo para Azure DevOps Añadir Regla de Ejemplo para Incidencias de GitLab Añadir Regla de Ejemplo para Merge Requests de GitLab Nueva Regla diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 19c0859c..1c3d7d34 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -151,6 +151,7 @@ Ajouter une règle d'exemple pour Pull Request Gitee Ajouter une règle d'exemple Github Ajouter une règle d'exemple Jira + Ajouter une règle d'exemple Azure DevOps Ajouter une règle d'exemple pour Incidents GitLab Ajouter une règle d'exemple pour Merge Request GitLab Nouvelle règle diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index d002dfef..da7d18d1 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -161,6 +161,7 @@ Aggiungi una regola di esempio per un Pull Request Gitee Aggiungi una regola di esempio per GitHub Aggiungi una regola di esempio per Jira + Aggiungi una regola di esempio per Azure DevOps Aggiungi una regola di esempio per Issue GitLab Aggiungi una regola di esempio per una Merge Request GitLab Nuova Regola diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index e811cf3e..e799741c 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -168,6 +168,7 @@ RASTREADOR DE PROBLEMAS Adicionar Regra de Exemplo do Github Adicionar Regra de Exemplo do Jira + Adicionar Regra de Exemplo do Azure DevOps Adicionar Regra de Exemplo do GitLab Adicionar regra de exemplo de Merge Request do GitLab Nova Regra diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 707c9ed9..53f04a5b 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -161,6 +161,7 @@ Добавить пример правила запроса скачивания из Gitea Добавить пример правила для Git Добавить пример правила Jira + Добавить пример правила Azure DevOps Добавить пример правила выдачи GitLab Добавить пример правила запроса на слияние в GitLab Новое правило diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs index cf23b6d8..3f590758 100644 --- a/src/ViewModels/RepositoryConfigure.cs +++ b/src/ViewModels/RepositoryConfigure.cs @@ -203,6 +203,11 @@ namespace SourceGit.ViewModels SelectedIssueTrackerRule = _repo.Settings.AddIssueTracker("Jira Tracker", "PROJ-(\\d+)", "https://jira.yourcompany.com/browse/PROJ-$1"); } + public void AddSampleAzureWorkItemTracker() + { + SelectedIssueTrackerRule = _repo.Settings.AddIssueTracker("Azure DevOps Tracker", "#(\\d+)", "https://dev.azure.com/yourcompany/workspace/_workitems/edit/$1"); + } + public void AddSampleGitLabIssueTracker() { var link = "https://gitlab.com/username/repository/-/issues/$1"; diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml index de777800..e41375b9 100644 --- a/src/Views/RepositoryConfigure.axaml +++ b/src/Views/RepositoryConfigure.axaml @@ -283,6 +283,7 @@ + From dccf53e51823a8da0eceaa3059d408d6f35c15d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Mar 2025 01:27:21 +0000 Subject: [PATCH 07/35] doc: Update translation status and missing keys --- TRANSLATION.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 30a2a679..b6ba3ed3 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -6,13 +6,14 @@ This document shows the translation status of each locale file in the repository ### ![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen) -### ![de__DE](https://img.shields.io/badge/de__DE-98.92%25-yellow) +### ![de__DE](https://img.shields.io/badge/de__DE-98.79%25-yellow)
Missing keys in de_DE.axaml - Text.BranchUpstreamInvalid - Text.Configure.CustomAction.WaitForExit +- Text.Configure.IssueTracker.AddSampleAzure - Text.Diff.First - Text.Diff.Last - Text.Preferences.AI.Streaming @@ -35,7 +36,7 @@ This document shows the translation status of each locale file in the repository
-### ![pt__BR](https://img.shields.io/badge/pt__BR-91.12%25-yellow) +### ![pt__BR](https://img.shields.io/badge/pt__BR-91.13%25-yellow)
Missing keys in pt_BR.axaml @@ -111,6 +112,20 @@ This document shows the translation status of each locale file in the repository ### ![ru__RU](https://img.shields.io/badge/ru__RU-%E2%88%9A-brightgreen) -### ![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen) +### ![zh__CN](https://img.shields.io/badge/zh__CN-99.87%25-yellow) -### ![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen) \ No newline at end of file +
+Missing keys in zh_CN.axaml + +- Text.Configure.IssueTracker.AddSampleAzure + +
+ +### ![zh__TW](https://img.shields.io/badge/zh__TW-99.87%25-yellow) + +
+Missing keys in zh_TW.axaml + +- Text.Configure.IssueTracker.AddSampleAzure + +
\ No newline at end of file From 4fb853d1fd91d13e852f64556808705cd345be45 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 26 Mar 2025 09:30:41 +0800 Subject: [PATCH 08/35] localization: add translation `Text.Configure.IssueTracker.AddSampleAzure` for Chinese (#1128) 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 93d08bd0..ad9b4179 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -157,6 +157,7 @@ 分钟 默认远程 ISSUE追踪 + 新增匹配Azure DevOps规则 新增匹配Gitee议题规则 新增匹配Gitee合并请求规则 新增匹配Github Issue规则 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index d5a7a77c..173ad099 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -157,6 +157,7 @@ 分鐘 預設遠端存放庫 Issue 追蹤 + 新增符合 Azure DevOps 規則 新增符合 Gitee 議題規則 新增符合 Gitee 合併請求規則 新增符合 GitHub Issue 規則 From fc3767754621a0f50b833f7e2259e41b7cd8caad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 26 Mar 2025 01:30:58 +0000 Subject: [PATCH 09/35] doc: Update translation status and missing keys --- TRANSLATION.md | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index b6ba3ed3..183e77e6 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -112,20 +112,6 @@ This document shows the translation status of each locale file in the repository ### ![ru__RU](https://img.shields.io/badge/ru__RU-%E2%88%9A-brightgreen) -### ![zh__CN](https://img.shields.io/badge/zh__CN-99.87%25-yellow) +### ![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen) -
-Missing keys in zh_CN.axaml - -- Text.Configure.IssueTracker.AddSampleAzure - -
- -### ![zh__TW](https://img.shields.io/badge/zh__TW-99.87%25-yellow) - -
-Missing keys in zh_TW.axaml - -- Text.Configure.IssueTracker.AddSampleAzure - -
\ No newline at end of file +### ![zh__TW](https://img.shields.io/badge/zh__TW-%E2%88%9A-brightgreen) \ No newline at end of file From 4153eec1a8594e67f7b70f81812042886af50dec Mon Sep 17 00:00:00 2001 From: Gadfly Date: Wed, 26 Mar 2025 12:15:15 +0800 Subject: [PATCH 10/35] chore: Update DEB package configuration with installed size (#1130) --- build/resources/deb/DEBIAN/control | 3 ++- build/scripts/package.linux.sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build/resources/deb/DEBIAN/control b/build/resources/deb/DEBIAN/control index f553db8b..71786b43 100755 --- a/build/resources/deb/DEBIAN/control +++ b/build/resources/deb/DEBIAN/control @@ -1,7 +1,8 @@ Package: sourcegit -Version: 8.23 +Version: 2025.10 Priority: optional Depends: libx11-6, libice6, libsm6, libicu | libicu76 | libicu74 | libicu72 | libicu71 | libicu70 | libicu69 | libicu68 | libicu67 | libicu66 | libicu65 | libicu63 | libicu60 | libicu57 | libicu55 | libicu52, xdg-utils Architecture: amd64 +Installed-Size: 60440 Maintainer: longshuang@msn.cn Description: Open-source & Free Git GUI Client diff --git a/build/scripts/package.linux.sh b/build/scripts/package.linux.sh index 5abb058b..1b4adbdc 100755 --- a/build/scripts/package.linux.sh +++ b/build/scripts/package.linux.sh @@ -56,8 +56,15 @@ cp -f SourceGit/* resources/deb/opt/sourcegit ln -rsf resources/deb/opt/sourcegit/sourcegit resources/deb/usr/bin cp -r resources/_common/applications resources/deb/usr/share cp -r resources/_common/icons resources/deb/usr/share -sed -i -e "s/^Version:.*/Version: $VERSION/" -e "s/^Architecture:.*/Architecture: $arch/" resources/deb/DEBIAN/control -dpkg-deb --root-owner-group --build resources/deb "sourcegit_$VERSION-1_$arch.deb" +# Calculate installed size in KB +installed_size=$(du -sk resources/deb | cut -f1) +# Update the control file +sed -i -e "s/^Version:.*/Version: $VERSION/" \ + -e "s/^Architecture:.*/Architecture: $arch/" \ + -e "s/^Installed-Size:.*/Installed-Size: $installed_size/" \ + resources/deb/DEBIAN/control +# Build deb package with gzip compression +dpkg-deb -Zgzip --root-owner-group --build resources/deb "sourcegit_$VERSION-1_$arch.deb" rpmbuild -bb --target="$target" resources/rpm/SPECS/build.spec --define "_topdir $(pwd)/resources/rpm" --define "_version $VERSION" mv "resources/rpm/RPMS/$target/sourcegit-$VERSION-1.$target.rpm" ./ From 1575ae977eb1ba1923e2d02e0521a90064aa7b95 Mon Sep 17 00:00:00 2001 From: Gadfly Date: Thu, 27 Mar 2025 20:22:46 +0800 Subject: [PATCH 11/35] fix: improve font family name handling by collapsing multiple spaces (#1131) --- src/App.axaml.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 86c5200c..0448a247 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -559,8 +559,22 @@ namespace SourceGit foreach (var part in parts) { var t = part.Trim(); - if (!string.IsNullOrEmpty(t)) - trimmed.Add(t); + if (string.IsNullOrEmpty(t)) + continue; + + // Collapse multiple spaces into single space + var prevChar = '\0'; + var sb = new StringBuilder(); + + foreach (var c in t) + { + if (c == ' ' && prevChar == ' ') + continue; + sb.Append(c); + prevChar = c; + } + + trimmed.Add(sb.ToString()); } return trimmed.Count > 0 ? string.Join(',', trimmed) : string.Empty; From 56ebc182f2fa244276c2c1014c978ef7cb72c32f Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 28 Mar 2025 12:20:36 +0800 Subject: [PATCH 12/35] enhance: try to reinstate not onl the working tree's change, but also the index's ones (#1135) Signed-off-by: leo --- src/Commands/Stash.cs | 2 +- src/Resources/Locales/de_DE.axaml | 1 - src/Resources/Locales/en_US.axaml | 1 - src/Resources/Locales/es_ES.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/it_IT.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 1 - src/Resources/Locales/zh_TW.axaml | 1 - 10 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Commands/Stash.cs b/src/Commands/Stash.cs index 7acfdf38..7d1a269b 100644 --- a/src/Commands/Stash.cs +++ b/src/Commands/Stash.cs @@ -82,7 +82,7 @@ namespace SourceGit.Commands public bool Pop(string name) { - Args = $"stash pop -q \"{name}\""; + Args = $"stash pop -q --index \"{name}\""; return Exec(); } diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 7144ef43..ba6592e9 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -650,7 +650,6 @@ Lokale Änderungen stashen Anwenden Entfernen - Anwenden und entfernen Stash entfernen Entfernen: Stashes diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 75d312ea..5c400979 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -655,7 +655,6 @@ Stash Local Changes Apply Drop - Pop Save as Patch... Drop Stash Drop: diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index e1eccaa7..54cb588d 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -659,7 +659,6 @@ Stash Cambios Locales Aplicar Eliminar - Pop Guardar como Parche... Eliminar Stash Eliminar: diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 1c3d7d34..2dcd52ab 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -600,7 +600,6 @@ Stash les changements locaux Appliquer Effacer - Extraire Effacer le Stash Effacer : Stashes diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index da7d18d1..e973a99c 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -659,7 +659,6 @@ Stasha Modifiche Locali Applica Elimina - Estrai Salva come Patch... Elimina Stash Elimina: diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index e799741c..8ff00158 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -620,7 +620,6 @@ Guardar Alterações Locais Aplicar Descartar - Pop Descartar Stash Descartar: Stashes diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 53f04a5b..ede88a10 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -660,7 +660,6 @@ Отложить локальные изменения Принять Отбросить - Применить Сохранить как заплатку... Отбросить тайник Отбросить: diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index ad9b4179..783e5696 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -659,7 +659,6 @@ 贮藏本地变更 应用(apply) 删除(drop) - 应用并删除(pop) 另存为补丁... 丢弃贮藏确认 丢弃贮藏 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 173ad099..c10d195f 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -658,7 +658,6 @@ 擱置本機變更 套用 (apply) 刪除 (drop) - 套用並刪除 (pop) 另存為修補檔 (patch)... 捨棄擱置變更確認 捨棄擱置變更: From b26c8a64ad7ebf62e450ca6b121bd0ab3fc14860 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 28 Mar 2025 04:20:55 +0000 Subject: [PATCH 13/35] doc: Update translation status and missing keys --- TRANSLATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 183e77e6..b51fa09b 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -36,7 +36,7 @@ This document shows the translation status of each locale file in the repository
-### ![pt__BR](https://img.shields.io/badge/pt__BR-91.13%25-yellow) +### ![pt__BR](https://img.shields.io/badge/pt__BR-91.12%25-yellow)
Missing keys in pt_BR.axaml From 276d000bcf66c8e5f686cc3eba0f98d486ee0cf9 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 28 Mar 2025 18:01:15 +0800 Subject: [PATCH 14/35] refactor: change `Copy File Name` to `Copy Full Path` for selected file or change (#1132) Signed-off-by: leo --- src/Native/OS.cs | 9 +++++++++ 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/it_IT.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 2 +- src/Resources/Locales/zh_TW.axaml | 2 +- src/ViewModels/BranchCompare.cs | 12 ++++++------ src/ViewModels/CommitDetail.cs | 24 ++++++++++++------------ src/ViewModels/RevisionCompare.cs | 12 ++++++------ src/ViewModels/StashesPage.cs | 12 ++++++------ src/ViewModels/WorkingCopy.cs | 24 ++++++++++++------------ 15 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/Native/OS.cs b/src/Native/OS.cs index f11d1e7f..320b5208 100644 --- a/src/Native/OS.cs +++ b/src/Native/OS.cs @@ -162,6 +162,15 @@ namespace SourceGit.Native _backend.OpenWithDefaultEditor(file); } + public static string GetAbsPath(string root, string sub) + { + var fullpath = Path.Combine(root, sub); + if (OperatingSystem.IsWindows()) + return fullpath.Replace('/', '\\'); + + return fullpath; + } + private static void UpdateGitVersion() { if (string.IsNullOrEmpty(_gitExecutable) || !File.Exists(_gitExecutable)) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index ba6592e9..bbfe4545 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -186,7 +186,6 @@ Kopieren Kopiere gesamten Text Pfad kopieren - Dateinamen kopieren Branch erstellen... Basierend auf: Erstellten Branch auschecken diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 5c400979..5ff1e3a4 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -186,7 +186,7 @@ Copy Copy All Text Copy Path - Copy File Name + Copy Full Path Create Branch... Based On: Check out the created branch diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 54cb588d..d8018097 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -189,7 +189,6 @@ Copiar Copiar Todo el Texto Copiar Ruta - Copiar Nombre del Archivo Crear Rama... Basado En: Checkout de la rama creada diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 2dcd52ab..70d0af22 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -178,7 +178,6 @@ Type de Changement : Copier Copier tout le texte - Copier le nom de fichier Copier le chemin Créer une branche... Basé sur : diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index e973a99c..85038d9e 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -189,7 +189,6 @@ Copia Copia Tutto il Testo Copia Percorso - Copia Nome File Crea Branch... Basato Su: Checkout del Branch Creato diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 8ff00158..4ee6cdbc 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -196,7 +196,6 @@ Copiar Copiar todo o texto Copiar Caminho - Copiar Nome do Arquivo Criar Branch... Baseado Em: Checar o branch criado diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index ede88a10..2d48d127 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -190,7 +190,6 @@ Копировать Копировать весь текст Копировать путь - Копировать имя файла Создать ветку... Основан на: Проверить созданную ветку diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 783e5696..8d2b4f1e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -189,7 +189,7 @@ 复制 复制全部文本 复制路径 - 复制文件名 + 复制完整路径 新建分支 ... 新分支基于 : 完成后切换到新分支 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index c10d195f..8e823f68 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -189,7 +189,7 @@ 複製 複製全部內容 複製路徑 - 複製檔案名稱 + 複製完整路徑 新增分支... 新分支基於: 完成後切換到新分支 diff --git a/src/ViewModels/BranchCompare.cs b/src/ViewModels/BranchCompare.cs index b3c0009c..4edb978c 100644 --- a/src/ViewModels/BranchCompare.cs +++ b/src/ViewModels/BranchCompare.cs @@ -163,15 +163,15 @@ namespace SourceGit.ViewModels }; menu.Items.Add(copyPath); - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo, change.Path)); e.Handled = true; }; - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); return menu; } diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 34ac8308..d04e674b 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -425,17 +425,17 @@ namespace SourceGit.ViewModels ev.Handled = true; }; - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo.FullPath, change.Path)); e.Handled = true; }; menu.Items.Add(copyPath); - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); return menu; } @@ -562,17 +562,17 @@ namespace SourceGit.ViewModels ev.Handled = true; }; - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(file.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo.FullPath, file.Path)); e.Handled = true; }; menu.Items.Add(copyPath); - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); return menu; } diff --git a/src/ViewModels/RevisionCompare.cs b/src/ViewModels/RevisionCompare.cs index 77a408e0..3b5717a6 100644 --- a/src/ViewModels/RevisionCompare.cs +++ b/src/ViewModels/RevisionCompare.cs @@ -183,15 +183,15 @@ namespace SourceGit.ViewModels }; menu.Items.Add(copyPath); - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo, change.Path)); e.Handled = true; }; - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); return menu; } diff --git a/src/ViewModels/StashesPage.cs b/src/ViewModels/StashesPage.cs index 77ed5551..e69d9bb5 100644 --- a/src/ViewModels/StashesPage.cs +++ b/src/ViewModels/StashesPage.cs @@ -251,12 +251,12 @@ namespace SourceGit.ViewModels ev.Handled = true; }; - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo.FullPath, change.Path)); e.Handled = true; }; @@ -267,7 +267,7 @@ namespace SourceGit.ViewModels menu.Items.Add(resetToThisRevision); menu.Items.Add(new MenuItem { Header = "-" }); menu.Items.Add(copyPath); - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); return menu; } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index f9ddb288..40b4c50c 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -903,15 +903,15 @@ namespace SourceGit.ViewModels }; menu.Items.Add(copy); - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo.FullPath, change.Path)); e.Handled = true; }; - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); } else { @@ -1270,17 +1270,17 @@ namespace SourceGit.ViewModels e.Handled = true; }; - var copyFileName = new MenuItem(); - copyFileName.Header = App.Text("CopyFileName"); - copyFileName.Icon = App.CreateMenuIcon("Icons.Copy"); - copyFileName.Click += (_, e) => + var copyFullPath = new MenuItem(); + copyFullPath.Header = App.Text("CopyFullPath"); + copyFullPath.Icon = App.CreateMenuIcon("Icons.Copy"); + copyFullPath.Click += (_, e) => { - App.CopyText(Path.GetFileName(change.Path)); + App.CopyText(Native.OS.GetAbsPath(_repo.FullPath, change.Path)); e.Handled = true; }; menu.Items.Add(copyPath); - menu.Items.Add(copyFileName); + menu.Items.Add(copyFullPath); } else { From ce7196490a5d7143f7502ea8b4aad89a3c719ab8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 28 Mar 2025 10:02:16 +0000 Subject: [PATCH 15/35] doc: Update translation status and missing keys --- TRANSLATION.md | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index b51fa09b..c79847be 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -6,7 +6,7 @@ This document shows the translation status of each locale file in the repository ### ![en_US](https://img.shields.io/badge/en__US-%E2%88%9A-brightgreen) -### ![de__DE](https://img.shields.io/badge/de__DE-98.79%25-yellow) +### ![de__DE](https://img.shields.io/badge/de__DE-98.65%25-yellow)
Missing keys in de_DE.axaml @@ -14,6 +14,7 @@ This document shows the translation status of each locale file in the repository - Text.BranchUpstreamInvalid - Text.Configure.CustomAction.WaitForExit - Text.Configure.IssueTracker.AddSampleAzure +- Text.CopyFullPath - Text.Diff.First - Text.Diff.Last - Text.Preferences.AI.Streaming @@ -23,20 +24,35 @@ This document shows the translation status of each locale file in the repository
-### ![es__ES](https://img.shields.io/badge/es__ES-%E2%88%9A-brightgreen) +### ![es__ES](https://img.shields.io/badge/es__ES-99.87%25-yellow) -### ![fr__FR](https://img.shields.io/badge/fr__FR-%E2%88%9A-brightgreen) +
+Missing keys in es_ES.axaml -### ![it__IT](https://img.shields.io/badge/it__IT-99.87%25-yellow) +- Text.CopyFullPath + +
+ +### ![fr__FR](https://img.shields.io/badge/fr__FR-99.87%25-yellow) + +
+Missing keys in fr_FR.axaml + +- Text.CopyFullPath + +
+ +### ![it__IT](https://img.shields.io/badge/it__IT-99.73%25-yellow)
Missing keys in it_IT.axaml +- Text.CopyFullPath - Text.Preferences.General.ShowTagsInGraph
-### ![pt__BR](https://img.shields.io/badge/pt__BR-91.12%25-yellow) +### ![pt__BR](https://img.shields.io/badge/pt__BR-90.98%25-yellow)
Missing keys in pt_BR.axaml @@ -59,6 +75,7 @@ This document shows the translation status of each locale file in the repository - Text.Configure.CustomAction.WaitForExit - Text.Configure.IssueTracker.AddSampleGiteeIssue - Text.Configure.IssueTracker.AddSampleGiteePullRequest +- Text.CopyFullPath - Text.CreateBranch.Name.WarnSpace - Text.DeleteRepositoryNode.Path - Text.DeleteRepositoryNode.TipForGroup @@ -110,7 +127,14 @@ This document shows the translation status of each locale file in the repository
-### ![ru__RU](https://img.shields.io/badge/ru__RU-%E2%88%9A-brightgreen) +### ![ru__RU](https://img.shields.io/badge/ru__RU-99.87%25-yellow) + +
+Missing keys in ru_RU.axaml + +- Text.CopyFullPath + +
### ![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen) From 1482a005bb616d5f16926ec77d469e324ce1095a Mon Sep 17 00:00:00 2001 From: AquariusStar <48148723+AquariusStar@users.noreply.github.com> Date: Mon, 31 Mar 2025 04:20:54 +0300 Subject: [PATCH 16/35] localization: update and fix translation russian (#1136) --- src/Resources/Locales/ru_RU.axaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 2d48d127..2ea274d1 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -190,6 +190,7 @@ Копировать Копировать весь текст Копировать путь + Копировать полный путь Создать ветку... Основан на: Проверить созданную ветку @@ -212,7 +213,7 @@ Вид: С примечаниями Простой - Удерживайте Ctrl, чтобы начать сразу + Удерживайте Ctrl, чтобы сразу начать Вырезать Удалить ветку Ветка: @@ -330,7 +331,7 @@ Добавить шаблон отслеживания в LFS Git Извлечь Извлечь объекты LFS - Запустить «git lfs fetch», чтобы загрузить объекты LFS Git. При этом рабочая копия не обновляется. + Запустить (git lfs fetch), чтобы загрузить объекты LFS Git. При этом рабочая копия не обновляется. Установить перехват LFS Git Показывать блокировки Нет заблокированных файлов @@ -340,10 +341,10 @@ Разблокировать Принудительно разблокировать Обрезать - Запустить «git lfs prune», чтобы удалить старые файлы LFS из локального хранилища + Запустить (git lfs prune), чтобы удалить старые файлы LFS из локального хранилища Забрать Забрать объекты LFS - Запустить «git lfs pull», чтобы загрузить все файлы LFS Git для текущей ссылки и проверить + Запустить (git lfs pull), чтобы загрузить все файлы LFS Git для текущей ссылки и проверить Выложить Выложить объекты LFS Отправляйте большие файлы, помещенные в очередь, в конечную точку LFS Git @@ -557,7 +558,7 @@ Отказ Автоматическое извлечение изменений с внешних репозиторий... Очистить (Сбор мусора и удаление) - Запустить команду «git gc» для данного репозитория. + Запустить команду (git gc) для данного репозитория. Очистить всё Настройка репозитория ПРОДОЛЖИТЬ From 9ee3a00fbae017de54c33f56ff0d0d3d1b53e29c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 31 Mar 2025 01:21:15 +0000 Subject: [PATCH 17/35] doc: Update translation status and missing keys --- TRANSLATION.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index c79847be..341fdce0 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -127,14 +127,7 @@ This document shows the translation status of each locale file in the repository
-### ![ru__RU](https://img.shields.io/badge/ru__RU-99.87%25-yellow) - -
-Missing keys in ru_RU.axaml - -- Text.CopyFullPath - -
+### ![ru__RU](https://img.shields.io/badge/ru__RU-%E2%88%9A-brightgreen) ### ![zh__CN](https://img.shields.io/badge/zh__CN-%E2%88%9A-brightgreen) From 07d99f5fd28cae320cf20b229438ead47ca68e79 Mon Sep 17 00:00:00 2001 From: qiufengshe Date: Mon, 31 Mar 2025 09:21:38 +0800 Subject: [PATCH 18/35] enhance: get email hash code opimization (#1137) (cherry picked from commit 839b92a284d6b103894f6a8a39e5ce1f99bb12fa) --- src/Models/AvatarManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Models/AvatarManager.cs b/src/Models/AvatarManager.cs index 9f0bceaf..a506d886 100644 --- a/src/Models/AvatarManager.cs +++ b/src/Models/AvatarManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -196,8 +196,8 @@ namespace SourceGit.Models private string GetEmailHash(string email) { var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim(); - var hash = MD5.Create().ComputeHash(Encoding.Default.GetBytes(lowered)); - var builder = new StringBuilder(); + var hash = MD5.HashData(Encoding.Default.GetBytes(lowered).AsSpan()); + var builder = new StringBuilder(hash.Length * 2); foreach (var c in hash) builder.Append(c.ToString("x2")); return builder.ToString(); From 0045e06d7888ea1463e6f2291bfe8b76d927b563 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 31 Mar 2025 09:29:07 +0800 Subject: [PATCH 19/35] project: upgrade `AvaloniaUI` to `11.2.6` Signed-off-by: leo --- src/SourceGit.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj index 2a4b3c91..852c9e34 100644 --- a/src/SourceGit.csproj +++ b/src/SourceGit.csproj @@ -41,11 +41,11 @@ - - - - - + + + + + From ae5fa6a793801fa6171257ef3aa9f94a6f7ba3be Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 31 Mar 2025 09:29:56 +0800 Subject: [PATCH 20/35] version: Release 2025.11 Signed-off-by: leo --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e78345d1..75c26f38 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2025.10 \ No newline at end of file +2025.11 \ No newline at end of file From 8e55ba1b47168f9fa193d33c1af4dacd04316da4 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 31 Mar 2025 19:06:10 +0800 Subject: [PATCH 21/35] enhance: avoid unhandled exceptions in timer Signed-off-by: leo --- src/ViewModels/Repository.cs | 51 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 6ea41e04..6b1e439e 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -2513,30 +2513,37 @@ namespace SourceGit.ViewModels private void AutoFetchImpl(object sender) { - if (!_settings.EnableAutoFetch || _isAutoFetching) - return; - - var lockFile = Path.Combine(_gitDir, "index.lock"); - if (File.Exists(lockFile)) - return; - - var now = DateTime.Now; - var desire = _lastFetchTime.AddMinutes(_settings.AutoFetchInterval); - if (desire > now) - return; - - var remotes = new List(); - lock (_lockRemotes) + try { - foreach (var remote in _remotes) - remotes.Add(remote.Name); - } + if (!_settings.EnableAutoFetch || _isAutoFetching) + return; - Dispatcher.UIThread.Invoke(() => IsAutoFetching = true); - foreach (var remote in remotes) - new Commands.Fetch(_fullpath, remote, false, false, null) { RaiseError = false }.Exec(); - _lastFetchTime = DateTime.Now; - Dispatcher.UIThread.Invoke(() => IsAutoFetching = false); + var lockFile = Path.Combine(_gitDir, "index.lock"); + if (File.Exists(lockFile)) + return; + + var now = DateTime.Now; + var desire = _lastFetchTime.AddMinutes(_settings.AutoFetchInterval); + if (desire > now) + return; + + var remotes = new List(); + lock (_lockRemotes) + { + foreach (var remote in _remotes) + remotes.Add(remote.Name); + } + + Dispatcher.UIThread.Invoke(() => IsAutoFetching = true); + foreach (var remote in remotes) + new Commands.Fetch(_fullpath, remote, false, false, null) { RaiseError = false }.Exec(); + _lastFetchTime = DateTime.Now; + Dispatcher.UIThread.Invoke(() => IsAutoFetching = false); + } + catch + { + // DO nothing, but prevent `System.AggregateException` + } } private string _fullpath = string.Empty; From 2deb79f8cea6580ba89fb24cc7fea537f723ec17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Mart=C3=ADnez=20M=2E?= <56406225+jjesus-dev@users.noreply.github.com> Date: Wed, 2 Apr 2025 03:20:33 -0600 Subject: [PATCH 22/35] localization: update spanish translations (#1142) add literal translation for 'CopyFullPath' string --- src/Resources/Locales/es_ES.axaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index d8018097..8b4c350f 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -189,6 +189,7 @@ Copiar Copiar Todo el Texto Copiar Ruta + Copiar Ruta Completa Crear Rama... Basado En: Checkout de la rama creada From 7ef4cca1f548e408984a553bfbbe2e09ed4731ba Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 2 Apr 2025 09:20:43 +0000 Subject: [PATCH 23/35] doc: Update translation status and missing keys --- TRANSLATION.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 341fdce0..011671ea 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -24,14 +24,7 @@ This document shows the translation status of each locale file in the repository -### ![es__ES](https://img.shields.io/badge/es__ES-99.87%25-yellow) - -
-Missing keys in es_ES.axaml - -- Text.CopyFullPath - -
+### ![es__ES](https://img.shields.io/badge/es__ES-%E2%88%9A-brightgreen) ### ![fr__FR](https://img.shields.io/badge/fr__FR-99.87%25-yellow) From 904432a8f1d63472f913071ad1e52f5a8e5fa582 Mon Sep 17 00:00:00 2001 From: UchiTesting <56003633+UchiTesting@users.noreply.github.com> Date: Mon, 7 Apr 2025 03:45:02 +0200 Subject: [PATCH 24/35] style(locale): Add a few translations to the French locale (#1158) --- src/Resources/Locales/fr_FR.axaml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 70d0af22..bf238aa2 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -16,13 +16,19 @@ Suivre la branche : Suivi de la branche distante Assistant IA + RE-GÉNERER Utiliser l'IA pour générer un message de commit + APPLIQUER COMME MESSAGE DE COMMIT Appliquer Fichier de patch : Selectionner le fichier .patch à appliquer Ignorer les changements d'espaces blancs Appliquer le patch Espaces blancs : + Appliquer le Stash + Supprimer après application + Rétablir les changements de l'index + Stash: Archiver... Enregistrer l'archive sous : Sélectionnez le chemin du fichier d'archive @@ -39,6 +45,7 @@ Comparer avec HEAD Comparer avec le worktree Copier le nom de la branche + Action personnalisée Supprimer ${0}$... Supprimer {0} branches sélectionnées Rejeter tous les changements @@ -54,6 +61,7 @@ Renommer ${0}$... Définir la branche de suivi... Comparer les branches + Branche amont invalide ! Octets ANNULER Réinitialiser à la révision parente @@ -92,6 +100,7 @@ Récupérer ce commit Cherry-Pick ce commit Cherry-Pick ... + Checkout Commit Comparer avec HEAD Comparer avec le worktree Copier les informations @@ -150,10 +159,10 @@ Ajouter une règle d'exemple Gitee Ajouter une règle d'exemple pour Pull Request Gitee Ajouter une règle d'exemple Github - Ajouter une règle d'exemple Jira - Ajouter une règle d'exemple Azure DevOps Ajouter une règle d'exemple pour Incidents GitLab Ajouter une règle d'exemple pour Merge Request GitLab + Ajouter une règle d'exemple Jira + Ajouter une règle d'exemple Azure DevOps Nouvelle règle Issue Regex Expression: Nom de règle : @@ -179,6 +188,7 @@ Copier Copier tout le texte Copier le chemin + Copier le chemin complet Créer une branche... Basé sur : Récupérer la branche créée @@ -187,6 +197,7 @@ Stash & Réappliquer Nom de la nouvelle branche : Entrez le nom de la branche. + Les espaces seront remplacés par des tirets. Créer une branche locale Créer un tag... Nouveau tag à : @@ -583,13 +594,20 @@ Passer cette version Mise à jour du logiciel Il n'y a pas de mise à jour pour le moment. + Définir la branche de suivi + Branche : + Escamoter la branche amont + Branche amont: Copier le SHA - Squash Commits + Aller à + Squash les commits Dans : Clé privée SSH : Chemin du magasin de clés privées SSH START Stash + Auto-restauration après le stash + Vos fichiers de travail sont inchangés, mais un stash a été sauvegardé. Inclure les fichiers non-suivis Garder les fichiers indexés Message : @@ -599,6 +617,7 @@ Stash les changements locaux Appliquer Effacer + Sauver comme Patch... Effacer le Stash Effacer : Stashes From cbc7079e59f1078e219bd4942ab59fd879a8f484 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 7 Apr 2025 01:45:21 +0000 Subject: [PATCH 25/35] doc: Update translation status and missing keys --- TRANSLATION.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 011671ea..711564ef 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -26,14 +26,7 @@ This document shows the translation status of each locale file in the repository ### ![es__ES](https://img.shields.io/badge/es__ES-%E2%88%9A-brightgreen) -### ![fr__FR](https://img.shields.io/badge/fr__FR-99.87%25-yellow) - -
-Missing keys in fr_FR.axaml - -- Text.CopyFullPath - -
+### ![fr__FR](https://img.shields.io/badge/fr__FR-%E2%88%9A-brightgreen) ### ![it__IT](https://img.shields.io/badge/it__IT-99.73%25-yellow) From ef106e6909e73355ee22cd06ce0d0fef73a3ce02 Mon Sep 17 00:00:00 2001 From: Sousi Omine <110832262+SousiOmine@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:53:20 +0900 Subject: [PATCH 26/35] Add Japanese localization (#1157) * Initial Japanese translation Only a small part was translated * Unspecified words will be in English When new words are added, they will be displayed in English even if Japanese support is delayed. * Expanded translation scope * Expanded translation scope * Proceed with translation with a focus on overall settings * Re-translated the outdated settings screen * Add items that only exist in the latest en_US and remove items that do not exist in en_US * A lot of translation work done * A lot more translation work has been done * ja_JP.axaml has been translated into Japanese * Fixed three incomplete parts of the Japanese translation --- src/App.axaml | 1 + src/Models/Locales.cs | 1 + src/Resources/Locales/ja_JP.axaml | 747 ++++++++++++++++++++++++++++++ 3 files changed, 749 insertions(+) create mode 100644 src/Resources/Locales/ja_JP.axaml diff --git a/src/App.axaml b/src/App.axaml index 76d4baa8..fdfa8e07 100644 --- a/src/App.axaml +++ b/src/App.axaml @@ -20,6 +20,7 @@ + diff --git a/src/Models/Locales.cs b/src/Models/Locales.cs index d5e1534c..802e88ef 100644 --- a/src/Models/Locales.cs +++ b/src/Models/Locales.cs @@ -17,6 +17,7 @@ namespace SourceGit.Models new Locale("Русский", "ru_RU"), new Locale("简体中文", "zh_CN"), new Locale("繁體中文", "zh_TW"), + new Locale("日本語", "ja_JP"), }; public Locale(string name, string key) diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml new file mode 100644 index 00000000..21255221 --- /dev/null +++ b/src/Resources/Locales/ja_JP.axaml @@ -0,0 +1,747 @@ + + + + + 概要 + SourceGitについて + オープンソース & フリーなGit GUIクライアント + ワークツリーを追加 + チェックアウトする内容: + 既存のブランチ + 新しいブランチを作成 + 場所: + ワークツリーのパスを入力してください。相対パスも使用することができます。 + ブランチの名前: + 任意。デフォルトでは宛先フォルダ名が使用されます。 + 追跡するブランチ: + 追跡中のリモートブランチ + OpenAI アシスタント + 再生成 + OpenAIを使用してコミットメッセージを生成 + コミットメッセージとして適用 + 適用 + パッチファイル: + 適用する .patchファイルを選択 + 空白文字の変更を無視 + パッチを適用 + 空白文字: + スタッシュを適用 + 適用後に削除 + インデックスの変更を復元 + スタッシュ: + アーカイブ... + アーカイブの保存先: + アーカイブファイルのパスを選択 + リビジョン: + アーカイブ + SourceGit Askpass + 変更されていないとみなされるファイル + 変更されていないとみなされるファイルはありません + 削除 + バイナリファイルはサポートされていません!!! + Blame + BLAMEではこのファイルはサポートされていません!!! + ${0}$ をチェックアウトする... + HEADと比較 + ワークツリーと比較 + ブランチ名をコピー + カスタムアクション + ${0}$を削除... + 選択中の{0}個のブランチを削除 + すべての変更を破棄 + ${0}$ へ早送りする + ${0}$ から ${1}$ へフェッチする + Git Flow - Finish ${0}$ + ${0}$ を ${1}$ にマージする... + 選択中の{0}個のブランチを現在のブランチにマージする + ${0}$ をプルする + ${0}$ を ${1}$ にプルする... + ${0}$ をプッシュする + ${0}$ を ${1}$ でリベースする... + ${0}$ をリネームする... + トラッキングブランチを設定... + ブランチの比較 + 無効な上流ブランチ! + バイト + キャンセル + このリビジョンにリセット + 親リビジョンにリセット + コミットメッセージを生成 + 変更表示の切り替え + ファイルとディレクトリのリストを表示 + パスのリストを表示 + ファイルシステムのツリーを表示 + ブランチをチェックアウト + コミットをチェックアウト + 警告: コミットをチェックアウトするとHEADが切断されます + コミット: + ブランチ: + ローカルの変更: + 破棄 + スタッシュして再適用 + チェリーピック + ソースをコミットメッセージに追加 + コミット(複数可): + すべての変更をコミット + メインライン: + 通常、マージをチェリーピックすることはできません。どちらのマージ元をメインラインとして扱うべきかが分からないためです。このオプションを使用すると、指定した親に対して変更を再適用する形でチェリーピックを実行できます。 + スタッシュをクリア + すべてのスタッシュをクリアします。続行しますか? + リモートリポジトリをクローン + 追加の引数: + リポジトリをクローンする際の追加パラメータ(任意)。 + ローカル名: + リポジトリの名前(任意)。 + 親フォルダ: + サブモジュールを初期化して更新 + リポジトリのURL: + 閉じる + エディタ + このコミットをチェリーピック + チェリーピック... + コミットをチェックアウト + HEADと比較 + ワークツリーと比較 + 情報をコピー + SHAをコピー + カスタムアクション + ${0}$ ブランチをここにインタラクティブリベース + ${0}$ にマージ + マージ... + ${0}$ をここにリベース + ${0}$ ブランチをここにリセット + コミットを戻す + 書き直す + パッチとして保存... + 親にスカッシュ + 子コミットをここにスカッシュ + 変更 + 変更を検索... + ファイル + LFSファイル + ファイルを検索... + サブモジュール + コミットの情報 + 著者 + 変更 + + コミッター + このコミットを含む参照を確認 + コミットが含まれるか確認 + 最初の100件の変更のみが表示されています。すべての変更は'変更'タブで確認できます。 + メッセージ + + 参照 + SHA + ブラウザで開く + コミットのタイトルを入力 + 説明 + リポジトリの設定 + コミットテンプレート + テンプレート名: + テンプレート内容: + カスタムアクション + 引数: + ${REPO} - リポジトリのパス; ${BRANCH} - 選択中のブランチ; ${SHA} - 選択中のコミットのSHA + 実行ファイル: + 名前: + スコープ: + ブランチ + コミット + リポジトリ + アクションの終了を待機 + Eメールアドレス + Eメールアドレス + GIT + 自動的にリモートからフェッチ 間隔: + 分(s) + リモートの初期値 + ISSUEトラッカー + サンプルのGitee Issueルールを追加 + サンプルのGiteeプルリクエストルールを追加 + サンプルのGithubルールを追加 + サンプルのGitLab Issueルールを追加 + サンプルのGitLabマージリクエストルールを追加 + サンプルのJiraルールを追加 + サンプルのAzure DevOpsルールを追加 + 新しいルール + Issueの正規表現: + ルール名: + リザルトURL: + 正規表現のグループ値に$1, $2を使用してください。 + AI + 優先するサービス: + 優先するサービスが設定されている場合、SourceGitはこのリポジトリでのみそれを使用します。そうでない場合で複数サービスが利用できる場合は、そのうちの1つを選択するためのコンテキストメニューが表示されます。 + HTTP プロキシ + このリポジトリで使用するHTTPプロキシ + ユーザー名 + このリポジトリにおけるユーザー名 + ワークスペース + + 起動時にタブを復元 + Conventional Commitヘルパー + 破壊的変更: + 閉じたIssue: + 詳細な変更: + スコープ: + 短い説明: + 変更の種類: + コピー + すべてのテキストをコピー + パスをコピー + 絶対パスをコピー + ブランチを作成... + 派生元: + 作成したブランチにチェックアウト + ローカルの変更: + 破棄 + スタッシュして再適用 + 新しいブランチの名前: + ブランチの名前を入力 + スペースはダッシュに置き換えられます。 + ローカルブランチを作成 + タグを作成... + 付与されるコミット: + GPG署名を使用 + タグメッセージ: + 任意。 + タグの名前: + 推奨フォーマット: v1.0.0-alpha + 作成後にすべてのリモートにプッシュ + 新しいタグを作成 + 種類: + 注釈付き + 軽量 + Ctrlキーを押しながらクリックで実行 + 切り取り + ブランチを削除 + ブランチ: + リモートブランチを削除しようとしています!!! + もしリモートブランチを削除する場合、${0}$も削除します。 + 複数のブランチを削除 + 一度に複数のブランチを削除しようとしています! 操作を行う前に再度確認してください! + リモートを削除 + リモート: + パス: + 対象: + すべての子ノードがリストから削除されます。 + グループを削除 + これはリストからのみ削除され、ディスクには保存されません! + リポジトリを削除 + サブモジュールを削除 + サブモジュールのパス: + タグを削除 + タグ: + リモートリポジトリから削除 + バイナリの差分 + NEW + OLD + コピー + ファイルモードが変更されました + 先頭の差分 + 空白の変更を無視 + 最後の差分 + LFSオブジェクトの変更 + 次の差分 + 変更がない、もしくはEOLの変更のみ + 前の差分 + パッチとして保存 + 隠されたシンボルを表示 + 差分の分割表示 + サブモジュール + 新規 + スワップ + シンタックスハイライト + 行の折り返し + ブロックナビゲーションを有効化 + マージツールで開く + すべての行を表示 + 表示する行数を減らす + 表示する行数を増やす + ファイルを選択すると、変更内容が表示されます + マージツールで開く + 変更を破棄 + ワーキングディレクトリのすべての変更を破棄 + 変更: + 無視したファイルを含める + {0}個の変更を破棄します。 + この操作を元に戻すことはできません!!! + ブックマーク: + 新しい名前: + 対象: + 選択中のグループを編集 + 選択中のリポジトリを編集 + カスタムアクションを実行 + アクション名: + (チェックアウトせずに)ブランチを早送りする + フェッチ + すべてのリモートをフェッチ + ローカル参照を強制的に上書き + タグなしでフェッチ + リモート: + リモートの変更をフェッチ + 変更されていないとみなされる + 破棄... + {0}個のファイルを破棄... + 選択された行の変更を破棄 + 外部マージツールで開く + ${0}$ を使用して解決 + パッチとして保存... + ステージ + {0}個のファイルをステージ... + 選択された行の変更をステージ + スタッシュ... + {0}個のファイルをスタッシュ... + アンステージ + {0}個のファイルをアンステージ... + 選択された行の変更をアンステージ + 相手の変更を使用 (checkout --theirs) + 自分の変更を使用 (checkout --ours) + ファイルの履歴 + コンテンツ + 変更 + Git-Flow + 開発ブランチ: + Feature: + Feature プレフィックス: + FLOW - Finish Feature + FLOW - Finish Hotfix + FLOW - Finish Release + 対象: + Hotfix: + Hotfix プレフィックス: + Git-Flowを初期化 + ブランチを保持 + プロダクション ブランチ: + Release: + Release プレフィックス: + Start Feature... + FLOW - Start Feature + Start Hotfix... + FLOW - Start Hotfix + 名前を入力 + Start Release... + FLOW - Start Release + Versionタグ プレフィックス: + Git LFS + トラックパターンを追加... + パターンをファイル名として扱う + カスタム パターン: + Git LFSにトラックパターンを追加 + フェッチ + LFSオブジェクトをフェッチ + `git lfs fetch`を実行して、Git LFSオブジェクトをダウンロードします。ワーキングコピーは更新されません。 + Git LFSフックをインストール + ロックを表示 + ロックされているファイルはありません + ロック + 私のロックのみ表示 + LFSロック + ロック解除 + 強制的にロック解除 + 削除 + `git lfs prune`を実行して、ローカルの保存領域から古いLFSファイルを削除します。 + プル + LFSオブジェクトをプル + `git lfs pull`を実行して、現在の参照とチェックアウトのすべてのGit LFSファイルをダウンロードします。 + プッシュ + LFSオブジェクトをプッシュ + キュー内の大容量ファイルをGit LFSエンドポイントにプッシュします。 + リモート: + {0}という名前のファイルをトラック + すべての*{0}ファイルをトラック + 履歴 + 著者 + 著者時間 + グラフ & コミットのタイトル + SHA + 日時 + {0} コミットを選択しました + 'Ctrl'キーまたは'Shift'キーを押すと、複数のコミットを選択できます。 + ⌘ または ⇧ キーを押して複数のコミットを選択します。 + TIPS: + キーボードショートカットを確認 + 総合 + 現在のポップアップをキャンセル + 新しくリポジトリをクローン + 現在のページを閉じる + 前のページに移動 + 次のページに移動 + 新しいページを作成 + 設定ダイアログを開く + リポジトリ + ステージ済みの変更をコミット + ステージ済みの変更をコミットしてプッシュ + 全ての変更をステージしてコミット + 選択中のコミットから新たなブランチを作成 + 選択した変更を破棄 + 直接フェッチを実行 + ダッシュボードモード (初期値) + 直接プルを実行 + 直接プッシュを実行 + 現在のリポジトリを強制的に再読み込み + 選択中の変更をステージ/アンステージ + コミット検索モード + '変更'に切り替える + '履歴'に切り替える + 'スタッシュ'に切り替える + テキストエディタ + 検索パネルを閉じる + 次のマッチを検索 + 前のマッチを検索 + 検索パネルを開く + ステージ + アンステージ + 破棄 + リポジトリの初期化 + パス: + チェリーピックが進行中です。'中止'を押すと元のHEADが復元されます。 + コミットを処理中 + マージリクエストが進行中です。'中止'を押すと元のHEADが復元されます。 + マージ中 + リベースが進行中です。'中止'を押すと元のHEADが復元されます。 + 停止しました + 元に戻す処理が進行中です。'中止'を押すと元のHEADが復元されます。 + コミットを元に戻しています + インタラクティブ リベース + 対象のブランチ: + On: + ブラウザで開く + リンクをコピー + エラー + 通知 + ブランチのマージ + 宛先: + マージオプション: + ソースブランチ: + マージ (複数) + すべての変更をコミット + マージ戦略: + 対象: + リポジトリノードの移動 + 親ノードを選択: + 名前: + Gitが設定されていません。まず[設定]に移動して設定を行ってください。 + アプリケーションデータのディレクトリを開く + 外部ツールで開く... + 任意。 + 新しいページを開く + ブックマーク + タブを閉じる + 他のタブを閉じる + 右のタブを閉じる + リポジトリパスをコピー + リポジトリ + 貼り付け + たった今 + {0} 分前 + 1 時間前 + {0} 時間前 + 昨日 + {0} 日前 + 先月 + {0} ヶ月前 + 昨年 + {0} 年前 + 設定 + AI + 差分分析プロンプト + APIキー + タイトル生成プロンプト + モデル + 名前 + サーバー + ストリーミングを有効化 + 外観 + デフォルトのフォント + エディタのタブ幅 + フォントサイズ + デフォルト + エディタ + 等幅フォント + テキストエディタでは等幅フォントのみを使用する + テーマ + テーマの上書き + タイトルバーの固定タブ幅を使用 + ネイティブウィンドウフレームを使用 + 差分/マージ ツール + インストール パス + 差分/マージ ツールのパスを入力 + ツール + 総合 + 起動時にアップデートを確認 + 日時のフォーマット + 言語 + コミット履歴 + グラフにコミット時間の代わりに著者の時間を表示する + コミット詳細に子コミットを表示 + コミットグラフにタグを表示 + コミットタイトル枠の大きさ + GIT + 自動CRLFを有効化 + デフォルトのクローンディレクトリ + ユーザー Eメールアドレス + グローバルgitのEメールアドレス + フェッチ時に--pruneを有効化 + インストール パス + HTTP SSL 検証を有効にする + ユーザー名 + グローバルのgitユーザー名 + Gitバージョン + Git (>= 2.23.0) はこのアプリで必要です + GPG 署名 + コミットにGPG署名を行う + タグにGPG署名を行う + GPGフォーマット + プログラムのインストールパス + インストールされたgpgプログラムのパスを入力 + ユーザー署名キー + ユーザーのGPG署名キー + 統合 + シェル/ターミナル + シェル/ターミナル + パス + リモートを削除 + 対象: + 作業ツリーを削除 + `$GIT_DIR/worktrees` の作業ツリー情報を削除 + プル + ブランチ: + すべてのブランチをフェッチ + 宛先: + ローカルの変更: + 破棄 + スタッシュして再適用 + タグなしでフェッチ + リモート: + プル (フェッチ & マージ) + マージの代わりにリベースを使用 + プッシュ + サブモジュールがプッシュされていることを確認 + 強制的にプッシュ + ローカル ブランチ: + リモート: + 変更をリモートにプッシュ + リモート ブランチ: + 追跡ブランチとして設定 + すべてのタグをプッシュ + リモートにタグをプッシュ + すべてのリモートにプッシュ + リモート: + タグ: + 終了 + 現在のブランチをリベース + ローカルの変更をスタッシュして再適用 + On: + リベース: + 更新 + リモートを追加 + リモートを編集 + 名前: + リモートの名前 + リポジトリのURL: + リモートのgitリポジトリのURL + URLをコピー + 削除... + 編集... + フェッチ + ブラウザで開く + 削除 + ワークツリーの削除を確認 + `--force` オプションを有効化 + 対象: + ブランチの名前を編集 + 新しい名前: + このブランチにつける一意な名前 + ブランチ: + 中止 + リモートから変更を自動取得中... + クリーンアップ(GC & Prune) + このリポジトリに対して`git gc`コマンドを実行します。 + すべてのフィルターをクリア + リポジトリの設定 + 続ける + カスタムアクション + カスタムアクションがありません + `--reflog` オプションを有効化 + ファイルブラウザーで開く + ブランチ/タグ/サブモジュールを検索 + 解除 + コミットグラフで非表示 + コミットグラフでフィルター + `--first-parent` オプションを有効化 + レイアウト + 水平 + 垂直 + コミットの並び順 + 日時 + トポロジカルソート + ローカル ブランチ + HEADに移動 + ブランチを作成 + 通知をクリア + グラフで現在のブランチを強調表示 + {0} で開く + 外部ツールで開く + 更新 + リモート + リモートを追加 + コミットを検索 + 著者 + コミッター + ファイル + メッセージ + SHA + 現在のブランチ + タグをツリーとして表示 + スキップ + 統計 + サブモジュール + サブモジュールを追加 + サブモジュールを更新 + タグ + 新しいタグを作成 + 作成者日時 + 名前 (昇順) + 名前 (降順) + ソート + ターミナルで開く + 履歴に相対時間を使用 + ワークツリー + ワークツリーを追加 + 削除 + GitリポジトリのURL + 現在のブランチをリビジョンにリセット + リセットモード: + 移動先: + 現在のブランチ: + ファイルエクスプローラーで表示 + コミットを戻す + コミット: + コミットの変更を戻す + コミットメッセージを書き直す + 改行には'Shift+Enter'キーを使用します。 'Enter"はOKボタンのホットキーとして機能します。 + 実行中です。しばらくお待ちください... + 保存 + 名前を付けて保存... + パッチが正常に保存されました! + リポジトリをスキャン + ルートディレクトリ: + 更新を確認 + 新しいバージョンのソフトウェアが利用可能です: + 更新の確認に失敗しました! + ダウンロード + このバージョンをスキップ + ソフトウェアの更新 + 利用可能なアップデートはありません + トラッキングブランチを設定 + ブランチ: + 上流ブランチを解除 + 上流ブランチ: + SHAをコピー + Go to + スカッシュコミット + 宛先: + SSH プライベートキー: + プライベートSSHキーストアのパス + スタート + スタッシュ + スタッシュ後に自動で復元 + 作業ファイルは変更されず、スタッシュが保存されます。 + 追跡されていないファイルを含める + ステージされたファイルを保持 + メッセージ: + オプション. このスタッシュの名前を入力 + ステージされた変更のみ + 選択したファイルの、ステージされた変更とステージされていない変更の両方がスタッシュされます!!! + ローカルの変更をスタッシュ + 適用 + 破棄 + パッチとして保存 + スタッシュを破棄 + 破棄: + スタッシュ + 変更 + スタッシュ + 統計 + コミット + コミッター + 月間 + 週間 + コミット: + 著者: + 概要 + サブモジュール + サブモジュールを追加 + 相対パスをコピー + ネストされたサブモジュールを取得する + サブモジュールのリポジトリを開く + 相対パス: + このモジュールを保存するフォルダの相対パス + サブモジュールを削除 + OK + タグ名をコピー + タグメッセージをコピー + ${0}$ を削除... + ${0}$ を ${1}$ にマージ... + ${0}$ をプッシュ... + URL: + サブモジュールを更新 + すべてのサブモジュール + 必要に応じて初期化 + 再帰的に更新 + サブモジュール: + --remoteオプションを使用 + 警告 + ようこそ + グループを作成 + サブグループを作成 + リポジトリをクローンする + 削除 + ドラッグ & ドロップでフォルダを追加できます. グループを作成したり、変更したりできます。 + 編集 + 別のグループに移動 + すべてのリポジトリを開く + リポジトリを開く + ターミナルを開く + デフォルトのクローンディレクトリ内のリポジトリを再スキャン + リポジトリを検索... + ソート + 変更 + Git Ignore + すべての*{0}ファイルを無視 + 同じフォルダ内の*{0}ファイルを無視 + 同じフォルダ内のファイルを無視 + このファイルのみを無視 + Amend + このファイルを今すぐステージできます。 + コミット + コミットしてプッシュ + メッセージのテンプレート/履歴 + クリックイベントをトリガー + コミット (Edit) + すべての変更をステージしてコミット + 空のコミットが検出されました。続行しますか? (--allow-empty) + 競合が検出されました + ファイルの競合は解決されました + 追跡されていないファイルを含める + 最近の入力メッセージはありません + コミットテンプレートはありません + サインオフ + ステージしたファイル + ステージを取り消し + すべてステージを取り消し + 未ステージのファイル + ステージへ移動 + すべてステージへ移動 + 変更されていないとみなしたものを表示 + テンプレート: ${0}$ + 選択したファイルを右クリックし、競合を解決する操作を選択してください。 + ワークスペース: + ワークスペースを設定... + ワークツリー + パスをコピー + ロック + 削除 + ロック解除 + From 17d285d9bf410a76b2ea32dcaccabd235b82367b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 7 Apr 2025 01:53:35 +0000 Subject: [PATCH 27/35] doc: Update translation status and missing keys --- TRANSLATION.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TRANSLATION.md b/TRANSLATION.md index 711564ef..b344e6a3 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -38,6 +38,16 @@ This document shows the translation status of each locale file in the repository +### ![ja__JP](https://img.shields.io/badge/ja__JP-99.73%25-yellow) + +
+Missing keys in ja_JP.axaml + +- Text.Repository.FilterCommits +- Text.Repository.Tags.OrderByNameDes + +
+ ### ![pt__BR](https://img.shields.io/badge/pt__BR-90.98%25-yellow)
From c615d04038cdbc1fda6f3a085070feb750803e15 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 7 Apr 2025 09:54:35 +0800 Subject: [PATCH 28/35] doc: update README.md for Japanese support Signed-off-by: leo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d63886ed..aacf222e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ * Supports Windows/macOS/Linux * Opensource/Free * Fast -* Deutsch/English/Español/Français/Italiano/Português/Русский/简体中文/繁體中文 +* Deutsch/English/Español/Français/Italiano/Português/Русский/简体中文/繁體中文/日本語 * Built-in light/dark themes * Customize theme * Visual commit graph From 8c9cf05c1d393bcfe1381b1358d3e4f33404cae9 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 7 Apr 2025 10:14:02 +0800 Subject: [PATCH 29/35] fix: renamed files are missing in commit changes and stash changes (#1151) Signed-off-by: leo --- src/Commands/CompareRevisions.cs | 18 +++++++++++++----- src/Commands/QueryStashChanges.cs | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/Commands/CompareRevisions.cs b/src/Commands/CompareRevisions.cs index e311a88e..c3206767 100644 --- a/src/Commands/CompareRevisions.cs +++ b/src/Commands/CompareRevisions.cs @@ -6,8 +6,10 @@ namespace SourceGit.Commands { public partial class CompareRevisions : Command { - [GeneratedRegex(@"^([MADRC])\s+(.+)$")] + [GeneratedRegex(@"^([MADC])\s+(.+)$")] private static partial Regex REG_FORMAT(); + [GeneratedRegex(@"^R[0-9]{0,4}\s+(.+)$")] + private static partial Regex REG_RENAME_FORMAT(); public CompareRevisions(string repo, string start, string end) { @@ -38,7 +40,17 @@ namespace SourceGit.Commands { var match = REG_FORMAT().Match(line); if (!match.Success) + { + match = REG_RENAME_FORMAT().Match(line); + if (match.Success) + { + var renamed = new Models.Change() { Path = match.Groups[1].Value }; + renamed.Set(Models.ChangeState.Renamed); + _changes.Add(renamed); + } + return; + } var change = new Models.Change() { Path = match.Groups[2].Value }; var status = match.Groups[1].Value; @@ -57,10 +69,6 @@ namespace SourceGit.Commands change.Set(Models.ChangeState.Deleted); _changes.Add(change); break; - case 'R': - change.Set(Models.ChangeState.Renamed); - _changes.Add(change); - break; case 'C': change.Set(Models.ChangeState.Copied); _changes.Add(change); diff --git a/src/Commands/QueryStashChanges.cs b/src/Commands/QueryStashChanges.cs index 7fc27ea3..92240569 100644 --- a/src/Commands/QueryStashChanges.cs +++ b/src/Commands/QueryStashChanges.cs @@ -9,8 +9,10 @@ namespace SourceGit.Commands /// public partial class QueryStashChanges : Command { - [GeneratedRegex(@"^([MADRC])\s+(.+)$")] + [GeneratedRegex(@"^([MADC])\s+(.+)$")] private static partial Regex REG_FORMAT(); + [GeneratedRegex(@"^R[0-9]{0,4}\s+(.+)$")] + private static partial Regex REG_RENAME_FORMAT(); public QueryStashChanges(string repo, string stash) { @@ -31,7 +33,17 @@ namespace SourceGit.Commands { var match = REG_FORMAT().Match(line); if (!match.Success) + { + match = REG_RENAME_FORMAT().Match(line); + if (match.Success) + { + var renamed = new Models.Change() { Path = match.Groups[1].Value }; + renamed.Set(Models.ChangeState.Renamed); + outs.Add(renamed); + } + continue; + } var change = new Models.Change() { Path = match.Groups[2].Value }; var status = match.Groups[1].Value; @@ -50,10 +62,6 @@ namespace SourceGit.Commands change.Set(Models.ChangeState.Deleted); outs.Add(change); break; - case 'R': - change.Set(Models.ChangeState.Renamed); - outs.Add(change); - break; case 'C': change.Set(Models.ChangeState.Copied); outs.Add(change); From ac7b02590ba846905b5492900e02a82b5852d01b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 7 Apr 2025 10:23:37 +0800 Subject: [PATCH 30/35] enhance: add comma between date and time (#1150) Signed-off-by: leo --- src/Models/DateTimeFormat.cs | 22 +++++++++++----------- src/Views/Histories.axaml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Models/DateTimeFormat.cs b/src/Models/DateTimeFormat.cs index 4e71a74f..4e8aa550 100644 --- a/src/Models/DateTimeFormat.cs +++ b/src/Models/DateTimeFormat.cs @@ -32,17 +32,17 @@ namespace SourceGit.Models public static readonly List Supported = new List { - new DateTimeFormat("yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss"), - new DateTimeFormat("yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss"), - new DateTimeFormat("yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss"), - new DateTimeFormat("MM/dd/yyyy", "MM/dd/yyyy HH:mm:ss"), - new DateTimeFormat("MM.dd.yyyy", "MM.dd.yyyy HH:mm:ss"), - new DateTimeFormat("MM-dd-yyyy", "MM-dd-yyyy HH:mm:ss"), - new DateTimeFormat("dd/MM/yyyy", "dd/MM/yyyy HH:mm:ss"), - new DateTimeFormat("dd.MM.yyyy", "dd.MM.yyyy HH:mm:ss"), - new DateTimeFormat("dd-MM-yyyy", "dd-MM-yyyy HH:mm:ss"), - new DateTimeFormat("MMM d yyyy", "MMM d yyyy HH:mm:ss"), - new DateTimeFormat("d MMM yyyy", "d MMM yyyy HH:mm:ss"), + new DateTimeFormat("yyyy/MM/dd", "yyyy/MM/dd, HH:mm:ss"), + new DateTimeFormat("yyyy.MM.dd", "yyyy.MM.dd, HH:mm:ss"), + new DateTimeFormat("yyyy-MM-dd", "yyyy-MM-dd, HH:mm:ss"), + new DateTimeFormat("MM/dd/yyyy", "MM/dd/yyyy, HH:mm:ss"), + new DateTimeFormat("MM.dd.yyyy", "MM.dd.yyyy, HH:mm:ss"), + new DateTimeFormat("MM-dd-yyyy", "MM-dd-yyyy, HH:mm:ss"), + new DateTimeFormat("dd/MM/yyyy", "dd/MM/yyyy, HH:mm:ss"), + new DateTimeFormat("dd.MM.yyyy", "dd.MM.yyyy, HH:mm:ss"), + new DateTimeFormat("dd-MM-yyyy", "dd-MM-yyyy, HH:mm:ss"), + new DateTimeFormat("MMM d yyyy", "MMM d yyyy, HH:mm:ss"), + new DateTimeFormat("d MMM yyyy", "d MMM yyyy, HH:mm:ss"), }; private static readonly DateTime _example = new DateTime(2025, 1, 31, 8, 0, 0, DateTimeKind.Local); diff --git a/src/Views/Histories.axaml b/src/Views/Histories.axaml index 4fd8909d..96340d1e 100644 --- a/src/Views/Histories.axaml +++ b/src/Views/Histories.axaml @@ -195,7 +195,7 @@ - + Date: Mon, 7 Apr 2025 04:37:58 +0200 Subject: [PATCH 31/35] In Local Changes, added filter-box in Staged area, to match Unstaged area (#1153) Also added minimal handling (RaiseException) if trying to commit with active filter (might commit more changes than visible, so disallow). Minor unification in unstageChanges() to make it more similar to StageChanges(). --- src/ViewModels/WorkingCopy.cs | 70 ++++++++++++++++++++++++++++------- src/Views/WorkingCopy.axaml | 39 +++++++++++++++++-- 2 files changed, 92 insertions(+), 17 deletions(-) diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 40b4c50c..3e6f6fbd 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -109,12 +109,28 @@ namespace SourceGit.ViewModels if (_isLoadingData) return; - VisibleUnstaged = GetVisibleUnstagedChanges(_unstaged); + VisibleUnstaged = GetVisibleChanges(_unstaged, _unstagedFilter); SelectedUnstaged = []; } } } + public string StagedFilter + { + get => _stagedFilter; + set + { + if (SetProperty(ref _stagedFilter, value)) + { + if (_isLoadingData) + return; + + VisibleStaged = GetVisibleChanges(_staged, _stagedFilter); + SelectedStaged = []; + } + } + } + public List Unstaged { get => _unstaged; @@ -133,6 +149,12 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _staged, value); } + public List VisibleStaged + { + get => _visibleStaged; + private set => SetProperty(ref _visibleStaged, value); + } + public List SelectedUnstaged { get => _selectedUnstaged; @@ -216,6 +238,9 @@ namespace SourceGit.ViewModels _visibleUnstaged.Clear(); OnPropertyChanged(nameof(VisibleUnstaged)); + _visibleStaged.Clear(); + OnPropertyChanged(nameof(VisibleStaged)); + _unstaged.Clear(); OnPropertyChanged(nameof(Unstaged)); @@ -269,7 +294,7 @@ namespace SourceGit.ViewModels } } - var visibleUnstaged = GetVisibleUnstagedChanges(unstaged); + var visibleUnstaged = GetVisibleChanges(unstaged, _unstagedFilter); var selectedUnstaged = new List(); foreach (var c in visibleUnstaged) { @@ -278,8 +303,10 @@ namespace SourceGit.ViewModels } var staged = GetStagedChanges(); + + var visibleStaged = GetVisibleChanges(staged, _stagedFilter); var selectedStaged = new List(); - foreach (var c in staged) + foreach (var c in visibleStaged) { if (lastSelectedStaged.Contains(c.Path)) selectedStaged.Add(c); @@ -290,6 +317,7 @@ namespace SourceGit.ViewModels _isLoadingData = true; HasUnsolvedConflicts = hasConflict; VisibleUnstaged = visibleUnstaged; + VisibleStaged = visibleStaged; Unstaged = unstaged; Staged = staged; SelectedUnstaged = selectedUnstaged; @@ -337,7 +365,7 @@ namespace SourceGit.ViewModels public void UnstageAll() { - UnstageChanges(_staged, null); + UnstageChanges(_visibleStaged, null); } public void Discard(List changes) @@ -350,6 +378,11 @@ namespace SourceGit.ViewModels { UnstagedFilter = string.Empty; } + + public void ClearStagedFilter() + { + StagedFilter = string.Empty; + } public async void UseTheirs(List changes) { @@ -1472,16 +1505,16 @@ namespace SourceGit.ViewModels return menu; } - private List GetVisibleUnstagedChanges(List unstaged) + private List GetVisibleChanges(List changes, string filter) { - if (string.IsNullOrEmpty(_unstagedFilter)) - return unstaged; + if (string.IsNullOrEmpty(filter)) + return changes; var visible = new List(); - foreach (var c in unstaged) + foreach (var c in changes) { - if (c.Path.Contains(_unstagedFilter, StringComparison.OrdinalIgnoreCase)) + if (c.Path.Contains(filter, StringComparison.OrdinalIgnoreCase)) visible.Add(c); } @@ -1599,7 +1632,8 @@ namespace SourceGit.ViewModels private async void UnstageChanges(List changes, Models.Change next) { - if (changes.Count == 0) + var count = changes.Count; + if (count == 0) return; // Use `_selectedStaged` instead of `SelectedStaged` to avoid UI refresh. @@ -1611,16 +1645,15 @@ namespace SourceGit.ViewModels { await Task.Run(() => new Commands.UnstageChangesForAmend(_repo.FullPath, changes).Exec()); } - else if (changes.Count == _staged.Count) + else if (count == _staged.Count) { await Task.Run(() => new Commands.Reset(_repo.FullPath).Exec()); } else { - for (int i = 0; i < changes.Count; i += 10) + for (int i = 0; i < count; i += 10) { - var count = Math.Min(10, changes.Count - i); - var step = changes.GetRange(i, count); + var step = changes.GetRange(i, Math.Min(10, count - i)); await Task.Run(() => new Commands.Reset(_repo.FullPath, step).Exec()); } } @@ -1650,6 +1683,13 @@ namespace SourceGit.ViewModels return; } + if (!string.IsNullOrEmpty(_stagedFilter)) + { + // FIXME - make this a proper warning message-box "Staged-area filter will not be applied to commit. Continue?" Yes/No + App.RaiseException(_repo.FullPath, "Committing with staged-area filter applied is NOT allowed!"); + return; + } + if (string.IsNullOrWhiteSpace(_commitMessage)) { App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!"); @@ -1729,11 +1769,13 @@ namespace SourceGit.ViewModels private List _unstaged = []; private List _visibleUnstaged = []; private List _staged = []; + private List _visibleStaged = []; private List _selectedUnstaged = []; private List _selectedStaged = []; private int _count = 0; private object _detailContext = null; private string _unstagedFilter = string.Empty; + private string _stagedFilter = string.Empty; private string _commitMessage = string.Empty; private bool _hasUnsolvedConflicts = false; diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index 4d79135d..6af2b448 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -129,7 +129,7 @@ Background="{DynamicResource Brush.Border0}"/> - + @@ -156,14 +156,47 @@ + + + + + + + + + + + + + - Date: Mon, 7 Apr 2025 11:45:14 +0800 Subject: [PATCH 32/35] code_review: PR #1153 - use a single filter for both unstage and staged files - show confirm dialog if staged files are displayed partially 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/ConfirmCommit.cs | 26 +++++ src/ViewModels/ConfirmCommitWithoutFiles.cs | 19 ---- src/ViewModels/WorkingCopy.cs | 75 +++++------- ...WithoutFiles.axaml => ConfirmCommit.axaml} | 6 +- ...tFiles.axaml.cs => ConfirmCommit.axaml.cs} | 10 +- src/Views/WorkingCopy.axaml | 107 +++++++----------- 9 files changed, 103 insertions(+), 143 deletions(-) create mode 100644 src/ViewModels/ConfirmCommit.cs delete mode 100644 src/ViewModels/ConfirmCommitWithoutFiles.cs rename src/Views/{ConfirmCommitWithoutFiles.axaml => ConfirmCommit.axaml} (92%) rename src/Views/{ConfirmCommitWithoutFiles.axaml.cs => ConfirmCommit.axaml.cs} (57%) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 5ff1e3a4..61140173 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -719,6 +719,7 @@ Trigger click event Commit (Edit) Stage all changes and commit + You have staged {0} file(s) but only {1} file(s) displayed ({2} files are filtered out). Do you want to continue? Empty commit detected! Do you want to continue (--allow-empty)? CONFLICTS DETECTED FILE CONFLICTS ARE RESOLVED diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 8d2b4f1e..fec5c780 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -723,6 +723,7 @@ 触发点击事件 提交(修改原始提交) 自动暂存所有变更并提交 + 当前有 {0} 个文件在暂存区中,但仅显示了 {1} 个文件({2} 个文件被过滤掉了),是否继续提交? 提交未包含变更文件!是否继续(--allow-empty)? 检测到冲突 文件冲突已解决 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 8e823f68..66bcc33a 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -722,6 +722,7 @@ 觸發點擊事件 提交 (修改原始提交) 自動暫存全部變更並提交 + 您已暫存 {0} 檔案,但只顯示 {1} 檔案 ({2} 檔案被篩選器隱藏)。您要繼續嗎? 未包含任何檔案變更! 您是否仍要提交 (--allow-empty)? 檢測到衝突 檔案衝突已解決 diff --git a/src/ViewModels/ConfirmCommit.cs b/src/ViewModels/ConfirmCommit.cs new file mode 100644 index 00000000..cea56948 --- /dev/null +++ b/src/ViewModels/ConfirmCommit.cs @@ -0,0 +1,26 @@ +using System; + +namespace SourceGit.ViewModels +{ + public class ConfirmCommit + { + public string Message + { + get; + private set; + } + + public ConfirmCommit(string message, Action onSure) + { + Message = message; + _onSure = onSure; + } + + public void Continue() + { + _onSure?.Invoke(); + } + + private Action _onSure; + } +} diff --git a/src/ViewModels/ConfirmCommitWithoutFiles.cs b/src/ViewModels/ConfirmCommitWithoutFiles.cs deleted file mode 100644 index 3249fba8..00000000 --- a/src/ViewModels/ConfirmCommitWithoutFiles.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace SourceGit.ViewModels -{ - public class ConfirmCommitWithoutFiles - { - public ConfirmCommitWithoutFiles(WorkingCopy wc, bool autoPush) - { - _wc = wc; - _autoPush = autoPush; - } - - public void Continue() - { - _wc.CommitWithoutFiles(_autoPush); - } - - private readonly WorkingCopy _wc; - private bool _autoPush; - } -} diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 3e6f6fbd..a0933ea3 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -99,38 +99,23 @@ namespace SourceGit.ViewModels } } - public string UnstagedFilter + public string Filter { - get => _unstagedFilter; + get => _filter; set { - if (SetProperty(ref _unstagedFilter, value)) + if (SetProperty(ref _filter, value)) { if (_isLoadingData) return; - VisibleUnstaged = GetVisibleChanges(_unstaged, _unstagedFilter); + VisibleUnstaged = GetVisibleChanges(_unstaged); + VisibleStaged = GetVisibleChanges(_staged); SelectedUnstaged = []; } } } - public string StagedFilter - { - get => _stagedFilter; - set - { - if (SetProperty(ref _stagedFilter, value)) - { - if (_isLoadingData) - return; - - VisibleStaged = GetVisibleChanges(_staged, _stagedFilter); - SelectedStaged = []; - } - } - } - public List Unstaged { get => _unstaged; @@ -294,7 +279,7 @@ namespace SourceGit.ViewModels } } - var visibleUnstaged = GetVisibleChanges(unstaged, _unstagedFilter); + var visibleUnstaged = GetVisibleChanges(unstaged); var selectedUnstaged = new List(); foreach (var c in visibleUnstaged) { @@ -304,7 +289,7 @@ namespace SourceGit.ViewModels var staged = GetStagedChanges(); - var visibleStaged = GetVisibleChanges(staged, _stagedFilter); + var visibleStaged = GetVisibleChanges(staged); var selectedStaged = new List(); foreach (var c in visibleStaged) { @@ -374,14 +359,9 @@ namespace SourceGit.ViewModels _repo.ShowPopup(new Discard(_repo, changes)); } - public void ClearUnstagedFilter() + public void ClearFilter() { - UnstagedFilter = string.Empty; - } - - public void ClearStagedFilter() - { - StagedFilter = string.Empty; + Filter = string.Empty; } public async void UseTheirs(List changes) @@ -571,11 +551,6 @@ namespace SourceGit.ViewModels DoCommit(false, true, false); } - public void CommitWithoutFiles(bool autoPush) - { - DoCommit(false, autoPush, true); - } - public ContextMenu CreateContextMenuForUnstagedChanges() { if (_selectedUnstaged == null || _selectedUnstaged.Count == 0) @@ -1505,16 +1480,16 @@ namespace SourceGit.ViewModels return menu; } - private List GetVisibleChanges(List changes, string filter) + private List GetVisibleChanges(List changes) { - if (string.IsNullOrEmpty(filter)) + if (string.IsNullOrEmpty(_filter)) return changes; var visible = new List(); foreach (var c in changes) { - if (c.Path.Contains(filter, StringComparison.OrdinalIgnoreCase)) + if (c.Path.Contains(_filter, StringComparison.OrdinalIgnoreCase)) visible.Add(c); } @@ -1675,7 +1650,7 @@ namespace SourceGit.ViewModels DetailContext = new DiffContext(_repo.FullPath, new Models.DiffOption(change, isUnstaged), _detailContext as DiffContext); } - private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty) + private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty = false, bool confirmWithFilter = false) { if (!_repo.CanCreatePopup()) { @@ -1683,10 +1658,17 @@ namespace SourceGit.ViewModels return; } - if (!string.IsNullOrEmpty(_stagedFilter)) + if (!string.IsNullOrEmpty(_filter) && _staged.Count > _visibleStaged.Count && !confirmWithFilter) { - // FIXME - make this a proper warning message-box "Staged-area filter will not be applied to commit. Continue?" Yes/No - App.RaiseException(_repo.FullPath, "Committing with staged-area filter applied is NOT allowed!"); + var confirmMessage = App.Text("WorkingCopy.ConfirmCommitWithFilter", _staged.Count, _visibleStaged.Count, _staged.Count - _visibleStaged.Count); + App.OpenDialog(new Views.ConfirmCommit() + { + DataContext = new ConfirmCommit(confirmMessage, () => + { + DoCommit(autoStage, autoPush, allowEmpty, true); + }) + }); + return; } @@ -1700,9 +1682,13 @@ namespace SourceGit.ViewModels { if ((autoStage && _count == 0) || (!autoStage && _staged.Count == 0)) { - App.OpenDialog(new Views.ConfirmCommitWithoutFiles() + var confirmMessage = App.Text("WorkingCopy.ConfirmCommitWithoutFiles"); + App.OpenDialog(new Views.ConfirmCommit() { - DataContext = new ConfirmCommitWithoutFiles(this, autoPush) + DataContext = new ConfirmCommit(confirmMessage, () => + { + DoCommit(autoStage, autoPush, true, confirmWithFilter); + }) }); return; @@ -1774,8 +1760,7 @@ namespace SourceGit.ViewModels private List _selectedStaged = []; private int _count = 0; private object _detailContext = null; - private string _unstagedFilter = string.Empty; - private string _stagedFilter = string.Empty; + private string _filter = string.Empty; private string _commitMessage = string.Empty; private bool _hasUnsolvedConflicts = false; diff --git a/src/Views/ConfirmCommitWithoutFiles.axaml b/src/Views/ConfirmCommit.axaml similarity index 92% rename from src/Views/ConfirmCommitWithoutFiles.axaml rename to src/Views/ConfirmCommit.axaml index 4c9fd1c8..77bbdb30 100644 --- a/src/Views/ConfirmCommitWithoutFiles.axaml +++ b/src/Views/ConfirmCommit.axaml @@ -5,8 +5,8 @@ xmlns:v="using:SourceGit.Views" xmlns:vm="using:SourceGit.ViewModels" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="SourceGit.Views.ConfirmCommitWithoutFiles" - x:DataType="vm:ConfirmCommitWithoutFiles" + x:Class="SourceGit.Views.ConfirmCommit" + x:DataType="vm:ConfirmCommit" x:Name="ThisControl" Icon="/App.ico" Title="{DynamicResource Text.Warn}" @@ -38,7 +38,7 @@ - + diff --git a/src/Views/ConfirmCommitWithoutFiles.axaml.cs b/src/Views/ConfirmCommit.axaml.cs similarity index 57% rename from src/Views/ConfirmCommitWithoutFiles.axaml.cs rename to src/Views/ConfirmCommit.axaml.cs index 342600fc..1cf770cb 100644 --- a/src/Views/ConfirmCommitWithoutFiles.axaml.cs +++ b/src/Views/ConfirmCommit.axaml.cs @@ -2,20 +2,16 @@ using Avalonia.Interactivity; namespace SourceGit.Views { - public partial class ConfirmCommitWithoutFiles : ChromelessWindow + public partial class ConfirmCommit : ChromelessWindow { - public ConfirmCommitWithoutFiles() + public ConfirmCommit() { InitializeComponent(); } private void Sure(object _1, RoutedEventArgs _2) { - if (DataContext is ViewModels.ConfirmCommitWithoutFiles vm) - { - vm.Continue(); - } - + (DataContext as ViewModels.ConfirmCommit)?.Continue(); Close(); } diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index 6af2b448..94dd0c30 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -19,13 +19,46 @@ + + + + + + + + + + + + + + - + @@ -75,40 +108,8 @@ - - - - - - - - - - - - - - - - + @@ -155,41 +156,9 @@ ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StagedChangeViewMode, Mode=TwoWay}"/> - - - - - - - - - - - - - - Date: Mon, 7 Apr 2025 12:00:45 +0800 Subject: [PATCH 33/35] version: Release 2025.12 Signed-off-by: leo --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 75c26f38..8283ecf3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2025.11 \ No newline at end of file +2025.12 \ No newline at end of file From 81f02a20c5708653939fc08aaaa30d094a0ea992 Mon Sep 17 00:00:00 2001 From: qiufeng <172344058@qq.com> Date: Sat, 12 Apr 2025 11:45:52 +0800 Subject: [PATCH 34/35] Using the new syntax --- src/ViewModels/Launcher.cs | 63 +++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 9ae99b33..8df914fb 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -48,7 +48,7 @@ namespace SourceGit.ViewModels { _ignoreIndexChange = true; - Pages = new AvaloniaList(); + Pages = []; AddNewTab(); var pref = Preferences.Instance; @@ -205,8 +205,7 @@ namespace SourceGit.ViewModels return; } - if (page == null) - page = _activePage; + page ??= _activePage; var removeIdx = Pages.IndexOf(page); var activeIdx = Pages.IndexOf(_activePage); @@ -239,7 +238,7 @@ namespace SourceGit.ViewModels CloseRepositoryInTab(one); } - Pages = new AvaloniaList { ActivePage }; + Pages = [ActivePage]; ActiveWorkspace.ActiveIdx = 0; OnPropertyChanged(nameof(Pages)); @@ -360,9 +359,11 @@ namespace SourceGit.ViewModels var icon = App.CreateMenuIcon(workspace.IsActive ? "Icons.Check" : "Icons.Workspace"); icon.Fill = workspace.Brush; - var item = new MenuItem(); - item.Header = workspace.Name; - item.Icon = icon; + var item = new MenuItem + { + Header = workspace.Name, + Icon = icon + }; item.Click += (_, e) => { if (!workspace.IsActive) @@ -376,8 +377,10 @@ namespace SourceGit.ViewModels menu.Items.Add(new MenuItem() { Header = "-" }); - var configure = new MenuItem(); - configure.Header = App.Text("Workspace.Configure"); + var configure = new MenuItem + { + Header = App.Text("Workspace.Configure") + }; configure.Click += (_, e) => { App.OpenDialog(new Views.ConfigureWorkspace() { DataContext = new ConfigureWorkspace() }); @@ -394,9 +397,11 @@ namespace SourceGit.ViewModels return null; var menu = new ContextMenu(); - var close = new MenuItem(); - close.Header = App.Text("PageTabBar.Tab.Close"); - close.InputGesture = KeyGesture.Parse(OperatingSystem.IsMacOS() ? "⌘+W" : "Ctrl+W"); + var close = new MenuItem + { + Header = App.Text("PageTabBar.Tab.Close"), + InputGesture = KeyGesture.Parse(OperatingSystem.IsMacOS() ? "⌘+W" : "Ctrl+W") + }; close.Click += (_, e) => { CloseTab(page); @@ -404,8 +409,10 @@ namespace SourceGit.ViewModels }; menu.Items.Add(close); - var closeOthers = new MenuItem(); - closeOthers.Header = App.Text("PageTabBar.Tab.CloseOther"); + var closeOthers = new MenuItem + { + Header = App.Text("PageTabBar.Tab.CloseOther") + }; closeOthers.Click += (_, e) => { CloseOtherTabs(); @@ -413,8 +420,10 @@ namespace SourceGit.ViewModels }; menu.Items.Add(closeOthers); - var closeRight = new MenuItem(); - closeRight.Header = App.Text("PageTabBar.Tab.CloseRight"); + var closeRight = new MenuItem + { + Header = App.Text("PageTabBar.Tab.CloseRight") + }; closeRight.Click += (_, e) => { CloseRightTabs(); @@ -424,9 +433,11 @@ namespace SourceGit.ViewModels if (page.Node.IsRepository) { - var bookmark = new MenuItem(); - bookmark.Header = App.Text("PageTabBar.Tab.Bookmark"); - bookmark.Icon = App.CreateMenuIcon("Icons.Bookmark"); + var bookmark = new MenuItem + { + Header = App.Text("PageTabBar.Tab.Bookmark"), + Icon = App.CreateMenuIcon("Icons.Bookmark") + }; for (int i = 0; i < Models.Bookmarks.Supported.Count; i++) { @@ -436,8 +447,10 @@ namespace SourceGit.ViewModels icon.Fill = Models.Bookmarks.Brushes[i]; var dupIdx = i; - var setter = new MenuItem(); - setter.Header = icon; + var setter = new MenuItem + { + Header = icon + }; setter.Click += (_, e) => { page.Node.Bookmark = dupIdx; @@ -448,9 +461,11 @@ namespace SourceGit.ViewModels menu.Items.Add(new MenuItem() { Header = "-" }); menu.Items.Add(bookmark); - var copyPath = new MenuItem(); - copyPath.Header = App.Text("PageTabBar.Tab.CopyPath"); - copyPath.Icon = App.CreateMenuIcon("Icons.Copy"); + var copyPath = new MenuItem + { + Header = App.Text("PageTabBar.Tab.CopyPath"), + Icon = App.CreateMenuIcon("Icons.Copy") + }; copyPath.Click += (_, e) => { page.CopyPath(); From 478280625dc94b5069ae8dc1f935aa5a29ffc5de Mon Sep 17 00:00:00 2001 From: qiufeng <172344058@qq.com> Date: Sat, 12 Apr 2025 14:08:53 +0800 Subject: [PATCH 35/35] using the new syntax --- src/App.Commands.cs | 19 ++++--- src/App.axaml.cs | 14 +++--- src/Converters/DoubleConverters.cs | 12 ++--- src/Converters/FilterModeConverters.cs | 15 +++--- src/Converters/IntConverters.cs | 26 ++++------ .../InteractiveRebaseActionConverters.cs | 50 +++++++------------ src/Converters/ListConverters.cs | 10 ++-- src/Converters/PathConverters.cs | 2 +- src/Converters/StringConverters.cs | 16 +++--- 9 files changed, 69 insertions(+), 95 deletions(-) diff --git a/src/App.Commands.cs b/src/App.Commands.cs index 85a75829..3733587a 100644 --- a/src/App.Commands.cs +++ b/src/App.Commands.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Windows.Input; using Avalonia.Controls; @@ -37,16 +37,15 @@ namespace SourceGit } } - public static readonly Command OpenPreferencesCommand = new Command(_ => OpenDialog(new Views.Preferences())); - public static readonly Command OpenHotkeysCommand = new Command(_ => OpenDialog(new Views.Hotkeys())); - public static readonly Command OpenAppDataDirCommand = new Command(_ => Native.OS.OpenInFileManager(Native.OS.DataDir)); - public static readonly Command OpenAboutCommand = new Command(_ => OpenDialog(new Views.About())); - public static readonly Command CheckForUpdateCommand = new Command(_ => (Current as App)?.Check4Update(true)); - public static readonly Command QuitCommand = new Command(_ => Quit(0)); - public static readonly Command CopyTextBlockCommand = new Command(p => + public static readonly Command OpenPreferencesCommand = new(_ => OpenDialog(new Views.Preferences())); + public static readonly Command OpenHotkeysCommand = new(_ => OpenDialog(new Views.Hotkeys())); + public static readonly Command OpenAppDataDirCommand = new(_ => Native.OS.OpenInFileManager(Native.OS.DataDir)); + public static readonly Command OpenAboutCommand = new(_ => OpenDialog(new Views.About())); + public static readonly Command CheckForUpdateCommand = new(_ => (Current as App)?.Check4Update(true)); + public static readonly Command QuitCommand = new(_ => Quit(0)); + public static readonly Command CopyTextBlockCommand = new(p => { - var textBlock = p as TextBlock; - if (textBlock == null) + if (p is not TextBlock textBlock) return; if (textBlock.Inlines is { Count: > 0 } inlines) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 0448a247..f6a5fb22 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -283,10 +283,12 @@ namespace SourceGit public static Avalonia.Controls.Shapes.Path CreateMenuIcon(string key) { - var icon = new Avalonia.Controls.Shapes.Path(); - icon.Width = 12; - icon.Height = 12; - icon.Stretch = Stretch.Uniform; + var icon = new Avalonia.Controls.Shapes.Path + { + Width = 12, + Height = 12, + Stretch = Stretch.Uniform + }; var geo = Current?.FindResource(key) as StreamGeometry; if (geo != null) @@ -429,7 +431,7 @@ namespace SourceGit if (!File.Exists(doneFile)) return true; - var done = File.ReadAllText(doneFile).Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); + var done = File.ReadAllText(doneFile).Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries); if (done.Length > collection.Jobs.Count) return true; diff --git a/src/Converters/DoubleConverters.cs b/src/Converters/DoubleConverters.cs index 5b7c0a03..c9bd9890 100644 --- a/src/Converters/DoubleConverters.cs +++ b/src/Converters/DoubleConverters.cs @@ -4,16 +4,12 @@ namespace SourceGit.Converters { public static class DoubleConverters { - public static readonly FuncValueConverter Increase = - new FuncValueConverter(v => v + 1.0); + public static readonly FuncValueConverter Increase = new(v => v + 1.0); - public static readonly FuncValueConverter Decrease = - new FuncValueConverter(v => v - 1.0); + public static readonly FuncValueConverter Decrease = new(v => v - 1.0); - public static readonly FuncValueConverter ToPercentage = - new FuncValueConverter(v => (v * 100).ToString("F3") + "%"); + public static readonly FuncValueConverter ToPercentage = new(v => $"{v * 100:F3}%"); - public static readonly FuncValueConverter OneMinusToPercentage = - new FuncValueConverter(v => ((1.0 - v) * 100).ToString("F3") + "%"); + public static readonly FuncValueConverter OneMinusToPercentage = new(v => $"{(1.0 - v) * 100:F3}%"); } } diff --git a/src/Converters/FilterModeConverters.cs b/src/Converters/FilterModeConverters.cs index c486af5e..12ca1c9b 100644 --- a/src/Converters/FilterModeConverters.cs +++ b/src/Converters/FilterModeConverters.cs @@ -6,17 +6,14 @@ namespace SourceGit.Converters public static class FilterModeConverters { public static readonly FuncValueConverter ToBorderBrush = - new FuncValueConverter(v => + new(v => { - switch (v) + return v switch { - case Models.FilterMode.Included: - return Brushes.Green; - case Models.FilterMode.Excluded: - return Brushes.Red; - default: - return Brushes.Transparent; - } + Models.FilterMode.Included => Brushes.Green, + Models.FilterMode.Excluded => Brushes.Red, + _ => Brushes.Transparent, + }; }); } } diff --git a/src/Converters/IntConverters.cs b/src/Converters/IntConverters.cs index f21c5d24..c2542b2a 100644 --- a/src/Converters/IntConverters.cs +++ b/src/Converters/IntConverters.cs @@ -7,32 +7,24 @@ namespace SourceGit.Converters { public static class IntConverters { - public static readonly FuncValueConverter IsGreaterThanZero = - new FuncValueConverter(v => v > 0); + public static readonly FuncValueConverter IsGreaterThanZero = new(v => v > 0); - public static readonly FuncValueConverter IsGreaterThanFour = - new FuncValueConverter(v => v > 4); + public static readonly FuncValueConverter IsGreaterThanFour = new(v => v > 4); - public static readonly FuncValueConverter IsZero = - new FuncValueConverter(v => v == 0); + public static readonly FuncValueConverter IsZero = new(v => v == 0); - public static readonly FuncValueConverter IsOne = - new FuncValueConverter(v => v == 1); + public static readonly FuncValueConverter IsOne = new(v => v == 1); - public static readonly FuncValueConverter IsNotOne = - new FuncValueConverter(v => v != 1); + public static readonly FuncValueConverter IsNotOne = new(v => v != 1); - public static readonly FuncValueConverter IsSubjectLengthBad = - new FuncValueConverter(v => v > ViewModels.Preferences.Instance.SubjectGuideLength); + public static readonly FuncValueConverter IsSubjectLengthBad = new(v => v > ViewModels.Preferences.Instance.SubjectGuideLength); - public static readonly FuncValueConverter IsSubjectLengthGood = - new FuncValueConverter(v => v <= ViewModels.Preferences.Instance.SubjectGuideLength); + public static readonly FuncValueConverter IsSubjectLengthGood = new(v => v <= ViewModels.Preferences.Instance.SubjectGuideLength); - public static readonly FuncValueConverter ToTreeMargin = - new FuncValueConverter(v => new Thickness(v * 16, 0, 0, 0)); + public static readonly FuncValueConverter ToTreeMargin = new(v => new Thickness(v * 16, 0, 0, 0)); public static readonly FuncValueConverter ToBookmarkBrush = - new FuncValueConverter(bookmark => + new(bookmark => { if (bookmark == 0) return Application.Current?.FindResource("Brush.FG1") as IBrush; diff --git a/src/Converters/InteractiveRebaseActionConverters.cs b/src/Converters/InteractiveRebaseActionConverters.cs index dbd183bd..7478e3d0 100644 --- a/src/Converters/InteractiveRebaseActionConverters.cs +++ b/src/Converters/InteractiveRebaseActionConverters.cs @@ -6,46 +6,34 @@ namespace SourceGit.Converters public static class InteractiveRebaseActionConverters { public static readonly FuncValueConverter ToIconBrush = - new FuncValueConverter(v => + new(v => { - switch (v) + return v switch { - case Models.InteractiveRebaseAction.Pick: - return Brushes.Green; - case Models.InteractiveRebaseAction.Edit: - return Brushes.Orange; - case Models.InteractiveRebaseAction.Reword: - return Brushes.Orange; - case Models.InteractiveRebaseAction.Squash: - return Brushes.LightGray; - case Models.InteractiveRebaseAction.Fixup: - return Brushes.LightGray; - default: - return Brushes.Red; - } + Models.InteractiveRebaseAction.Pick => Brushes.Green, + Models.InteractiveRebaseAction.Edit => Brushes.Orange, + Models.InteractiveRebaseAction.Reword => Brushes.Orange, + Models.InteractiveRebaseAction.Squash => Brushes.LightGray, + Models.InteractiveRebaseAction.Fixup => Brushes.LightGray, + _ => Brushes.Red, + }; }); public static readonly FuncValueConverter ToName = - new FuncValueConverter(v => + new(v => { - switch (v) + return v switch { - case Models.InteractiveRebaseAction.Pick: - return "Pick"; - case Models.InteractiveRebaseAction.Edit: - return "Edit"; - case Models.InteractiveRebaseAction.Reword: - return "Reword"; - case Models.InteractiveRebaseAction.Squash: - return "Squash"; - case Models.InteractiveRebaseAction.Fixup: - return "Fixup"; - default: - return "Drop"; - } + Models.InteractiveRebaseAction.Pick => "Pick", + Models.InteractiveRebaseAction.Edit => "Edit", + Models.InteractiveRebaseAction.Reword => "Reword", + Models.InteractiveRebaseAction.Squash => "Squash", + Models.InteractiveRebaseAction.Fixup => "Fixup", + _ => "Drop", + }; }); public static readonly FuncValueConverter CanEditMessage = - new FuncValueConverter(v => v == Models.InteractiveRebaseAction.Reword || v == Models.InteractiveRebaseAction.Squash); + new(v => v == Models.InteractiveRebaseAction.Reword || v == Models.InteractiveRebaseAction.Squash); } } diff --git a/src/Converters/ListConverters.cs b/src/Converters/ListConverters.cs index 81cac8b7..9c379e6b 100644 --- a/src/Converters/ListConverters.cs +++ b/src/Converters/ListConverters.cs @@ -8,18 +8,18 @@ namespace SourceGit.Converters public static class ListConverters { public static readonly FuncValueConverter ToCount = - new FuncValueConverter(v => v == null ? " (0)" : $" ({v.Count})"); + new(v => v == null ? " (0)" : $" ({v.Count})"); public static readonly FuncValueConverter IsNullOrEmpty = - new FuncValueConverter(v => v == null || v.Count == 0); + new(v => v == null || v.Count == 0); public static readonly FuncValueConverter IsNotNullOrEmpty = - new FuncValueConverter(v => v != null && v.Count > 0); + new(v => v != null && v.Count > 0); public static readonly FuncValueConverter, List> Top100Changes = - new FuncValueConverter, List>(v => (v == null || v.Count < 100) ? v : v.GetRange(0, 100)); + new(v => (v == null || v.Count < 100) ? v : v.GetRange(0, 100)); public static readonly FuncValueConverter IsOnlyTop100Shows = - new FuncValueConverter(v => v != null && v.Count > 100); + new(v => v != null && v.Count > 100); } } diff --git a/src/Converters/PathConverters.cs b/src/Converters/PathConverters.cs index dd7cfa49..bd945304 100644 --- a/src/Converters/PathConverters.cs +++ b/src/Converters/PathConverters.cs @@ -22,7 +22,7 @@ namespace SourceGit.Converters var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var prefixLen = home.EndsWith('/') ? home.Length - 1 : home.Length; if (v.StartsWith(home, StringComparison.Ordinal)) - return "~" + v.Substring(prefixLen); + return $"~{v.AsSpan()[prefixLen..]}"; return v; }); diff --git a/src/Converters/StringConverters.cs b/src/Converters/StringConverters.cs index 5e4608c5..f90e18a4 100644 --- a/src/Converters/StringConverters.cs +++ b/src/Converters/StringConverters.cs @@ -21,7 +21,7 @@ namespace SourceGit.Converters } } - public static readonly ToLocaleConverter ToLocale = new ToLocaleConverter(); + public static readonly ToLocaleConverter ToLocale = new(); public class ToThemeConverter : IValueConverter { @@ -46,7 +46,7 @@ namespace SourceGit.Converters } } - public static readonly ToThemeConverter ToTheme = new ToThemeConverter(); + public static readonly ToThemeConverter ToTheme = new(); public class FormatByResourceKeyConverter : IValueConverter { @@ -62,24 +62,24 @@ namespace SourceGit.Converters } } - public static readonly FormatByResourceKeyConverter FormatByResourceKey = new FormatByResourceKeyConverter(); + public static readonly FormatByResourceKeyConverter FormatByResourceKey = new(); public static readonly FuncValueConverter ToShortSHA = - new FuncValueConverter(v => v == null ? string.Empty : (v.Length > 10 ? v.Substring(0, 10) : v)); + new(v => v == null ? string.Empty : (v.Length > 10 ? v.Substring(0, 10) : v)); public static readonly FuncValueConverter TrimRefsPrefix = - new FuncValueConverter(v => + new(v => { if (v == null) return string.Empty; if (v.StartsWith("refs/heads/", StringComparison.Ordinal)) - return v.Substring(11); + return v[11..]; if (v.StartsWith("refs/remotes/", StringComparison.Ordinal)) - return v.Substring(13); + return v[13..]; return v; }); public static readonly FuncValueConverter ContainsSpaces = - new FuncValueConverter(v => v != null && v.Contains(' ')); + new(v => v != null && v.Contains(' ')); } }