From 310c78669384cae551f2c22dab67fa58d39a15b7 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 11:54:18 +0800 Subject: [PATCH 01/53] feature: ignore case when finding visual studio solution file Signed-off-by: leo --- src/Native/Windows.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index a57d26d2..3c56edd3 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -353,23 +353,26 @@ namespace SourceGit.Native private string GenerateCommandlineArgsForVisualStudio(string repo) { - var sln = FindVSSolutionFile(repo, 4); + var sln = FindVSSolutionFile(new DirectoryInfo(repo), 4); return string.IsNullOrEmpty(sln) ? $"\"{repo}\"" : $"\"{sln}\""; } - private string FindVSSolutionFile(string path, int leftDepth) + private string FindVSSolutionFile(DirectoryInfo dir, int leftDepth) { - var found = Directory.GetFiles(path, "*.sln", SearchOption.TopDirectoryOnly); - if (found != null && found.Length > 0) - return Path.GetFullPath(found[0]); + var files = dir.GetFiles(); + foreach (var f in files) + { + if (f.Name.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)) + return f.FullName; + } if (leftDepth <= 0) return null; - var subfolders = Directory.GetDirectories(path); - foreach (var subfolder in subfolders) + var subDirs = dir.GetDirectories(); + foreach (var subDir in subDirs) { - var first = FindVSSolutionFile(subfolder, leftDepth - 1); + var first = FindVSSolutionFile(subDir, leftDepth - 1); if (!string.IsNullOrEmpty(first)) return first; } From 64860950c776d17fb929546ec46e05e52f527ad5 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 12:03:47 +0800 Subject: [PATCH 02/53] localization: update en_US Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2e96e391..b9371f2e 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -274,7 +274,7 @@ Discard {0} files... Discard Changes in Selected Line(s) Open External Merge Tool - Save As Patch... + Save as Patch... Stage Stage {0} files Stage Changes in Selected Line(s) @@ -398,7 +398,7 @@ Name: Git has NOT been configured. Please to go [Preference] and configure it first. Open App Data Dir - Open With... + Open with... Optional. Create New Page Bookmark @@ -530,15 +530,15 @@ Custom Actions No Custom Actions Enable '--reflog' Option - Open In File Browser + Open in File Browser Search Branches/Tags/Submodules FILTERED BY: LOCAL BRANCHES - Navigate To HEAD + Navigate to HEAD Enable '--first-parent' Option Create Branch - Open In {0} - Open In External Tools + Open in {0} + Open in External Tools Refresh REMOTES ADD REMOTE @@ -556,7 +556,7 @@ UPDATE SUBMODULE TAGS NEW TAG - Open In Terminal + Open in Terminal WORKTREES ADD WORKTREE PRUNE From 163e8cc0a4f70c9d760b3cfb751d2791f512c65d Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 15:31:55 +0800 Subject: [PATCH 03/53] feature: add context menu for issue link in commit details panel (#651) Signed-off-by: leo --- src/Models/CustomAction.cs | 2 +- src/Native/Windows.cs | 4 +-- src/Resources/Locales/en_US.axaml | 2 ++ src/Views/Blame.axaml.cs | 2 +- src/Views/BranchCompare.axaml.cs | 2 +- src/Views/BranchTree.axaml.cs | 6 ++--- src/Views/CommitBaseInfo.axaml.cs | 4 +-- src/Views/CommitChanges.axaml.cs | 2 +- src/Views/CommitDetail.axaml.cs | 2 +- src/Views/CommitMessagePresenter.cs | 36 ++++++++++++++++++++++++- src/Views/ContextMenuExtension.cs | 26 ------------------ src/Views/Histories.axaml.cs | 2 +- src/Views/Launcher.axaml.cs | 2 +- src/Views/LauncherTabBar.axaml.cs | 2 +- src/Views/Repository.axaml.cs | 4 +-- src/Views/RepositoryToolbar.axaml.cs | 14 +++++----- src/Views/RevisionCompare.axaml.cs | 2 +- src/Views/RevisionFileTreeView.axaml.cs | 2 +- src/Views/RevisionFiles.axaml.cs | 2 +- src/Views/StashesPage.axaml.cs | 4 +-- src/Views/TagsView.axaml.cs | 2 +- src/Views/TextDiffView.axaml.cs | 2 +- src/Views/Welcome.axaml.cs | 2 +- src/Views/WorkingCopy.axaml.cs | 14 +++++----- 24 files changed, 76 insertions(+), 66 deletions(-) delete mode 100644 src/Views/ContextMenuExtension.cs diff --git a/src/Models/CustomAction.cs b/src/Models/CustomAction.cs index 2a400b02..8452a42d 100644 --- a/src/Models/CustomAction.cs +++ b/src/Models/CustomAction.cs @@ -30,7 +30,7 @@ namespace SourceGit.Models public string Arguments { - get => _arguments; + get => _arguments; set => SetProperty(ref _arguments, value); } diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index 3c56edd3..48fbb287 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -325,8 +325,8 @@ namespace SourceGit.Native if (localMachine.OpenSubKey(@"SOFTWARE\Classes\VisualStudio.Launcher.sln\CLSID") is Microsoft.Win32.RegistryKey launcher) { // Get actual path to the executable - if (launcher.GetValue(string.Empty) is string CLSID && - localMachine.OpenSubKey(@$"SOFTWARE\Classes\CLSID\{CLSID}\LocalServer32") is Microsoft.Win32.RegistryKey devenv && + if (launcher.GetValue(string.Empty) is string CLSID && + localMachine.OpenSubKey(@$"SOFTWARE\Classes\CLSID\{CLSID}\LocalServer32") is Microsoft.Win32.RegistryKey devenv && devenv.GetValue(string.Empty) is string localServer32) { return localServer32!.Trim('\"'); diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index b9371f2e..15c8b6ee 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -387,6 +387,8 @@ Interactive Rebase Target Branch: On: + Open in Browser + Copy Link ERROR NOTICE Merge Branch diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs index 164b89de..d32e4370 100644 --- a/src/Views/Blame.axaml.cs +++ b/src/Views/Blame.axaml.cs @@ -407,8 +407,8 @@ namespace SourceGit.Views var menu = new ContextMenu(); menu.Items.Add(copy); + menu.Open(TextArea.TextView); - TextArea.TextView.OpenContextMenu(menu); e.Handled = true; } diff --git a/src/Views/BranchCompare.axaml.cs b/src/Views/BranchCompare.axaml.cs index 90ec1af5..ca90a180 100644 --- a/src/Views/BranchCompare.axaml.cs +++ b/src/Views/BranchCompare.axaml.cs @@ -15,7 +15,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.BranchCompare vm && sender is ChangeCollectionView view) { var menu = vm.CreateChangeContextMenu(); - view.OpenContextMenu(menu); + menu?.Open(view); } e.Handled = true; diff --git a/src/Views/BranchTree.axaml.cs b/src/Views/BranchTree.axaml.cs index 081160d0..e96b2594 100644 --- a/src/Views/BranchTree.axaml.cs +++ b/src/Views/BranchTree.axaml.cs @@ -374,7 +374,7 @@ namespace SourceGit.Views if (selected.Count == 1 && selected[0] is ViewModels.BranchTreeNode { Backend: Models.Remote remote }) { var menu = repo.CreateContextMenuForRemote(remote); - this.OpenContextMenu(menu); + menu?.Open(this); return; } @@ -391,7 +391,7 @@ namespace SourceGit.Views var menu = branch.IsLocal ? repo.CreateContextMenuForLocalBranch(branch) : repo.CreateContextMenuForRemoteBranch(branch); - this.OpenContextMenu(menu); + menu?.Open(this); } else if (branches.Find(x => x.IsCurrent) == null) { @@ -405,7 +405,7 @@ namespace SourceGit.Views ev.Handled = true; }; menu.Items.Add(deleteMulti); - this.OpenContextMenu(menu); + menu?.Open(this); } } diff --git a/src/Views/CommitBaseInfo.axaml.cs b/src/Views/CommitBaseInfo.axaml.cs index e31ddfba..7992b40d 100644 --- a/src/Views/CommitBaseInfo.axaml.cs +++ b/src/Views/CommitBaseInfo.axaml.cs @@ -68,7 +68,7 @@ namespace SourceGit.Views private void OnOpenWebLink(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.CommitDetail detail) + if (DataContext is ViewModels.CommitDetail detail && sender is Control control) { var links = WebLinks; if (links.Count > 1) @@ -88,7 +88,7 @@ namespace SourceGit.Views menu.Items.Add(item); } - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); } else if (links.Count == 1) { diff --git a/src/Views/CommitChanges.axaml.cs b/src/Views/CommitChanges.axaml.cs index f197bdd5..c3d30018 100644 --- a/src/Views/CommitChanges.axaml.cs +++ b/src/Views/CommitChanges.axaml.cs @@ -16,7 +16,7 @@ namespace SourceGit.Views DataContext is ViewModels.CommitDetail vm) { var menu = vm.CreateChangeContextMenu(selected[0]); - view.OpenContextMenu(menu); + menu?.Open(view); } e.Handled = true; diff --git a/src/Views/CommitDetail.axaml.cs b/src/Views/CommitDetail.axaml.cs index 999d1c07..f0599c66 100644 --- a/src/Views/CommitDetail.axaml.cs +++ b/src/Views/CommitDetail.axaml.cs @@ -26,7 +26,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.CommitDetail detail && sender is Grid grid && grid.DataContext is Models.Change change) { var menu = detail.CreateChangeContextMenu(change); - grid.OpenContextMenu(menu); + menu?.Open(grid); } e.Handled = true; diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 55e1dfb1..112c1f57 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -176,7 +176,41 @@ namespace SourceGit.Views } else { - Native.OS.OpenBrowser(_lastHover.Link); + var point = e.GetCurrentPoint(this); + var link = _lastHover.Link; + + if (point.Properties.IsLeftButtonPressed) + { + Native.OS.OpenBrowser(link); + } + else if (point.Properties.IsRightButtonPressed) + { + var open = new MenuItem(); + open.Header = App.Text("IssueLinkCM.OpenInBrowser"); + open.Icon = App.CreateMenuIcon("Icons.OpenWith"); + open.Click += (_, ev) => + { + ev.Handled = true; + + var parentView = this.FindAncestorOfType(); + if (parentView is { DataContext: ViewModels.CommitDetail detail }) + detail.NavigateTo(link); + }; + + var copy = new MenuItem(); + copy.Header = App.Text("IssueLinkCM.CopyLink"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, ev) => + { + App.CopyText(link); + ev.Handled = true; + }; + + var menu = new ContextMenu(); + menu.Items.Add(open); + menu.Items.Add(copy); + menu.Open(this); + } } e.Handled = true; diff --git a/src/Views/ContextMenuExtension.cs b/src/Views/ContextMenuExtension.cs deleted file mode 100644 index 2abcf2b9..00000000 --- a/src/Views/ContextMenuExtension.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.ComponentModel; -using Avalonia.Controls; - -namespace SourceGit.Views -{ - public static class ContextMenuExtension - { - public static void OpenContextMenu(this Control control, ContextMenu menu) - { - if (menu == null) - return; - - menu.PlacementTarget = control; - menu.Closing += OnContextMenuClosing; // Clear context menu because it is dynamic. - - control.ContextMenu = menu; - control.ContextMenu?.Open(); - } - - private static void OnContextMenuClosing(object sender, CancelEventArgs e) - { - if (sender is ContextMenu menu && menu.PlacementTarget != null) - menu.PlacementTarget.ContextMenu = null; - } - } -} diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 137fd298..43258dd7 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -706,7 +706,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: > 0 } } list) { var menu = histories.MakeContextMenu(list); - list.OpenContextMenu(menu); + menu?.Open(list); } e.Handled = true; } diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index b4a44868..99916da3 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -250,7 +250,7 @@ namespace SourceGit.Views if (sender is Button btn && DataContext is ViewModels.Launcher launcher) { var menu = launcher.CreateContextForWorkspace(); - btn.OpenContextMenu(menu); + menu?.Open(btn); } e.Handled = true; diff --git a/src/Views/LauncherTabBar.axaml.cs b/src/Views/LauncherTabBar.axaml.cs index 3258a09c..f8c9107c 100644 --- a/src/Views/LauncherTabBar.axaml.cs +++ b/src/Views/LauncherTabBar.axaml.cs @@ -234,7 +234,7 @@ namespace SourceGit.Views if (sender is Border border && DataContext is ViewModels.Launcher vm) { var menu = vm.CreateContextForPageTab(border.DataContext as ViewModels.LauncherPage); - border.OpenContextMenu(menu); + menu?.Open(border); } e.Handled = true; diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 499f5e62..dec3d447 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -189,7 +189,7 @@ namespace SourceGit.Views if (sender is ListBox { SelectedItem: Models.Submodule submodule } grid && DataContext is ViewModels.Repository repo) { var menu = repo.CreateContextMenuForSubmodule(submodule.Path); - grid.OpenContextMenu(menu); + menu?.Open(grid); } e.Handled = true; @@ -210,7 +210,7 @@ namespace SourceGit.Views if (sender is ListBox { SelectedItem: Models.Worktree worktree } grid && DataContext is ViewModels.Repository repo) { var menu = repo.CreateContextMenuForWorktree(worktree); - grid.OpenContextMenu(menu); + menu?.Open(grid); } e.Handled = true; diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index 55132620..a4a05dc4 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -17,7 +17,7 @@ namespace SourceGit.Views if (sender is Button button && DataContext is ViewModels.Repository repo) { var menu = repo.CreateContextMenuForExternalTools(); - button.OpenContextMenu(menu); + menu?.Open(button); e.Handled = true; } } @@ -72,10 +72,10 @@ namespace SourceGit.Views private void OpenGitFlowMenu(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.Repository repo) + if (DataContext is ViewModels.Repository repo && sender is Control control) { var menu = repo.CreateContextMenuForGitFlow(); - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); } e.Handled = true; @@ -83,10 +83,10 @@ namespace SourceGit.Views private void OpenGitLFSMenu(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.Repository repo) + if (DataContext is ViewModels.Repository repo && sender is Control control) { var menu = repo.CreateContextMenuForGitLFS(); - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); } e.Handled = true; @@ -94,10 +94,10 @@ namespace SourceGit.Views private void OpenCustomActionMenu(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.Repository repo) + if (DataContext is ViewModels.Repository repo && sender is Control control) { var menu = repo.CreateContextMenuForCustomAction(); - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); } e.Handled = true; diff --git a/src/Views/RevisionCompare.axaml.cs b/src/Views/RevisionCompare.axaml.cs index e3ecb2b7..b484b78f 100644 --- a/src/Views/RevisionCompare.axaml.cs +++ b/src/Views/RevisionCompare.axaml.cs @@ -15,7 +15,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.RevisionCompare vm && sender is ChangeCollectionView view) { var menu = vm.CreateChangeContextMenu(); - view.OpenContextMenu(menu); + menu?.Open(view); } e.Handled = true; diff --git a/src/Views/RevisionFileTreeView.axaml.cs b/src/Views/RevisionFileTreeView.axaml.cs index e198f6f0..af9beb7d 100644 --- a/src/Views/RevisionFileTreeView.axaml.cs +++ b/src/Views/RevisionFileTreeView.axaml.cs @@ -229,7 +229,7 @@ namespace SourceGit.Views if (obj.Type != Models.ObjectType.Tree) { var menu = vm.CreateRevisionFileContextMenu(obj); - grid.OpenContextMenu(menu); + menu?.Open(grid); } } diff --git a/src/Views/RevisionFiles.axaml.cs b/src/Views/RevisionFiles.axaml.cs index b76e1360..53c36b1c 100644 --- a/src/Views/RevisionFiles.axaml.cs +++ b/src/Views/RevisionFiles.axaml.cs @@ -95,8 +95,8 @@ namespace SourceGit.Views var menu = new ContextMenu(); menu.Items.Add(copy); + menu.Open(TextArea.TextView); - TextArea.TextView.OpenContextMenu(menu); e.Handled = true; } diff --git a/src/Views/StashesPage.axaml.cs b/src/Views/StashesPage.axaml.cs index f3048889..af32cb2c 100644 --- a/src/Views/StashesPage.axaml.cs +++ b/src/Views/StashesPage.axaml.cs @@ -28,7 +28,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.StashesPage vm && sender is Border border) { var menu = vm.MakeContextMenu(border.DataContext as Models.Stash); - border.OpenContextMenu(menu); + menu?.Open(border); } e.Handled = true; } @@ -38,7 +38,7 @@ namespace SourceGit.Views if (DataContext is ViewModels.StashesPage vm && sender is Grid grid) { var menu = vm.MakeContextMenuForChange(grid.DataContext as Models.Change); - grid.OpenContextMenu(menu); + menu?.Open(grid); } e.Handled = true; } diff --git a/src/Views/TagsView.axaml.cs b/src/Views/TagsView.axaml.cs index 29b591fb..8d4168b2 100644 --- a/src/Views/TagsView.axaml.cs +++ b/src/Views/TagsView.axaml.cs @@ -225,7 +225,7 @@ namespace SourceGit.Views if (selected != null && DataContext is ViewModels.Repository repo) { var menu = repo.CreateContextMenuForTag(selected); - control.OpenContextMenu(menu); + menu?.Open(control); } e.Handled = true; diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 63833fc1..99e499b0 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -589,8 +589,8 @@ namespace SourceGit.Views var menu = new ContextMenu(); menu.Items.Add(copy); + menu.Open(TextArea.TextView); - TextArea.TextView.OpenContextMenu(menu); e.Handled = true; } diff --git a/src/Views/Welcome.axaml.cs b/src/Views/Welcome.axaml.cs index a8045aa9..a292a6ef 100644 --- a/src/Views/Welcome.axaml.cs +++ b/src/Views/Welcome.axaml.cs @@ -117,7 +117,7 @@ namespace SourceGit.Views if (sender is Grid { DataContext: ViewModels.RepositoryNode node } grid) { var menu = ViewModels.Welcome.Instance.CreateContextMenu(node); - grid.OpenContextMenu(menu); + menu?.Open(grid); e.Handled = true; } } diff --git a/src/Views/WorkingCopy.axaml.cs b/src/Views/WorkingCopy.axaml.cs index f64e1a30..df45a7f1 100644 --- a/src/Views/WorkingCopy.axaml.cs +++ b/src/Views/WorkingCopy.axaml.cs @@ -31,27 +31,27 @@ namespace SourceGit.Views { var menu = vm.CreateContextMenuForCommitMessages(); menu.Placement = PlacementMode.TopEdgeAlignedLeft; - button.OpenContextMenu(menu); + menu?.Open(button); e.Handled = true; } } private void OnUnstagedContextRequested(object sender, ContextRequestedEventArgs e) { - if (DataContext is ViewModels.WorkingCopy vm) + if (DataContext is ViewModels.WorkingCopy vm && sender is Control control) { var menu = vm.CreateContextMenuForUnstagedChanges(); - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); e.Handled = true; } } private void OnStagedContextRequested(object sender, ContextRequestedEventArgs e) { - if (DataContext is ViewModels.WorkingCopy vm) + if (DataContext is ViewModels.WorkingCopy vm && sender is Control control) { var menu = vm.CreateContextMenuForStagedChanges(); - (sender as Control)?.OpenContextMenu(menu); + menu?.Open(control); e.Handled = true; } } @@ -136,10 +136,10 @@ namespace SourceGit.Views private void OnOpenOpenAIHelper(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.WorkingCopy vm) + if (DataContext is ViewModels.WorkingCopy vm && sender is Control control) { var menu = vm.CreateContextForOpenAI(); - (sender as Button)?.OpenContextMenu(menu); + menu?.Open(control); } e.Handled = true; From 25028efa4d246423f36e449b72107474e928e6a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Nov 2024 07:32:24 +0000 Subject: [PATCH 04/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6a688d99..2ae6a047 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-96.05%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-97.08%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.72%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.79%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.77%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.79%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.71%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.71%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.71%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index b6c255a1..7e7e9e2d 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 96.05% +### de_DE.axaml: 95.77%
@@ -24,6 +24,8 @@ - Text.Configure.OpenAI.Prefered.Tip - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink - Text.Preference.AI.AnalyzeDiffPrompt - Text.Preference.AI.GenerateSubjectPrompt - Text.Preference.AI.Name @@ -34,7 +36,7 @@
-### es_ES.axaml: 97.08% +### es_ES.axaml: 96.79%
@@ -56,6 +58,8 @@ - Text.Configure.OpenAI.Prefered.Tip - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink - Text.Preference.AI.Name - Text.Repository.CustomActions - Text.Repository.CustomActions.Empty @@ -63,7 +67,7 @@
-### fr_FR.axaml: 87.72% +### fr_FR.axaml: 87.46%
@@ -119,6 +123,8 @@ - Text.Histories.Tips.Prefix - Text.Hotkeys.Repo.CommitWithAutoStage - Text.Hotkeys.Repo.DiscardSelected +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode - Text.MoveRepositoryNode.Target - Text.Preference.AI @@ -156,7 +162,7 @@
-### pt_BR.axaml: 90.79% +### pt_BR.axaml: 90.52%
@@ -209,6 +215,8 @@ - Text.FileHistory.FileContent - Text.FileHistory.FileChange - Text.GitLFS.Locks.OnlyMine +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode - Text.MoveRepositoryNode.Target - Text.Preference.AI.Name @@ -228,32 +236,35 @@
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.71%
Missing Keys - +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.71%
Missing Keys - +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.71%
Missing Keys - +- Text.IssueLinkCM.OpenInBrowser +- Text.IssueLinkCM.CopyLink
From fb9e342ee03da1ae05d24cb818a1fa3708bab383 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 15:34:25 +0800 Subject: [PATCH 05/53] localization: add translations for zh_CN and zh_TW Signed-off-by: leo --- src/Resources/Locales/zh_CN.axaml | 2 ++ src/Resources/Locales/zh_TW.axaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 469a88bb..d0975d2e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -390,6 +390,8 @@ 交互式变基 目标分支 : 起始提交 : + 在浏览器中访问 + 复制链接地址 出错了 系统提示 合并分支 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 77a832ff..4a121feb 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -390,6 +390,8 @@ 互動式重定基底 目標分支: 起始提交: + 在瀏覽器中存取網址 + 複製網址 發生錯誤 系統提示 合併分支 From 2f628b0f0652327390abd1e3dfcc4bf091bd32c5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Nov 2024 07:35:07 +0000 Subject: [PATCH 06/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2ae6a047..361f97e5 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.77%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.79%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.71%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.71%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.71%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.77%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.79%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.71%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 7e7e9e2d..48bf29a8 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -247,24 +247,22 @@ -### zh_CN.axaml: 99.71% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink +
-### zh_TW.axaml: 99.71% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink +
From 635396008dee70a9b94a45710a6dc06d82aca13f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 15:48:28 +0800 Subject: [PATCH 07/53] fix: clicking `Open in Browser` context menu item of issue link does not work (#651) Signed-off-by: leo --- src/Views/CommitMessagePresenter.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 112c1f57..862ce9e1 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -190,11 +190,8 @@ namespace SourceGit.Views open.Icon = App.CreateMenuIcon("Icons.OpenWith"); open.Click += (_, ev) => { + Native.OS.OpenBrowser(link); ev.Handled = true; - - var parentView = this.FindAncestorOfType(); - if (parentView is { DataContext: ViewModels.CommitDetail detail }) - detail.NavigateTo(link); }; var copy = new MenuItem(); From ad01eb442d2b8e184e8dbca718f16a38816d9592 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 16:00:40 +0800 Subject: [PATCH 08/53] localization: change `OpenAI` to `AI` Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 6 +++--- src/Resources/Locales/zh_CN.axaml | 8 ++++---- src/Resources/Locales/zh_TW.axaml | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 15c8b6ee..eeecbb35 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -18,8 +18,8 @@ Optional. Default is the destination folder name. Track Branch: Tracking remote branch - OpenAI Assistant - Use OpenAI to generate commit message + AI Assistant + Use AI to generate commit message Patch Error Raise errors and refuses to apply the patch @@ -166,7 +166,7 @@ Rule Name: Result URL: Please use $1, $2 to access regex groups values. - OPEN AI + AI Prefered Service: If the 'Prefered Service' is set, SourceGit will only use it in this repository. Otherwise, if there is more than one service available, a context menu to choose one of them will be shown. HTTP Proxy diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index d0975d2e..19f07073 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -21,8 +21,8 @@ 选填。默认使用目标文件夹名称。 跟踪分支 设置上游跟踪分支 - OpenAI助手 - 使用OpenAI助手生成提交信息 + AI助手 + 使用AI助手生成提交信息 应用补丁(apply) 错误 输出错误,并终止应用补丁 @@ -169,9 +169,9 @@ 规则名 : 为ISSUE生成的URL链接 : 可在URL中使用$1,$2等变量填入正则表达式匹配的内容 - OPEN AI + AI 启用特定服务 : - 当【启用特定服务】被设置时,SourceGit将在本仓库中仅使用该服务。否则将弹出可用的OpenAI服务列表供用户选择。 + 当【启用特定服务】被设置时,SourceGit将在本仓库中仅使用该服务。否则将弹出可用的AI服务列表供用户选择。 HTTP代理 HTTP网络代理 用户名 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 4a121feb..2ff3db37 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -21,8 +21,8 @@ 選填。預設使用目標資料夾名稱。 追蹤分支 設定遠端追蹤分支 - OpenAI 助理 - 使用 OpenAI 產生提交訊息 + AI 助理 + 使用 AI 產生提交訊息 套用修補檔 (apply patch) 錯誤 輸出錯誤,並中止套用修補檔 @@ -169,9 +169,9 @@ 規則名稱: 為 Issue 產生的網址連結: 可在網址中使用 $1、$2 等變數填入正規表達式相符的內容 - OpenAI + AI 偏好服務: - 設定 [偏好服務] 後,SourceGit 將於此存放庫中使用該服務,否則會顯示 OpenAI 服務列表供使用者選擇。 + 設定 [偏好服務] 後,SourceGit 將於此存放庫中使用該服務,否則會顯示 AI 服務列表供使用者選擇。 HTTP 代理 HTTP 網路代理 使用者名稱 @@ -423,7 +423,7 @@ 一年前 {0} 年前 偏好設定 - OpenAI + AI 伺服器 API 金鑰 模型 From 779b38be2847cb2e935abeb9b14c9c55f931129e Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 16:04:19 +0800 Subject: [PATCH 09/53] localization: change `OpenAI` to `AI` Signed-off-by: leo --- src/Resources/Locales/en_US.axaml | 2 +- src/Resources/Locales/zh_CN.axaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index eeecbb35..bed03b0a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -420,7 +420,7 @@ Last year {0} years ago Preference - OPEN AI + AI Analyze Diff Prompt API Key Generate Subject Prompt diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 19f07073..c148c229 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -423,7 +423,7 @@ 一年前 {0}年前 偏好设置 - OPEN AI + AI Analyze Diff Prompt API密钥 Generate Subject Prompt From 1a8acbf934f82e0926497dca47ee5e55a47856f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20W?= <44604769+goran-w@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:32:51 +0100 Subject: [PATCH 10/53] feature: diff - toggle show all lines (#615) (#652) * Renamed 1 of 2 SyncScrollOffset props, for clarity The property "SyncScrollOffset" in TextDiff is distinct from the one with the same name in TwoSideTextDiff. These two properties are used in separate (though slightly related) ways and are not really connected. The one in TwoSideTextDiff is mainly used to keep the scroll-pos of the two SingleSideTextDiffPresenter views in sync (aligned), while the one in TextDiff is used only to preserve/reset the scroll-pos in the single CombinedTextDiffPresenter view when (re)loading Diff Content (so not really syncing anything). To clarify this and to make the two properties more distinguishable, I renamed the one in TextDiff to simply "ScrollOffset". * Added icon and string for "Show All Lines" New StreamGeometry "Icons.Lines.All" using SVG path from "text_line_spacing_regular" at https://avaloniaui.github.io/icons.html. New String "Text.Diff.VisualLines.All" for en_US locale (no translations yet). * Implemented new TextDiff feature "Show All Lines" (toggle) * Added new ToggleButton in DiffView toolbar, visible when IsTextDiff, disabling the buttons "Increase/Decrease Number of Visible Lines" when on. * Added new Preference property "UseFullTextDiff". * Added StyledProperty "UseFullTextDiffProperty" in TextDiffView, with a DataTemplate binding to the corresponding preference property. * When changed, UseFullTextDiffProperty is handled identically as UseSideBySideDiffProperty (via new helper method RefreshContent(), for unification with OnDataContextChanged()). * Added new method DiffContext.ToggleFullTextDiff() for changing the preference property and reloading the diff content. * Implemented the new feature by overriding the "unified" (number of context lines) for Commands.Diff() with a very high number. NOTE: The number used (~1 billion) is supposed to be the highest one working on Mac, according to this forum comment: https://stackoverflow.com/questions/28727424/for-git-diff-is-there-a-uinfinity-option-to-show-the-whole-file#comment135202820_28846576 --- src/Models/DiffResult.cs | 2 +- src/Resources/Icons.axaml | 1 + src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/DiffContext.cs | 15 ++++++- src/ViewModels/Preference.cs | 7 +++ src/Views/DiffView.axaml | 26 +++++++++-- src/Views/TextDiffView.axaml.cs | 72 +++++++++++++++++++------------ 7 files changed, 90 insertions(+), 34 deletions(-) diff --git a/src/Models/DiffResult.cs b/src/Models/DiffResult.cs index e7cecaa3..61255ae9 100644 --- a/src/Models/DiffResult.cs +++ b/src/Models/DiffResult.cs @@ -63,7 +63,7 @@ namespace SourceGit.Models { public string File { get; set; } = string.Empty; public List Lines { get; set; } = new List(); - public Vector SyncScrollOffset { get; set; } = Vector.Zero; + public Vector ScrollOffset { get; set; } = Vector.Zero; public int MaxLineNumber = 0; public string Repo { get; set; } = null; diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 6cf53d96..bd2e551b 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -65,6 +65,7 @@ M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zM139 832V192c0-6 4-11 11-11h331v661H149c-6 0-11-4-11-11zm747 0c0 6-4 11-11 11H544v-661H875c6 0 11 4 11 11v640z M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zm-725 64h725c6 0 11 4 11 11v288h-747V192c0-6 4-11 11-11zm725 661H149c-6 0-11-4-11-11V544h747V832c0 6-4 11-11 11z M40 9 15 23 15 31 9 28 9 20 34 5 24 0 0 14 0 34 25 48 25 28 49 14zM26 29 26 48 49 34 49 15z + M19,13 C19.4142,13 19.75,13.3358 19.75,13.75 L19.75,18.4393 L20.4697,17.7197 C20.7626,17.4268 21.2374,17.4268 21.5303,17.7197 C21.8232,18.0126 21.8232,18.4874 21.5303,18.7803 L19.5303,20.7803 C19.4584,20.8522 19.3755,20.9065 19.2871,20.9431 C19.2099,20.9751 19.1262,20.9946 19.0386,20.999 L19,21 L19,21 C18.8983,21 18.8013,20.9798 18.7129,20.9431 C18.6245,20.9065 18.5416,20.8522 18.4697,20.7803 L16.4697,18.7803 C16.1768,18.4874 16.1768,18.0126 16.4697,17.7197 C16.7626,17.4268 17.2374,17.4268 17.5303,17.7197 L18.25,18.4393 L18.25,13.75 C18.25,13.3358 18.5858,13 19,13 Z M11.25,18 C11.6642,18 12,18.3358 12,18.75 C12,19.1296833 11.7178347,19.4434889 11.3517677,19.4931531 L11.25,19.5 L2.75,19.5 C2.33579,19.5 2,19.1642 2,18.75 C2,18.3703167 2.28215688,18.0565111 2.64823019,18.0068469 L2.75,18 L11.25,18 Z M14.25,11.5 C14.6642,11.5 15,11.8358 15,12.25 C15,12.6642 14.6642,13 14.25,13 L2.75,13 C2.33579,13 2,12.6642 2,12.25 C2,11.8358 2.33579,11.5 2.75,11.5 L14.25,11.5 Z M19.0022,3 C19.1031,3.0003 19.1993,3.02051 19.2871,3.05691 C19.3755,3.09351 19.4584,3.14776 19.5303,3.21967 L21.5303,5.21967 C21.8232,5.51256 21.8232,5.98744 21.5303,6.28033 C21.2374,6.57322 20.7626,6.57322 20.4697,6.28033 L19.75,5.56066 L19.75,10.25 C19.75,10.6642 19.4142,11 19,11 C18.5858,11 18.25,10.6642 18.25,10.25 L18.25,5.56066 L17.5303,6.28033 C17.2374,6.57322 16.7626,6.57322 16.4697,6.28033 C16.1768,5.98744 16.1768,5.51256 16.4697,5.21967 L18.4697,3.21967 C18.58634,3.102974 18.731972,3.0327676 18.8834536,3.00906104 L19.0022,3 Z M11.25,5 C11.6642,5 12,5.33579 12,5.75 C12,6.16421 11.6642,6.5 11.25,6.5 L2.75,6.5 C2.33579,6.5 2,6.16421 2,5.75 C2,5.33579 2.33579,5 2.75,5 L11.25,5 Z M408 232C408 210 426 192 448 192h416a40 40 0 110 80H448a40 40 0 01-40-40zM408 512c0-22 18-40 40-40h416a40 40 0 110 80H448A40 40 0 01408 512zM448 752A40 40 0 00448 832h416a40 40 0 100-80H448zM32 480l132 0 0-128 64 0 0 128 132 0 0 64-132 0 0 128-64 0 0-128-132 0Z M408 232C408 210 426 192 448 192h416a40 40 0 110 80H448a40 40 0 01-40-40zM408 512c0-22 18-40 40-40h416a40 40 0 110 80H448A40 40 0 01408 512zM448 752A40 40 0 00448 832h416a40 40 0 100-80H448zM32 480l328 0 0 64-328 0Z M 968 418 l -95 94 c -59 59 -146 71 -218 37 L 874 331 a 64 64 0 0 0 0 -90 L 783 150 a 64 64 0 0 0 -90 0 L 475 368 c -34 -71 -22 -159 37 -218 l 94 -94 c 75 -75 196 -75 271 0 l 90 90 c 75 75 75 196 0 271 z M 332 693 a 64 64 0 0 1 0 -90 l 271 -271 c 25 -25 65 -25 90 0 s 25 65 0 90 L 422 693 a 64 64 0 0 1 -90 0 z M 151 783 l 90 90 a 64 64 0 0 0 90 0 l 218 -218 c 34 71 22 159 -37 218 l -86 94 a 192 192 0 0 1 -271 0 l -98 -98 a 192 192 0 0 1 0 -271 l 94 -86 c 59 -59 146 -71 218 -37 L 151 693 a 64 64 0 0 0 0 90 z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index bed03b0a..eb1c6de3 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -246,6 +246,7 @@ Syntax Highlighting Line Word Wrap Open in Merge Tool + Show All Lines Decrease Number of Visible Lines Increase Number of Visible Lines SELECT FILE TO VIEW CHANGES diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index 1a48c8e0..cfb9fa79 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -78,6 +78,12 @@ namespace SourceGit.ViewModels LoadDiffContent(); } + public void ToggleFullTextDiff() + { + Preference.Instance.UseFullTextDiff = !Preference.Instance.UseFullTextDiff; + LoadDiffContent(); + } + public void IncrUnified() { UnifiedLines = _unifiedLines + 1; @@ -109,7 +115,12 @@ namespace SourceGit.ViewModels Task.Run(() => { - var latest = new Commands.Diff(_repo, _option, _unifiedLines, _ignoreWhitespace).Result(); + // NOTE: Here we override the UnifiedLines value (if UseFullTextDiff is on). + // There is no way to tell a git-diff to use "ALL lines of context", + // so instead we set a very high number for the "lines of context" parameter. + var numLines = Preference.Instance.UseFullTextDiff ? 999999999 : _unifiedLines; + + var latest = new Commands.Diff(_repo, _option, numLines, _ignoreWhitespace).Result(); var rs = null as object; if (latest.TextDiff != null) @@ -203,7 +214,7 @@ namespace SourceGit.ViewModels Dispatcher.UIThread.Post(() => { if (_content is Models.TextDiff old && rs is Models.TextDiff cur && old.File == cur.File) - cur.SyncScrollOffset = old.SyncScrollOffset; + cur.ScrollOffset = old.ScrollOffset; FileModeChange = latest.FileModeChange; Content = rs; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 2741650c..efd31b72 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -186,6 +186,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _showHiddenSymbolsInDiffView, value); } + public bool UseFullTextDiff + { + get => _useFullTextDiff; + set => SetProperty(ref _useFullTextDiff, value); + } + public Models.ChangeViewMode UnstagedChangeViewMode { get => _unstagedChangeViewMode; @@ -591,6 +597,7 @@ namespace SourceGit.ViewModels private bool _useSyntaxHighlighting = false; private bool _enableDiffViewWordWrap = false; private bool _showHiddenSymbolsInDiffView = false; + private bool _useFullTextDiff = false; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 8ccc25bb..9109e504 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,11 +34,24 @@ + + + @@ -46,8 +59,13 @@ Width="32" Command="{Binding DecrUnified}" IsVisible="{Binding IsTextDiff}" - ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.Decr}" - IsEnabled="{Binding UnifiedLines, Converter={x:Static c:IntConverters.IsGreaterThanFour}}"> + ToolTip.Tip="{DynamicResource Text.Diff.VisualLines.Decr}"> + + + + + + @@ -211,7 +229,9 @@ - + diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 99e499b0..02b753ba 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -902,7 +902,7 @@ namespace SourceGit.Views var scroller = this.FindDescendantOfType(); if (scroller != null) { - scroller.Bind(ScrollViewer.OffsetProperty, new Binding("SyncScrollOffset", BindingMode.TwoWay)); + scroller.Bind(ScrollViewer.OffsetProperty, new Binding("ScrollOffset", BindingMode.TwoWay)); scroller.GotFocus += OnTextViewScrollGotFocus; } } @@ -1205,6 +1205,15 @@ namespace SourceGit.Views set => SetValue(UseSideBySideDiffProperty, value); } + public static readonly StyledProperty UseFullTextDiffProperty = + AvaloniaProperty.Register(nameof(UseFullTextDiff)); + + public bool UseFullTextDiff + { + get => GetValue(UseFullTextDiffProperty); + set => SetValue(UseFullTextDiffProperty, value); + } + public static readonly StyledProperty SelectedChunkProperty = AvaloniaProperty.Register(nameof(SelectedChunk)); @@ -1232,19 +1241,44 @@ namespace SourceGit.Views set => SetValue(EnableChunkSelectionProperty, value); } + private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true) + { + if (SelectedChunk != null) + SetCurrentValue(SelectedChunkProperty, null); + + if (diff == null) + { + Editor.Content = null; + GC.Collect(); + return; + } + + if (UseSideBySideDiff) + { + var previousContent = Editor.Content as ViewModels.TwoSideTextDiff; + Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null); + } + else + { + if (!keepScrollOffset) + diff.ScrollOffset = Vector.Zero; + Editor.Content = diff; + } + + IsUnstagedChange = diff.Option.IsUnstaged; + EnableChunkSelection = diff.Option.WorkingCopyChange != null; + } + static TextDiffView() { UseSideBySideDiffProperty.Changed.AddClassHandler((v, _) => { - if (v.DataContext is Models.TextDiff diff) - { - diff.SyncScrollOffset = Vector.Zero; + v.RefreshContent(v.DataContext as Models.TextDiff, false); + }); - if (v.UseSideBySideDiff) - v.Editor.Content = new ViewModels.TwoSideTextDiff(diff); - else - v.Editor.Content = diff; - } + UseFullTextDiffProperty.Changed.AddClassHandler((v, _) => + { + v.RefreshContent(v.DataContext as Models.TextDiff, false); }); SelectedChunkProperty.Changed.AddClassHandler((v, _) => @@ -1271,25 +1305,7 @@ namespace SourceGit.Views protected override void OnDataContextChanged(EventArgs e) { base.OnDataContextChanged(e); - - if (SelectedChunk != null) - SetCurrentValue(SelectedChunkProperty, null); - - var diff = DataContext as Models.TextDiff; - if (diff == null) - { - Editor.Content = null; - GC.Collect(); - return; - } - - if (UseSideBySideDiff) - Editor.Content = new ViewModels.TwoSideTextDiff(diff, Editor.Content as ViewModels.TwoSideTextDiff); - else - Editor.Content = diff; - - IsUnstagedChange = diff.Option.IsUnstaged; - EnableChunkSelection = diff.Option.WorkingCopyChange != null; + RefreshContent(DataContext as Models.TextDiff, true); } protected override void OnPointerExited(PointerEventArgs e) From 8d4afafd2dd9e33f1c7fc5639cc416ecf4bbcb7b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Nov 2024 08:33:05 +0000 Subject: [PATCH 11/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 361f97e5..d7403960 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.77%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.79%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.52%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.71%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.65%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.85%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.85%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 48bf29a8..07d95a97 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 95.77% +### de_DE.axaml: 95.63%
@@ -22,6 +22,7 @@ - Text.Configure.OpenAI - Text.Configure.OpenAI.Prefered - Text.Configure.OpenAI.Prefered.Tip +- Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name - Text.IssueLinkCM.OpenInBrowser @@ -36,7 +37,7 @@
-### es_ES.axaml: 96.79% +### es_ES.axaml: 96.65%
@@ -56,6 +57,7 @@ - Text.Configure.OpenAI - Text.Configure.OpenAI.Prefered - Text.Configure.OpenAI.Prefered.Tip +- Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name - Text.IssueLinkCM.OpenInBrowser @@ -67,7 +69,7 @@
-### fr_FR.axaml: 87.46% +### fr_FR.axaml: 87.34%
@@ -112,6 +114,7 @@ - Text.ConventionalCommit.ShortDescription - Text.ConventionalCommit.Type - Text.Diff.IgnoreWhitespace +- Text.Diff.VisualLines.All - Text.Discard.IncludeIgnored - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name @@ -162,7 +165,7 @@
-### pt_BR.axaml: 90.52% +### pt_BR.axaml: 90.39%
@@ -209,6 +212,7 @@ - Text.ConventionalCommit.ShortDescription - Text.ConventionalCommit.Type - Text.CopyAllText +- Text.Diff.VisualLines.All - Text.Discard.IncludeIgnored - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name @@ -236,33 +240,34 @@
-### ru_RU.axaml: 99.71% +### ru_RU.axaml: 99.56%
Missing Keys +- Text.Diff.VisualLines.All - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.85%
Missing Keys - +- Text.Diff.VisualLines.All
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.85%
Missing Keys - +- Text.Diff.VisualLines.All
From 6209326fe0bcfc7b7a62150127e5e00b31e27433 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 16:49:15 +0800 Subject: [PATCH 12/53] code_review: PR #652 * update localization for zh_CN and zh_TW * change the icon for `Icons.Lines.All` * reorder diff view toolbar buttons * move private methods after protected Signed-off-by: leo --- src/Resources/Icons.axaml | 2 +- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/DiffView.axaml | 21 ++++++------ src/Views/TextDiffView.axaml.cs | 56 +++++++++++++++---------------- 5 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index bd2e551b..fb0759d7 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -65,7 +65,7 @@ M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zM139 832V192c0-6 4-11 11-11h331v661H149c-6 0-11-4-11-11zm747 0c0 6-4 11-11 11H544v-661H875c6 0 11 4 11 11v640z M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zm-725 64h725c6 0 11 4 11 11v288h-747V192c0-6 4-11 11-11zm725 661H149c-6 0-11-4-11-11V544h747V832c0 6-4 11-11 11z M40 9 15 23 15 31 9 28 9 20 34 5 24 0 0 14 0 34 25 48 25 28 49 14zM26 29 26 48 49 34 49 15z - M19,13 C19.4142,13 19.75,13.3358 19.75,13.75 L19.75,18.4393 L20.4697,17.7197 C20.7626,17.4268 21.2374,17.4268 21.5303,17.7197 C21.8232,18.0126 21.8232,18.4874 21.5303,18.7803 L19.5303,20.7803 C19.4584,20.8522 19.3755,20.9065 19.2871,20.9431 C19.2099,20.9751 19.1262,20.9946 19.0386,20.999 L19,21 L19,21 C18.8983,21 18.8013,20.9798 18.7129,20.9431 C18.6245,20.9065 18.5416,20.8522 18.4697,20.7803 L16.4697,18.7803 C16.1768,18.4874 16.1768,18.0126 16.4697,17.7197 C16.7626,17.4268 17.2374,17.4268 17.5303,17.7197 L18.25,18.4393 L18.25,13.75 C18.25,13.3358 18.5858,13 19,13 Z M11.25,18 C11.6642,18 12,18.3358 12,18.75 C12,19.1296833 11.7178347,19.4434889 11.3517677,19.4931531 L11.25,19.5 L2.75,19.5 C2.33579,19.5 2,19.1642 2,18.75 C2,18.3703167 2.28215688,18.0565111 2.64823019,18.0068469 L2.75,18 L11.25,18 Z M14.25,11.5 C14.6642,11.5 15,11.8358 15,12.25 C15,12.6642 14.6642,13 14.25,13 L2.75,13 C2.33579,13 2,12.6642 2,12.25 C2,11.8358 2.33579,11.5 2.75,11.5 L14.25,11.5 Z M19.0022,3 C19.1031,3.0003 19.1993,3.02051 19.2871,3.05691 C19.3755,3.09351 19.4584,3.14776 19.5303,3.21967 L21.5303,5.21967 C21.8232,5.51256 21.8232,5.98744 21.5303,6.28033 C21.2374,6.57322 20.7626,6.57322 20.4697,6.28033 L19.75,5.56066 L19.75,10.25 C19.75,10.6642 19.4142,11 19,11 C18.5858,11 18.25,10.6642 18.25,10.25 L18.25,5.56066 L17.5303,6.28033 C17.2374,6.57322 16.7626,6.57322 16.4697,6.28033 C16.1768,5.98744 16.1768,5.51256 16.4697,5.21967 L18.4697,3.21967 C18.58634,3.102974 18.731972,3.0327676 18.8834536,3.00906104 L19.0022,3 Z M11.25,5 C11.6642,5 12,5.33579 12,5.75 C12,6.16421 11.6642,6.5 11.25,6.5 L2.75,6.5 C2.33579,6.5 2,6.16421 2,5.75 C2,5.33579 2.33579,5 2.75,5 L11.25,5 Z + M416 192m32 0 448 0q32 0 32 32l0 0q0 32-32 32l-448 0q-32 0-32-32l0 0q0-32 32-32ZM416 448m32 0 448 0q32 0 32 32l0 0q0 32-32 32l-448 0q-32 0-32-32l0 0q0-32 32-32ZM416 704m32 0 448 0q32 0 32 32l0 0q0 32-32 32l-448 0q-32 0-32-32l0 0q0-32 32-32ZM96 320l128-192 128 192h-256zM96 640l128 192 128-192h-256zM190 320h64v320H190z M408 232C408 210 426 192 448 192h416a40 40 0 110 80H448a40 40 0 01-40-40zM408 512c0-22 18-40 40-40h416a40 40 0 110 80H448A40 40 0 01408 512zM448 752A40 40 0 00448 832h416a40 40 0 100-80H448zM32 480l132 0 0-128 64 0 0 128 132 0 0 64-132 0 0 128-64 0 0-128-132 0Z M408 232C408 210 426 192 448 192h416a40 40 0 110 80H448a40 40 0 01-40-40zM408 512c0-22 18-40 40-40h416a40 40 0 110 80H448A40 40 0 01408 512zM448 752A40 40 0 00448 832h416a40 40 0 100-80H448zM32 480l328 0 0 64-328 0Z M 968 418 l -95 94 c -59 59 -146 71 -218 37 L 874 331 a 64 64 0 0 0 0 -90 L 783 150 a 64 64 0 0 0 -90 0 L 475 368 c -34 -71 -22 -159 37 -218 l 94 -94 c 75 -75 196 -75 271 0 l 90 90 c 75 75 75 196 0 271 z M 332 693 a 64 64 0 0 1 0 -90 l 271 -271 c 25 -25 65 -25 90 0 s 25 65 0 90 L 422 693 a 64 64 0 0 1 -90 0 z M 151 783 l 90 90 a 64 64 0 0 0 90 0 l 218 -218 c 34 71 22 159 -37 218 l -86 94 a 192 192 0 0 1 -271 0 l -98 -98 a 192 192 0 0 1 0 -271 l 94 -86 c 59 -59 146 -71 218 -37 L 151 693 a 64 64 0 0 0 0 90 z diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index c148c229..04bf7e3e 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -249,6 +249,7 @@ 语法高亮 自动换行 使用外部合并工具查看 + 显示完整文件 减少可见的行数 增加可见的行数 请选择需要对比的文件 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 2ff3db37..0c268c75 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -249,6 +249,7 @@ 語法上色 自動換行 使用外部合併工具檢視 + 顯示檔案的全部內容 減少可見的行數 增加可見的行數 請選擇需要對比的檔案 diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 9109e504..06525abd 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,16 +34,6 @@ - - - + + + + SetValue(EnableChunkSelectionProperty, value); } - private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true) - { - if (SelectedChunk != null) - SetCurrentValue(SelectedChunkProperty, null); - - if (diff == null) - { - Editor.Content = null; - GC.Collect(); - return; - } - - if (UseSideBySideDiff) - { - var previousContent = Editor.Content as ViewModels.TwoSideTextDiff; - Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null); - } - else - { - if (!keepScrollOffset) - diff.ScrollOffset = Vector.Zero; - Editor.Content = diff; - } - - IsUnstagedChange = diff.Option.IsUnstaged; - EnableChunkSelection = diff.Option.WorkingCopyChange != null; - } - static TextDiffView() { UseSideBySideDiffProperty.Changed.AddClassHandler((v, _) => @@ -1316,6 +1288,34 @@ namespace SourceGit.Views SetCurrentValue(SelectedChunkProperty, null); } + private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true) + { + if (SelectedChunk != null) + SetCurrentValue(SelectedChunkProperty, null); + + if (diff == null) + { + Editor.Content = null; + GC.Collect(); + return; + } + + if (UseSideBySideDiff) + { + var previousContent = Editor.Content as ViewModels.TwoSideTextDiff; + Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null); + } + else + { + if (!keepScrollOffset) + diff.ScrollOffset = Vector.Zero; + Editor.Content = diff; + } + + IsUnstagedChange = diff.Option.IsUnstaged; + EnableChunkSelection = diff.Option.WorkingCopyChange != null; + } + private void OnStageChunk(object _1, RoutedEventArgs _2) { var chunk = SelectedChunk; From a5aa2254f602f729365f1a0a94f38e0780e5a676 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 4 Nov 2024 08:49:32 +0000 Subject: [PATCH 13/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d7403960..03271f29 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.65%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.85%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.85%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.65%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 07d95a97..55bf97f0 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -252,22 +252,22 @@ -### zh_CN.axaml: 99.85% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Diff.VisualLines.All +
-### zh_TW.axaml: 99.85% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Diff.VisualLines.All +
From dcf50934061e1e9549b8073b7c87dede6873096c Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 4 Nov 2024 18:21:07 +0800 Subject: [PATCH 14/53] enhance: avoid that diff view refresh more than one times Signed-off-by: leo --- src/Commands/Diff.cs | 32 ++++++++++++++++++------ src/Models/DiffResult.cs | 2 ++ src/ViewModels/DiffContext.cs | 46 ++++++++++++++++++++++++++--------- 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index b9b6e064..04103d68 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -8,6 +8,10 @@ namespace SourceGit.Commands { [GeneratedRegex(@"^@@ \-(\d+),?\d* \+(\d+),?\d* @@")] private static partial Regex REG_INDICATOR(); + + [GeneratedRegex(@"^index\s([0-9a-f]{6,40})\.\.([0-9a-f]{6,40})(\s[1-9]{6})?")] + private static partial Regex REG_HASH_CHANGE(); + private const string PREFIX_LFS_NEW = "+version https://git-lfs.github.com/spec/"; private const string PREFIX_LFS_DEL = "-version https://git-lfs.github.com/spec/"; private const string PREFIX_LFS_MODIFY = " version https://git-lfs.github.com/spec/"; @@ -101,17 +105,31 @@ namespace SourceGit.Commands if (_result.TextDiff.Lines.Count == 0) { - var match = REG_INDICATOR().Match(line); - if (!match.Success) + if (line.StartsWith("Binary", StringComparison.Ordinal)) { - if (line.StartsWith("Binary", StringComparison.Ordinal)) - _result.IsBinary = true; + _result.IsBinary = true; return; } - _oldLine = int.Parse(match.Groups[1].Value); - _newLine = int.Parse(match.Groups[2].Value); - _result.TextDiff.Lines.Add(new Models.TextDiffLine(Models.TextDiffLineType.Indicator, line, 0, 0)); + if (string.IsNullOrEmpty(_result.OldHash)) + { + var match = REG_HASH_CHANGE().Match(line); + if (!match.Success) + return; + + _result.OldHash = match.Groups[1].Value; + _result.NewHash = match.Groups[2].Value; + } + else + { + var match = REG_INDICATOR().Match(line); + if (!match.Success) + return; + + _oldLine = int.Parse(match.Groups[1].Value); + _newLine = int.Parse(match.Groups[2].Value); + _result.TextDiff.Lines.Add(new Models.TextDiffLine(Models.TextDiffLineType.Indicator, line, 0, 0)); + } } else { diff --git a/src/Models/DiffResult.cs b/src/Models/DiffResult.cs index 61255ae9..e0ae82e0 100644 --- a/src/Models/DiffResult.cs +++ b/src/Models/DiffResult.cs @@ -674,6 +674,8 @@ namespace SourceGit.Models { public bool IsBinary { get; set; } = false; public bool IsLFS { get; set; } = false; + public string OldHash { get; set; } = string.Empty; + public string NewHash { get; set; } = string.Empty; public string OldMode { get; set; } = string.Empty; public string NewMode { get; set; } = string.Empty; public TextDiff TextDiff { get; set; } = null; diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index cfb9fa79..87b1a6de 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -33,12 +33,6 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _fileModeChange, value); } - public bool IsLoading - { - get => _isLoading; - private set => SetProperty(ref _isLoading, value); - } - public bool IsTextDiff { get => _isTextDiff; @@ -68,6 +62,7 @@ namespace SourceGit.ViewModels _content = previous._content; _unifiedLines = previous._unifiedLines; _ignoreWhitespace = previous._ignoreWhitespace; + _info = previous._info; } if (string.IsNullOrEmpty(_option.OrgPath) || _option.OrgPath == "/dev/null") @@ -109,7 +104,6 @@ namespace SourceGit.ViewModels { Content = null; IsTextDiff = false; - IsLoading = false; return; } @@ -119,10 +113,14 @@ namespace SourceGit.ViewModels // There is no way to tell a git-diff to use "ALL lines of context", // so instead we set a very high number for the "lines of context" parameter. var numLines = Preference.Instance.UseFullTextDiff ? 999999999 : _unifiedLines; - var latest = new Commands.Diff(_repo, _option, numLines, _ignoreWhitespace).Result(); - var rs = null as object; + var info = new Info(_option, numLines, _ignoreWhitespace, latest); + if (_info != null && info.IsSame(_info)) + return; + _info = info; + + var rs = null as object; if (latest.TextDiff != null) { var count = latest.TextDiff.Lines.Count; @@ -219,7 +217,6 @@ namespace SourceGit.ViewModels FileModeChange = latest.FileModeChange; Content = rs; IsTextDiff = rs is Models.TextDiff; - IsLoading = false; }); }); } @@ -252,14 +249,41 @@ namespace SourceGit.ViewModels ".ico", ".bmp", ".jpg", ".png", ".jpeg", ".webp" }; + private class Info + { + public string Argument { get; set; } + public int UnifiedLines { get; set; } + public bool IgnoreWhitespace { get; set; } + public string OldHash { get; set; } + public string NewHash { get; set; } + + public Info(Models.DiffOption option, int unifiedLines, bool ignoreWhitespace, Models.DiffResult result) + { + Argument = option.ToString(); + UnifiedLines = unifiedLines; + IgnoreWhitespace = ignoreWhitespace; + OldHash = result.OldHash; + NewHash = result.NewHash; + } + + public bool IsSame(Info other) + { + return Argument.Equals(other.Argument, StringComparison.Ordinal) && + UnifiedLines == other.UnifiedLines && + IgnoreWhitespace == other.IgnoreWhitespace && + OldHash.Equals(other.OldHash, StringComparison.Ordinal) && + NewHash.Equals(other.NewHash, StringComparison.Ordinal); + } + } + private readonly string _repo; private readonly Models.DiffOption _option = null; private string _title; private string _fileModeChange = string.Empty; private int _unifiedLines = 4; - private bool _isLoading = true; private bool _isTextDiff = false; private bool _ignoreWhitespace = false; private object _content = null; + private Info _info = null; } } From 8f5dfcc209f2893bb42f49cacfbb4f5f50ef8545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A0s=20Civil?= <70479573+BernatBC@users.noreply.github.com> Date: Tue, 5 Nov 2024 02:48:37 +0100 Subject: [PATCH 15/53] Add missing translations in spanish (#655) --- src/Resources/Locales/es_ES.axaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index f8a2fa68..88a1e78d 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -73,6 +73,7 @@ CANCELAR Resetear a Esta Revisión Resetear a Revisión Padre + Generar mensaje de commit CAMBIAR MODO DE VISUALIZACIÓN Mostrar como Lista de Archivos y Directorios Mostrar como Lista de Rutas @@ -110,7 +111,10 @@ Comparar con Worktree Copiar Información Copiar SHA + Acción personalizada Rebase Interactivo ${0}$ hasta Aquí + Abrir en el Navegador + Copiar Enlace Rebase ${0}$ hasta Aquí Reset ${0}$ hasta Aquí Revertir Commit @@ -141,12 +145,21 @@ PLANTILLA DE COMMIT Nombre de la Plantilla: Contenido de la Plantilla: + ACCIÓN PERSONALIZADA + Argumentos: + ${REPO} - Ruta del repositorio; ${SHA} - SHA del commit seleccionado + Archivo Ejecutable: + Nombre: + Alcance: + Commit + Repositorio Dirección de Email Dirección de email GIT Fetch remotos automáticamente Minuto(s) Remoto por Defecto + Habilitar --prune para fetch Habilitar --signoff para commit SEGUIMIENTO DE INCIDENCIAS Añadir Regla de Ejemplo para Github @@ -158,6 +171,9 @@ Nombre de la Regla: URL Resultante: Por favor, use $1, $2 para acceder a los valores de los grupos regex. + OPEN AI + Servicio Preferido: + Si el 'Servicio Preferido' está establecido, SourceGit sólo lo usará en este repositorio. De lo contrario, si hay más de un servicio disponible, se mostrará un menú de contexto para elegir uno. Proxy HTTP Proxy HTTP utilizado por este repositorio Nombre de Usuario @@ -235,6 +251,7 @@ Resaltado de Sintaxis Ajuste de Línea Abrir en Herramienta de Merge + Mostrar Todas las Líneas Disminuir Número de Líneas Visibles Aumentar Número de Líneas Visibles SELECCIONA ARCHIVO PARA VER CAMBIOS @@ -250,6 +267,8 @@ Destino: Editar Grupo Seleccionado Editar Repositorio Seleccionado + Ejecutar Acción Personalizada + Nombre de la Acción: Fast-Forward (sin checkout) Fetch Fetch todos los remotos @@ -411,6 +430,7 @@ Clave API Generar Subject Prompt Modelo + Nombre Servidor APARIENCIA Fuente por defecto @@ -514,6 +534,8 @@ Limpiar todo Configurar este repositorio CONTINUAR + Acciones Personalizadas + No hay ninguna Acción Personalizada Habilitar Opción '--reflog' Abrir en el Explorador Buscar Ramas/Etiquetas/Submódulos @@ -576,6 +598,7 @@ INICIAR Stash Incluir archivos no rastreados + Mantener archivos staged Mensaje: Opcional. Nombre de este stash Solo cambios staged From c337d67bbe70cc1005f78bc5ef10b410e24d9bbe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 Nov 2024 01:48:51 +0000 Subject: [PATCH 16/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 03271f29..24d12b3c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-96.65%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 55bf97f0..bad6577c 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -37,35 +37,13 @@ -### es_ES.axaml: 96.65% +### es_ES.axaml: 100.00%
Missing Keys -- Text.ChangeCM.GenerateCommitMessage -- Text.CommitCM.CustomAction -- Text.Configure.CustomAction -- Text.Configure.CustomAction.Arguments -- Text.Configure.CustomAction.Arguments.Tip -- Text.Configure.CustomAction.Executable -- Text.Configure.CustomAction.Name -- Text.Configure.CustomAction.Scope -- Text.Configure.CustomAction.Scope.Commit -- Text.Configure.CustomAction.Scope.Repository -- Text.Configure.Git.EnablePruneOnFetch -- Text.Configure.OpenAI -- Text.Configure.OpenAI.Prefered -- Text.Configure.OpenAI.Prefered.Tip -- Text.Diff.VisualLines.All -- Text.ExecuteCustomAction -- Text.ExecuteCustomAction.Name -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink -- Text.Preference.AI.Name -- Text.Repository.CustomActions -- Text.Repository.CustomActions.Empty -- Text.Stash.KeepIndex +
From 9d2c2df6b36b4a78dac6f0ff8bb30876ced64159 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 5 Nov 2024 11:00:04 +0800 Subject: [PATCH 17/53] ux: issue link tooltip max width Signed-off-by: leo --- src/Views/CommitBaseInfo.axaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 62117480..a16143ae 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -141,7 +141,13 @@ Message="{Binding #ThisControl.Message}" IssueTrackerRules="{Binding #ThisControl.IssueTrackerRules}" HorizontalAlignment="Stretch" - TextWrapping="Wrap"/> + TextWrapping="Wrap"> + + + +
From 680cdca28da1905b9c4acca79b6f7bb39e016434 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 5 Nov 2024 12:15:20 +0800 Subject: [PATCH 18/53] feature: handle custom action error output Signed-off-by: leo --- src/Commands/ExecuteCustomAction.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Commands/ExecuteCustomAction.cs b/src/Commands/ExecuteCustomAction.cs index 253c6b43..10ecb450 100644 --- a/src/Commands/ExecuteCustomAction.cs +++ b/src/Commands/ExecuteCustomAction.cs @@ -30,6 +30,8 @@ namespace SourceGit.Commands start.Environment.Add("PATH", Native.OS.CustomPathEnv); var proc = new Process() { StartInfo = start }; + var builder = new StringBuilder(); + proc.OutputDataReceived += (_, e) => { if (e.Data != null) @@ -39,7 +41,10 @@ namespace SourceGit.Commands proc.ErrorDataReceived += (_, e) => { if (e.Data != null) + { outputHandler?.Invoke(e.Data); + builder.Append(e.Data); + } }; try @@ -57,7 +62,17 @@ namespace SourceGit.Commands }); } + var exitCode = proc.ExitCode; proc.Close(); + + if (exitCode != 0) + { + var errMsg = builder.ToString(); + Dispatcher.UIThread.Invoke(() => + { + App.RaiseException(repo, errMsg); + }); + } } } } From fdf30aa7cc1396e03ff982ad48956c6b736aca3f Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 5 Nov 2024 12:24:33 +0800 Subject: [PATCH 19/53] fix: custom action error message format Signed-off-by: leo --- src/Commands/ExecuteCustomAction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/ExecuteCustomAction.cs b/src/Commands/ExecuteCustomAction.cs index 10ecb450..f5fec82c 100644 --- a/src/Commands/ExecuteCustomAction.cs +++ b/src/Commands/ExecuteCustomAction.cs @@ -43,7 +43,7 @@ namespace SourceGit.Commands if (e.Data != null) { outputHandler?.Invoke(e.Data); - builder.Append(e.Data); + builder.AppendLine(e.Data); } }; From 2e6eca26f7cd0207821af33dcb6df4e31c7c651c Mon Sep 17 00:00:00 2001 From: Fernando Medeiros Date: Wed, 6 Nov 2024 01:14:56 +0000 Subject: [PATCH 20/53] Adding hotkeys for creating branch, pushing and pulling (#657) --- src/Resources/Locales/en_US.axaml | 3 +++ src/ViewModels/Histories.cs | 2 ++ src/Views/Histories.axaml.cs | 34 ++++++++++++++++++++++++------- src/Views/Hotkeys.axaml | 15 +++++++++++--- src/Views/RepositoryToolbar.axaml | 5 +++-- 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index eb1c6de3..2b6c8ce9 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -371,6 +371,9 @@ Switch to 'Changes' Switch to 'Histories' Switch to 'Stashes' + Pull, starts directly + Push, starts directly + Creates a new branch based on selected commit TEXT EDITOR Close search panel Find next match diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 713e1635..3fb048ae 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Text; using Avalonia.Controls; +using Avalonia.Input; using Avalonia.Platform.Storage; using CommunityToolkit.Mvvm.ComponentModel; @@ -544,6 +545,7 @@ namespace SourceGit.ViewModels var createBranch = new MenuItem(); createBranch.Icon = App.CreateMenuIcon("Icons.Branch.Add"); createBranch.Header = App.Text("CreateBranch"); + createBranch.HotKey = new KeyGesture(Key.B, KeyModifiers.Control); createBranch.Click += (_, e) => { if (PopupHost.CanCreatePopup()) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 43258dd7..e621a0aa 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -12,6 +12,7 @@ using Avalonia.Interactivity; using Avalonia.Media; using Avalonia.Threading; using Avalonia.VisualTree; +using SourceGit.ViewModels; namespace SourceGit.Views { @@ -722,19 +723,38 @@ namespace SourceGit.Views private void OnCommitListKeyDown(object sender, KeyEventArgs e) { + // These shortcuts are not mentioned in the Shortcut Reference window. Is this expected? if (sender is ListBox { SelectedItems: { Count: > 0 } selected } && - e.Key == Key.C && e.KeyModifiers.HasFlag(KeyModifiers.Control)) { - var builder = new StringBuilder(); - foreach (var item in selected) + // CTRL + C -> Copy selected commit SHA and subject. + if (e.Key == Key.C) { - if (item is Models.Commit commit) - builder.AppendLine($"{commit.SHA.Substring(0, 10)} - {commit.Subject}"); + var builder = new StringBuilder(); + foreach (var item in selected) + { + if (item is Models.Commit commit) + builder.AppendLine($"{commit.SHA.Substring(0, 10)} - {commit.Subject}"); + } + + App.CopyText(builder.ToString()); + e.Handled = true; + return; } - App.CopyText(builder.ToString()); - e.Handled = true; + // CTRL + B -> shows Create Branch pop-up at selected commit. + if (e.Key == Key.B) + { + if (selected.Count == 1 && + selected[0] is Models.Commit commit && + DataContext is ViewModels.Histories histories && + PopupHost.CanCreatePopup()) + { + PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit)); + e.Handled = true; + + } + } } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index a28bc566..cb6f6e64 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -71,7 +71,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,8"/> - + @@ -102,8 +102,17 @@ - - + + + + + + + + + + + - - From dc49c1bf7624538361fee2de24730395f55485bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 6 Nov 2024 01:15:14 +0000 Subject: [PATCH 21/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 24d12b3c..47c32222 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.63%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-87.34%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.39%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.56%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.22%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.96%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.00%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.13%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.57%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.57%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index bad6577c..5895b971 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 95.63% +### de_DE.axaml: 95.22%
@@ -25,6 +25,9 @@ - Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.Preference.AI.AnalyzeDiffPrompt @@ -37,17 +40,19 @@
-### es_ES.axaml: 100.00% +### es_ES.axaml: 99.57%
Missing Keys - +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit
-### fr_FR.axaml: 87.34% +### fr_FR.axaml: 86.96%
@@ -104,6 +109,9 @@ - Text.Histories.Tips.Prefix - Text.Hotkeys.Repo.CommitWithAutoStage - Text.Hotkeys.Repo.DiscardSelected +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -143,7 +151,7 @@
-### pt_BR.axaml: 90.39% +### pt_BR.axaml: 90.00%
@@ -197,6 +205,9 @@ - Text.FileHistory.FileContent - Text.FileHistory.FileChange - Text.GitLFS.Locks.OnlyMine +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -218,34 +229,41 @@
-### ru_RU.axaml: 99.56% +### ru_RU.axaml: 99.13%
Missing Keys - Text.Diff.VisualLines.All +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.57%
Missing Keys - +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.57%
Missing Keys - +- Text.Hotkeys.Repo.Pull +- Text.Hotkeys.Repo.Push +- Text.Hotkeys.Repo.CreateBranchOnCommit
From d50b2c0298b8a27022b9db43ac4bb204743eefb3 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 6 Nov 2024 09:44:52 +0800 Subject: [PATCH 22/53] code_review: PR #657 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add hotkey `Ctrl+Down/⌘+Down` to fetch directly * keep translation keys of en_US in order * add translations for zh_CN and zh_TW * do NOT using namespace under `SourceGit` * use `⇧` instead of `Shift` in hotkey tips * hotkey mismatch on macOS * hotkeys to start fetch/pull/push directly not work on macOS * remove the hotkey of `Create Branch` context menu item - there are other objects (such as branch and tag) also have the `Create Branch` context menu item without hotkeys - on macOS, we already use `⌘+B` to create branch with selected commit, not `Ctrl + B` Signed-off-by: leo --- README.md | 2 +- TRANSLATION.md | 37 ++++++++++++++-------------- src/Resources/Locales/en_US.axaml | 7 +++--- src/Resources/Locales/zh_CN.axaml | 4 +++ src/Resources/Locales/zh_TW.axaml | 4 +++ src/ViewModels/Histories.cs | 2 -- src/Views/Histories.axaml.cs | 18 ++++++++------ src/Views/Hotkeys.axaml | 21 +++++++++------- src/Views/RepositoryToolbar.axaml | 3 +-- src/Views/RepositoryToolbar.axaml.cs | 35 +++++++++++++++++++++----- 10 files changed, 84 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 47c32222..69e0d738 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.22%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.96%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.00%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.13%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.57%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.57%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.08%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.42%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.83%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-89.87%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.99%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 5895b971..05bf208c 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 95.22% +### de_DE.axaml: 95.08%
@@ -25,9 +25,10 @@ - Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.Preference.AI.AnalyzeDiffPrompt @@ -40,19 +41,20 @@
-### es_ES.axaml: 99.57% +### es_ES.axaml: 99.42%
Missing Keys +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit
-### fr_FR.axaml: 86.96% +### fr_FR.axaml: 86.83%
@@ -108,10 +110,11 @@ - Text.Histories.Tips.MacOS - Text.Histories.Tips.Prefix - Text.Hotkeys.Repo.CommitWithAutoStage +- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.Hotkeys.Repo.DiscardSelected +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -151,7 +154,7 @@
-### pt_BR.axaml: 90.00% +### pt_BR.axaml: 89.87%
@@ -205,9 +208,10 @@ - Text.FileHistory.FileContent - Text.FileHistory.FileChange - Text.GitLFS.Locks.OnlyMine +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink - Text.MoveRepositoryNode @@ -229,41 +233,38 @@
-### ru_RU.axaml: 99.13% +### ru_RU.axaml: 98.99%
Missing Keys - Text.Diff.VisualLines.All +- Text.Hotkeys.Repo.CreateBranchOnCommit +- Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink
-### zh_CN.axaml: 99.57% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit +
-### zh_TW.axaml: 99.57% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.Hotkeys.Repo.CreateBranchOnCommit +
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2b6c8ce9..ee44181b 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -363,17 +363,18 @@ Commit staged changes Commit and push staged changes Stage all changes and commit + Creates a new branch based on selected commit Discard selected changes + Fetch, starts directly Dashboard mode (Default) + Pull, starts directly + Push, starts directly Force to reload this repository Stage/Unstage selected changes Commit search mode Switch to 'Changes' Switch to 'Histories' Switch to 'Stashes' - Pull, starts directly - Push, starts directly - Creates a new branch based on selected commit TEXT EDITOR Close search panel Find next match diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 04bf7e3e..b97f9aab 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -366,8 +366,12 @@ 提交暂存区更改 提交暂存区更改并推送 自动暂存全部变更并提交 + 基于选中提交创建新分支 丢弃选中的更改 + 拉取 (fetch) 远程变更 切换左边栏为分支/标签等显示模式(默认) + 拉回 (pull) 远程变更 + 推送本地变更到远程 重新加载仓库状态 将选中的变更暂存或从暂存列表中移除 切换左边栏为提交搜索模式 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 0c268c75..494616ab 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -366,8 +366,12 @@ 提交暫存區變更 提交暫存區變更並推送 自動暫存全部變更並提交 + 根據選取的提交建立新的分支 捨棄選取的變更 + 提取 (fetch) 遠端的變更 切換左邊欄為分支/標籤等顯示模式 (預設) + 拉取 (pull) 遠端的變更 + 推送 (push) 本地變更到遠端存放庫 強制重新載入存放庫 暫存或取消暫存選取的變更 切換左邊欄為歷史搜尋模式 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 3fb048ae..713e1635 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Text; using Avalonia.Controls; -using Avalonia.Input; using Avalonia.Platform.Storage; using CommunityToolkit.Mvvm.ComponentModel; @@ -545,7 +544,6 @@ namespace SourceGit.ViewModels var createBranch = new MenuItem(); createBranch.Icon = App.CreateMenuIcon("Icons.Branch.Add"); createBranch.Header = App.Text("CreateBranch"); - createBranch.HotKey = new KeyGesture(Key.B, KeyModifiers.Control); createBranch.Click += (_, e) => { if (PopupHost.CanCreatePopup()) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index e621a0aa..e72888fe 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -12,7 +12,6 @@ using Avalonia.Interactivity; using Avalonia.Media; using Avalonia.Threading; using Avalonia.VisualTree; -using SourceGit.ViewModels; namespace SourceGit.Views { @@ -723,11 +722,15 @@ namespace SourceGit.Views private void OnCommitListKeyDown(object sender, KeyEventArgs e) { + bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || + (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control)); + if (!isSystemCmdKeyDown) + return; + // These shortcuts are not mentioned in the Shortcut Reference window. Is this expected? - if (sender is ListBox { SelectedItems: { Count: > 0 } selected } && - e.KeyModifiers.HasFlag(KeyModifiers.Control)) + if (sender is ListBox { SelectedItems: { Count: > 0 } selected }) { - // CTRL + C -> Copy selected commit SHA and subject. + // CTRL/COMMAND + C -> Copy selected commit SHA and subject. if (e.Key == Key.C) { var builder = new StringBuilder(); @@ -742,17 +745,16 @@ namespace SourceGit.Views return; } - // CTRL + B -> shows Create Branch pop-up at selected commit. + // CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit. if (e.Key == Key.B) { if (selected.Count == 1 && selected[0] is Models.Commit commit && DataContext is ViewModels.Histories histories && - PopupHost.CanCreatePopup()) + ViewModels.PopupHost.CanCreatePopup()) { - PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit)); + ViewModels.PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit)); e.Handled = true; - } } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index cb6f6e64..4fe77066 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -71,7 +71,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,8"/> - + @@ -102,17 +102,20 @@ - - + + - - + + - - + + - - + + + + + - diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index a4a05dc4..e2c7df8c 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -1,3 +1,5 @@ +using System; + using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; @@ -45,22 +47,43 @@ namespace SourceGit.Views private void Fetch(object _, RoutedEventArgs e) { var launcher = this.FindAncestorOfType(); - (DataContext as ViewModels.Repository)?.Fetch(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false); - e.Handled = true; + if (launcher is not null && DataContext is ViewModels.Repository repo) + { + var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); + if (!startDirectly && OperatingSystem.IsMacOS()) + startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + + repo.Fetch(startDirectly); + e.Handled = true; + } } private void Pull(object _, RoutedEventArgs e) { var launcher = this.FindAncestorOfType(); - (DataContext as ViewModels.Repository)?.Pull(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false); - e.Handled = true; + if (launcher is not null && DataContext is ViewModels.Repository repo) + { + var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); + if (!startDirectly && OperatingSystem.IsMacOS()) + startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + + repo.Pull(startDirectly); + e.Handled = true; + } } private void Push(object _, RoutedEventArgs e) { var launcher = this.FindAncestorOfType(); - (DataContext as ViewModels.Repository)?.Push(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false); - e.Handled = true; + if (launcher is not null && DataContext is ViewModels.Repository repo) + { + var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control); + if (!startDirectly && OperatingSystem.IsMacOS()) + startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + + repo.Push(startDirectly); + e.Handled = true; + } } private void StashAll(object _, RoutedEventArgs e) From c72506d939ad576585b2d7a05d71620c89be7ef0 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 6 Nov 2024 10:36:10 +0800 Subject: [PATCH 23/53] code_style: simplify the way detacting system preferred command key Signed-off-by: leo --- src/Views/CommitMessageTextBox.axaml.cs | 2 +- src/Views/Histories.axaml.cs | 4 +--- src/Views/Launcher.axaml.cs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Views/CommitMessageTextBox.axaml.cs b/src/Views/CommitMessageTextBox.axaml.cs index 6eec0379..91f8c47e 100644 --- a/src/Views/CommitMessageTextBox.axaml.cs +++ b/src/Views/CommitMessageTextBox.axaml.cs @@ -125,7 +125,7 @@ namespace SourceGit.Views DescriptionEditor.CaretIndex = 0; e.Handled = true; } - else if (e.Key == Key.V && ((OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Meta) || (!OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Control))) + else if (e.Key == Key.V && e.KeyModifiers == (OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) { e.Handled = true; diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index e72888fe..9f436346 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -722,9 +722,7 @@ namespace SourceGit.Views private void OnCommitListKeyDown(object sender, KeyEventArgs e) { - bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || - (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control)); - if (!isSystemCmdKeyDown) + if (!e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) return; // These shortcuts are not mentioned in the Shortcut Reference window. Is this expected? diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index 99916da3..29d90e09 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -115,8 +115,7 @@ namespace SourceGit.Views return; } - if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || - (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control))) + if (e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) { if (e.Key == Key.W) { From 9cb85081ab8a01c59d5ee526bffbe66b6af7b020 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 6 Nov 2024 12:35:55 +0800 Subject: [PATCH 24/53] feature: saving as patch supports multiple commits (#658) Signed-off-by: leo --- src/Commands/SaveChangesAsPatch.cs | 16 +++++++++++- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/ViewModels/Histories.cs | 39 ++++++++++++++++++++++++++++++ src/ViewModels/RevisionCompare.cs | 17 +++++++++++++ src/ViewModels/WorkingCopy.cs | 8 +++--- src/Views/RevisionCompare.axaml | 11 ++++++--- src/Views/RevisionCompare.axaml.cs | 24 ++++++++++++++++++ 9 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/Commands/SaveChangesAsPatch.cs b/src/Commands/SaveChangesAsPatch.cs index 409127ba..461bbfb5 100644 --- a/src/Commands/SaveChangesAsPatch.cs +++ b/src/Commands/SaveChangesAsPatch.cs @@ -9,7 +9,7 @@ namespace SourceGit.Commands { public static class SaveChangesAsPatch { - public static bool Exec(string repo, List changes, bool isUnstaged, string saveTo) + public static bool ProcessLocalChanges(string repo, List changes, bool isUnstaged, string saveTo) { using (var sw = File.Create(saveTo)) { @@ -23,6 +23,20 @@ namespace SourceGit.Commands return true; } + public static bool ProcessRevisionCompareChanges(string repo, List changes, string baseRevision, string targetRevision, string saveTo) + { + using (var sw = File.Create(saveTo)) + { + foreach (var change in changes) + { + if (!ProcessSingleChange(repo, new Models.DiffOption(baseRevision, targetRevision, change), sw)) + return false; + } + } + + return true; + } + private static bool ProcessSingleChange(string repo, Models.DiffOption opt, FileStream writer) { var starter = new ProcessStartInfo(); diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index ee44181b..7393fd19 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -238,6 +238,7 @@ Next Difference NO CHANGES OR ONLY EOL CHANGES Previous Difference + Save as Patch Show hidden symbols Side-By-Side Diff SUBMODULE diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index b97f9aab..dd457295 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -241,6 +241,7 @@ 下一个差异 没有变更或仅有换行符差异 上一个差异 + 保存为补丁文件 显示隐藏符号 分列对比 子模块 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 494616ab..c4963c39 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -241,6 +241,7 @@ 下一個差異 沒有變更或僅有換行字元差異 上一個差異 + 另存為修補檔 顯示隱藏符號 並排對比 子模組 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 713e1635..688dab87 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Text; +using System.Threading.Tasks; using Avalonia.Controls; using Avalonia.Platform.Storage; @@ -258,6 +259,44 @@ namespace SourceGit.ViewModels multipleMenu.Items.Add(new MenuItem() { Header = "-" }); } + var saveToPatchMultiple = new MenuItem(); + saveToPatchMultiple.Icon = App.CreateMenuIcon("Icons.Diff"); + saveToPatchMultiple.Header = App.Text("CommitCM.SaveAsPatch"); + saveToPatchMultiple.Click += async (_, e) => + { + var storageProvider = App.GetStorageProvider(); + if (storageProvider == null) + return; + + var options = new FolderPickerOpenOptions() { AllowMultiple = false }; + try + { + var picker = await storageProvider.OpenFolderPickerAsync(options); + if (picker.Count == 1) + { + var saveTo = $"{picker[0].Path.LocalPath}/patches"; + var succ = false; + foreach (var c in selected) + { + succ = await Task.Run(() => new Commands.FormatPatch(_repo.FullPath, c.SHA, saveTo).Exec()); + if (!succ) + break; + } + + if (succ) + App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); + } + } + catch (Exception exception) + { + App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}"); + } + + e.Handled = true; + }; + multipleMenu.Items.Add(saveToPatchMultiple); + multipleMenu.Items.Add(new MenuItem() { Header = "-" }); + var copyMultipleSHAs = new MenuItem(); copyMultipleSHAs.Header = App.Text("CommitCM.CopySHA"); copyMultipleSHAs.Icon = App.CreateMenuIcon("Icons.Copy"); diff --git a/src/ViewModels/RevisionCompare.cs b/src/ViewModels/RevisionCompare.cs index 55c85129..ffc05643 100644 --- a/src/ViewModels/RevisionCompare.cs +++ b/src/ViewModels/RevisionCompare.cs @@ -24,6 +24,11 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _endPoint, value); } + public bool CanSaveAsPatch + { + get => _canSaveAsPatch; + } + public List VisibleChanges { get => _visibleChanges; @@ -73,6 +78,7 @@ namespace SourceGit.ViewModels _repo = repo; _startPoint = (object)startPoint ?? new Models.Null(); _endPoint = (object)endPoint ?? new Models.Null(); + _canSaveAsPatch = startPoint != null && endPoint != null; Task.Run(Refresh); } @@ -105,6 +111,16 @@ namespace SourceGit.ViewModels Task.Run(Refresh); } + public void SaveAsPatch(string saveTo) + { + Task.Run(() => + { + var succ = Commands.SaveChangesAsPatch.ProcessRevisionCompareChanges(_repo, _changes, GetSHA(_startPoint), GetSHA(_endPoint), saveTo); + if (succ) + Dispatcher.UIThread.Invoke(() => App.SendNotification(_repo, App.Text("SaveAsPatchSuccess"))); + }); + } + public void ClearSearchFilter() { SearchFilter = string.Empty; @@ -218,6 +234,7 @@ namespace SourceGit.ViewModels private string _repo; private object _startPoint = null; private object _endPoint = null; + private bool _canSaveAsPatch = false; private List _changes = null; private List _visibleChanges = null; private List _selectedChanges = null; diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 020053f9..4bac8e08 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -539,7 +539,7 @@ namespace SourceGit.ViewModels var storageFile = await storageProvider.SaveFilePickerAsync(options); if (storageFile != null) { - var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, _selectedUnstaged, true, storageFile.Path.LocalPath)); + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessLocalChanges(_repo.FullPath, _selectedUnstaged, true, storageFile.Path.LocalPath)); if (succ) App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); } @@ -858,7 +858,7 @@ namespace SourceGit.ViewModels var storageFile = await storageProvider.SaveFilePickerAsync(options); if (storageFile != null) { - var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, _selectedUnstaged, true, storageFile.Path.LocalPath)); + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessLocalChanges(_repo.FullPath, _selectedUnstaged, true, storageFile.Path.LocalPath)); if (succ) App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); } @@ -981,7 +981,7 @@ namespace SourceGit.ViewModels var storageFile = await storageProvider.SaveFilePickerAsync(options); if (storageFile != null) { - var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, _selectedStaged, false, storageFile.Path.LocalPath)); + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessLocalChanges(_repo.FullPath, _selectedStaged, false, storageFile.Path.LocalPath)); if (succ) App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); } @@ -1156,7 +1156,7 @@ namespace SourceGit.ViewModels var storageFile = await storageProvider.SaveFilePickerAsync(options); if (storageFile != null) { - var succ = await Task.Run(() => Commands.SaveChangesAsPatch.Exec(_repo.FullPath, _selectedStaged, false, storageFile.Path.LocalPath)); + var succ = await Task.Run(() => Commands.SaveChangesAsPatch.ProcessLocalChanges(_repo.FullPath, _selectedStaged, false, storageFile.Path.LocalPath)); if (succ) App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess")); } diff --git a/src/Views/RevisionCompare.axaml b/src/Views/RevisionCompare.axaml index f6303b45..912fde39 100644 --- a/src/Views/RevisionCompare.axaml +++ b/src/Views/RevisionCompare.axaml @@ -35,21 +35,26 @@ - + - + + + + diff --git a/src/Views/RevisionCompare.axaml.cs b/src/Views/RevisionCompare.axaml.cs index b484b78f..2c548240 100644 --- a/src/Views/RevisionCompare.axaml.cs +++ b/src/Views/RevisionCompare.axaml.cs @@ -1,5 +1,7 @@ using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Interactivity; +using Avalonia.Platform.Storage; namespace SourceGit.Views { @@ -28,5 +30,27 @@ namespace SourceGit.Views e.Handled = true; } + + private async void OnSaveAsPatch(object sender, RoutedEventArgs e) + { + var topLevel = TopLevel.GetTopLevel(this); + if (topLevel == null) + return; + + var vm = DataContext as ViewModels.RevisionCompare; + if (vm == null) + return; + + var options = new FilePickerSaveOptions(); + options.Title = App.Text("FileCM.SaveAsPatch"); + options.DefaultExtension = ".patch"; + options.FileTypeChoices = [new FilePickerFileType("Patch File") { Patterns = ["*.patch"] }]; + + var storageFile = await topLevel.StorageProvider.SaveFilePickerAsync(options); + if (storageFile != null) + vm.SaveAsPatch(storageFile.Path.LocalPath); + + e.Handled = true; + } } } From a715143a162bd7c0cbe80a869e0b6fe69ff179c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 6 Nov 2024 04:36:13 +0000 Subject: [PATCH 25/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 69e0d738..9072e28b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.08%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.42%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.83%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-89.87%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.99%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-94.94%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.28%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.71%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-89.74%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.84%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 05bf208c..eb084e0b 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 95.08% +### de_DE.axaml: 94.94%
@@ -22,6 +22,7 @@ - Text.Configure.OpenAI - Text.Configure.OpenAI.Prefered - Text.Configure.OpenAI.Prefered.Tip +- Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All - Text.ExecuteCustomAction - Text.ExecuteCustomAction.Name @@ -41,12 +42,13 @@
-### es_ES.axaml: 99.42% +### es_ES.axaml: 99.28%
Missing Keys +- Text.Diff.SaveAsPatch - Text.Hotkeys.Repo.CreateBranchOnCommit - Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull @@ -54,7 +56,7 @@
-### fr_FR.axaml: 86.83% +### fr_FR.axaml: 86.71%
@@ -99,6 +101,7 @@ - Text.ConventionalCommit.ShortDescription - Text.ConventionalCommit.Type - Text.Diff.IgnoreWhitespace +- Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All - Text.Discard.IncludeIgnored - Text.ExecuteCustomAction @@ -154,7 +157,7 @@
-### pt_BR.axaml: 89.87% +### pt_BR.axaml: 89.74%
@@ -201,6 +204,7 @@ - Text.ConventionalCommit.ShortDescription - Text.ConventionalCommit.Type - Text.CopyAllText +- Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All - Text.Discard.IncludeIgnored - Text.ExecuteCustomAction @@ -233,12 +237,13 @@
-### ru_RU.axaml: 98.99% +### ru_RU.axaml: 98.84%
Missing Keys +- Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All - Text.Hotkeys.Repo.CreateBranchOnCommit - Text.Hotkeys.Repo.Fetch From 88cec05e67424c1cd8e254104eae93e4b01b68a5 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 6 Nov 2024 14:50:25 +0800 Subject: [PATCH 26/53] ux: do not use OpenAI logo Signed-off-by: leo --- src/Resources/Icons.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index fb0759d7..53b2b3d3 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -1,6 +1,6 @@ M41 512c0-128 46-241 138-333C271 87 384 41 512 41s241 46 333 138c92 92 138 205 138 333s-46 241-138 333c-92 92-205 138-333 138s-241-46-333-138C87 753 41 640 41 512zm87 0c0 108 36 195 113 271s164 113 271 113c108 0 195-36 271-113s113-164 113-271-36-195-113-271c-77-77-164-113-271-113-108 0-195 36-271 113C164 317 128 404 128 512zm256 148V292l195 113L768 512l-195 113-195 113v-77zm148-113-61 36V440l61 36 61 36-61 36z - M951 419a255 255 0 00-22-209 258 258 0 00-278-124A259 259 0 00213 178a255 255 0 00-171 124 258 258 0 0032 303 255 255 0 0022 210 258 258 0 00278 124A255 255 0 00566 1024a258 258 0 00246-179 256 256 0 00171-124 258 258 0 00-32-302zM566 957a191 191 0 01-123-44l6-3 204-118a34 34 0 0017-29v-287l86 50a3 3 0 012 2v238a192 192 0 01-192 192zM154 781a191 191 0 01-23-129l6 4 204 118a33 33 0 0033 0l249-144v99a3 3 0 01-1 3L416 851a192 192 0 01-262-70zM100 337a191 191 0 01101-84V495a33 33 0 0017 29l248 143-86 50a3 3 0 01-3 0l-206-119A192 192 0 01100 336zm708 164-249-145L645 307a3 3 0 013 0l206 119a192 192 0 01-29 346v-242a34 34 0 00-17-28zm86-129-6-4-204-119a33 33 0 00-33 0L401 394V294a3 3 0 011-3l206-119a192 192 0 01285 199zm-539 176-86-50a3 3 0 01-2-2V259a192 192 0 01315-147l-6 3-204 118a34 34 0 00-17 29zm47-101 111-64 111 64v128l-111 64-111-64z + M304 464a128 128 0 01128-128c71 0 128 57 128 128v224a32 32 0 01-64 0V592h-128v95a32 32 0 01-64 0v-224zm64 1v64h128v-64a64 64 0 00-64-64c-35 0-64 29-64 64zM688 337c18 0 32 14 32 32v319a32 32 0 01-32 32c-18 0-32-14-32-32v-319a32 32 0 0132-32zM84 911l60-143A446 446 0 0164 512C64 265 265 64 512 64s448 201 448 448-201 448-448 448c-54 0-105-9-153-27l-242 22a32 32 0 01-32-44zm133-150-53 126 203-18 13 5c41 15 85 23 131 23 212 0 384-172 384-384S724 128 512 128 128 300 128 512c0 82 26 157 69 220l20 29z M296 392h64v64h-64zM296 582v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zM360 328h64v64h-64zM296 264h64v64h-64zM360 456h64v64h-64zM360 200h64v64h-64zM855 289 639 73c-6-6-14-9-23-9H192c-18 0-32 14-32 32v832c0 18 14 32 32 32h640c18 0 32-14 32-32V311c0-9-3-17-9-23zM790 326H602V138L790 326zm2 562H232V136h64v64h64v-64h174v216c0 23 19 42 42 42h216v494z M71 1024V0h661L953 219V1024H71zm808-731-220-219H145V951h735V293zM439 512h-220V219h220V512zm-74-219H292v146h74v-146zm0 512h74v73h-220v-73H292v-146H218V585h147v219zm294-366h74V512H512v-73h74v-146H512V219h147v219zm74 439H512V585h220v293zm-74-219h-74v146h74v-146z M128 256h192a64 64 0 110 128H128a64 64 0 110-128zm576 192h192a64 64 0 010 128h-192a64 64 0 010-128zm-576 192h192a64 64 0 010 128H128a64 64 0 010-128zm576 0h192a64 64 0 010 128h-192a64 64 0 010-128zm0-384h192a64 64 0 010 128h-192a64 64 0 010-128zM128 448h192a64 64 0 110 128H128a64 64 0 110-128zm384-320a64 64 0 0164 64v640a64 64 0 01-128 0V192a64 64 0 0164-64z From 45f4a5a4b1d9e9779a89b14f7e35276899877fa4 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 7 Nov 2024 11:07:47 +0800 Subject: [PATCH 27/53] ux: layout of floating panels (commands and notifications) (#659) Signed-off-by: leo --- src/Views/LauncherPage.axaml | 180 ++++++++++++++++---------------- src/Views/LauncherPage.axaml.cs | 2 +- 2 files changed, 90 insertions(+), 92 deletions(-) diff --git a/src/Views/LauncherPage.axaml b/src/Views/LauncherPage.axaml index 1b256e7b..e75fd936 100644 --- a/src/Views/LauncherPage.axaml +++ b/src/Views/LauncherPage.axaml @@ -5,6 +5,7 @@ xmlns:m="using:SourceGit.Models" xmlns:v="using:SourceGit.Views" xmlns:vm="using:SourceGit.ViewModels" + xmlns:c="using:SourceGit.Converters" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SourceGit.Views.LauncherPage" x:DataType="vm:LauncherPage"> @@ -38,103 +39,100 @@ - - - - - - - - - - - + + + + + + + + - - - + - - - -
-### pt_BR.axaml: 89.60% +### pt_BR.axaml: 100.00%
Missing Keys -- Text.About.Chart -- Text.AIAssistant -- Text.AIAssistant.Tip -- Text.BranchCM.FetchInto -- Text.ChangeCM.GenerateCommitMessage -- Text.CherryPick.AppendSourceToMessage -- Text.CherryPick.Mainline -- Text.CherryPick.Mainline.Tips -- Text.CommitCM.CherryPickMultiple -- Text.CommitCM.CustomAction -- Text.CommitCM.SquashCommitsSinceThis -- Text.CommitDetail.Info.ContainsIn -- Text.CommitDetail.Info.ContainsIn.Title -- Text.CommitDetail.Info.WebLinks -- Text.Configure.CustomAction -- Text.Configure.CustomAction.Arguments -- Text.Configure.CustomAction.Arguments.Tip -- Text.Configure.CustomAction.Executable -- Text.Configure.CustomAction.Name -- Text.Configure.CustomAction.Scope -- Text.Configure.CustomAction.Scope.Commit -- Text.Configure.CustomAction.Scope.Repository -- Text.Configure.Git.DefaultRemote -- Text.Configure.Git.EnablePruneOnFetch -- Text.Configure.Git.EnableSignOff -- Text.Configure.IssueTracker.AddSampleGitLabIssue -- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest -- Text.Configure.OpenAI -- Text.Configure.OpenAI.Prefered -- Text.Configure.OpenAI.Prefered.Tip -- Text.ConfigureWorkspace -- Text.ConfigureWorkspace.Color -- Text.ConfigureWorkspace.Restore -- Text.ConventionalCommit -- Text.ConventionalCommit.BreakingChanges -- Text.ConventionalCommit.ClosedIssue -- Text.ConventionalCommit.Detail -- Text.ConventionalCommit.Scope -- Text.ConventionalCommit.ShortDescription -- Text.ConventionalCommit.Type -- Text.CopyAllText -- Text.Diff.SaveAsPatch -- Text.Diff.VisualLines.All -- Text.Discard.IncludeIgnored -- Text.ExecuteCustomAction -- Text.ExecuteCustomAction.Name -- Text.FileHistory.FileContent -- Text.FileHistory.FileChange -- Text.GitLFS.Locks.OnlyMine -- Text.Hotkeys.Repo.CreateBranchOnCommit -- Text.Hotkeys.Repo.Fetch -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.IssueLinkCM.OpenInBrowser -- Text.IssueLinkCM.CopyLink -- Text.MoveRepositoryNode -- Text.MoveRepositoryNode.Target -- Text.Preference.AI.Name -- Text.Preference.Appearance.EditorFontSize -- Text.Push.CheckSubmodules -- Text.Repository.CustomActions -- Text.Repository.CustomActions.Empty -- Text.Squash.Into -- Text.Stash.KeepIndex -- Text.Stash.OnlyStagedChanges -- Text.Stash.TipForSelectedFiles -- Text.Statistics.Overview -- Text.TagCM.CopyMessage -- Text.WorkingCopy.Staged.UnstageAll -- Text.WorkingCopy.Unstaged -- Text.WorkingCopy.Unstaged.Stage -- Text.WorkingCopy.Unstaged.StageAll +
From 3b4e03754796b0befe99e393c6de5bb7a3765c74 Mon Sep 17 00:00:00 2001 From: Katharina Sternbauer Date: Fri, 8 Nov 2024 14:25:47 +0100 Subject: [PATCH 39/53] add missing german localization for v8.37 (#664) Add the missing keys in the German translation file. --- src/Resources/Locales/de_DE.axaml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index ef426bf8..c99acf77 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -58,6 +58,7 @@ Lösche alle ausgewählten {0} Branches Alle Änderungen verwerfen Fast-Forward zu ${0}$ + Fetche ${0}$ nach ${1}$... Git Flow - Abschließen ${0}$ Merge ${0}$ in ${1}$ hinein... Pull ${0}$ @@ -72,6 +73,7 @@ ABBRECHEN Auf diese Revision zurücksetzen Auf Vorgänger-Revision zurücksetzen + Generiere Commit-Nachricht ANZEIGE MODUS ÄNDERN Zeige als Datei- und Ordnerliste Zeige als Pfadliste @@ -109,6 +111,7 @@ Mit Worktree vergleichen Info kopieren SHA kopieren + Benutzerdefinierte Aktion Interactives Rebase von ${0}$ auf diesen Commit Rebase von ${0}$ auf diesen Commit Reset ${0}$ auf diesen Commit @@ -140,20 +143,35 @@ COMMIT TEMPLATE Template Name: Template Inhalt: + BENUTZERDEFINIERTE AKTION + Argumente: + ${REPO} - Repository Pfad; ${SHA} - SHA-Wert des selektierten Commits + Ausführbare Datei: + Name: + Geltungsbereich: + Commit + Repository Email Adresse Email Adresse GIT Remotes automatisch fetchen Minute(n) Standard Remote + Aktivere --prune beim fetchen + Aktiviere --signoff für Commits TICKETSYSTEM Beispiel für Github-Regel hinzufügen Beispiel für Jira-Regel hinzufügen + Beispiel für eine Gitlab Issue Regel einfügen + Beispiel für einen Gitlab Merge Request einfügen Neue Regel Ticketnummer Regex-Ausdruck: Name: Ergebnis-URL: Verwende bitte $1, $2 um auf Regex-Gruppenwerte zuzugreifen. + OPEN AI + Bevorzugter Service: + Wenn der 'Bevorzugte Service' aktiviert ist, wird SourceGit nur dieses Repository nutzen. Ansonsten wird, wenn mehrere Services verfügbar sind, eine Kontextmenü zur Auswahl angezeigt. HTTP Proxy HTTP Proxy für dieses Repository Benutzername @@ -245,6 +263,8 @@ Ziel: Ausgewählte Gruppe bearbeiten Ausgewähltes Repository bearbeiten + Führe benutzerte Aktion aus + Name der Aktion: Fast-Forward (ohne Auschecken) Fetch Alle Remotes fetchen @@ -401,8 +421,11 @@ Vor {0} Jahren Einstellungen OPEN AI - Server + Analysierung des Diff Befehl API Schlüssel + Generiere Nachricht Befehl + Name + Server Modell DARSTELLUNG Standardschriftart @@ -506,6 +529,8 @@ Alles löschen Repository Einstellungen WEITER + Benutzerdefinierte Aktionen + Keine benutzerdefinierten Aktionen Aktiviere '--reflog' Option Öffne im Datei-Browser Suche Branches/Tags/Submodule @@ -568,6 +593,7 @@ START Stash Inklusive nicht-verfolgter Dateien + Behalte Dateien des Stages Name: Optional. Name dieses Stashes Nur gestagte Änderungen @@ -637,6 +663,7 @@ Template/Historie Klick-Ereignis auslösen Alle Änderungen stagen und committen + Leerer Commit erkannt! Fortfahren (--allow-empty)? KONFLIKTE ERKANNT DATEI KONFLIKTE GELÖST NICHT-VERFOLGTE DATEIEN INKLUDIEREN From b974436c8abcd5e72a127df48f2800e288451285 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 8 Nov 2024 13:25:59 +0000 Subject: [PATCH 40/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 29 +---------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 9194df17..257c999f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-94.80%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 8d3f8010..c5950f28 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,45 +1,18 @@ -### de_DE.axaml: 94.80% +### de_DE.axaml: 98.70%
Missing Keys -- Text.BranchCM.FetchInto -- Text.ChangeCM.GenerateCommitMessage -- Text.CommitCM.CustomAction -- Text.Configure.CustomAction -- Text.Configure.CustomAction.Arguments -- Text.Configure.CustomAction.Arguments.Tip -- Text.Configure.CustomAction.Executable -- Text.Configure.CustomAction.Name -- Text.Configure.CustomAction.Scope -- Text.Configure.CustomAction.Scope.Commit -- Text.Configure.CustomAction.Scope.Repository -- Text.Configure.Git.EnablePruneOnFetch -- Text.Configure.Git.EnableSignOff -- Text.Configure.IssueTracker.AddSampleGitLabIssue -- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest -- Text.Configure.OpenAI -- Text.Configure.OpenAI.Prefered -- Text.Configure.OpenAI.Prefered.Tip - Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All -- Text.ExecuteCustomAction -- Text.ExecuteCustomAction.Name - Text.Hotkeys.Repo.CreateBranchOnCommit - Text.Hotkeys.Repo.Fetch - Text.Hotkeys.Repo.Pull - Text.Hotkeys.Repo.Push - Text.IssueLinkCM.OpenInBrowser - Text.IssueLinkCM.CopyLink -- Text.Preference.AI.AnalyzeDiffPrompt -- Text.Preference.AI.GenerateSubjectPrompt -- Text.Preference.AI.Name - Text.Preference.Appearance.EditorFontSize -- Text.Repository.CustomActions -- Text.Repository.CustomActions.Empty -- Text.Stash.KeepIndex -- Text.WorkingCopy.ConfirmCommitWithoutFiles
From 4924e960bffc2343f809d3ad93027e6080cf4dad Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 10 Nov 2024 04:51:15 +0000 Subject: [PATCH 41/53] feature: allow merging tags into branches (#671) Adds "Merge {tag} into {branch}" menu item to tag menu in histories. The rest is handled by already existing merge code. --- 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/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 + src/ViewModels/Histories.cs | 17 +++++++++++++++-- 9 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index c99acf77..d1f43695 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -627,6 +627,7 @@ Tag-Namen kopieren Tag-Nachricht kopieren Lösche ${0}$... + Merge ${0}$ in ${1}$ hinein... Pushe ${0}$... URL: Submodule aktualisieren diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 166ad3ab..3803bd39 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -633,6 +633,7 @@ Copy Tag Name Copy Tag Message Delete ${0}$... + Merge ${0}$ into ${1}$... Push ${0}$... URL: Update Submodules diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 43296be0..8ae1d789 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -631,6 +631,7 @@ Copiar Nombre de la Etiqueta Copiar Mensaje de la Etiqueta Eliminar ${0}$... + Merge ${0}$ en ${1}$... Push ${0}$... URL: Actualizar Submódulos diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index f50b8f34..043e8f97 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -551,6 +551,7 @@ OK Copy Tag Name Delete ${0}$... + Fusionner ${0}$ dans ${1}$... Push ${0}$... URL : Actualiser les sous-modules diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index d7f4170d..61ded334 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -661,6 +661,7 @@ Copiar Nome da Tag Copiar mensage da Tag Excluir ${0}$... + Mesclar ${0}$ em ${1}$... Enviar ${0}$... Todos os submódulos Inicializar conforme necessário diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index cfca1cc8..3ea6a922 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -637,6 +637,7 @@ Копировать имя метки Копировать сообщение с метки Удалить ${0}$... + Слить ${0}$ в ${1}$... Выложить ${0}$... Сетевой адрес: Обновление подмодулей diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 5632a3ef..3df54899 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -636,6 +636,7 @@ 复制标签名 复制标签信息 删除 ${0}$... + 合并 ${0}$ 到 ${1}$... 推送 ${0}$... 仓库地址 : 更新子模块 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 229a5fdb..4dcb31aa 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -636,6 +636,7 @@ 複製標籤名稱 複製標籤訊息 刪除 ${0}$... + 合併 ${0}$ 到 ${1}$... 推送 ${0}$... 存放庫網址: 更新子模組 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 688dab87..47736a06 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -365,7 +365,7 @@ namespace SourceGit.ViewModels if (tags.Count > 0) { foreach (var tag in tags) - FillTagMenu(menu, tag); + FillTagMenu(menu, tag, current, commit.IsMerged); menu.Items.Add(new MenuItem() { Header = "-" }); } @@ -893,7 +893,7 @@ namespace SourceGit.ViewModels menu.Items.Add(submenu); } - private void FillTagMenu(ContextMenu menu, Models.Tag tag) + private void FillTagMenu(ContextMenu menu, Models.Tag tag, Models.Branch current, bool merged) { var submenu = new MenuItem(); submenu.Header = tag.Name; @@ -912,6 +912,19 @@ namespace SourceGit.ViewModels }; submenu.Items.Add(push); + var merge = new MenuItem(); + merge.Header = new Views.NameHighlightedTextBlock("TagCM.Merge", tag.Name, current.Name); + merge.Icon = App.CreateMenuIcon("Icons.Merge"); + merge.IsEnabled = !merged; + merge.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new Merge(_repo, tag.Name, current.Name)); + e.Handled = true; + }; + submenu.Items.Add(merge); + submenu.Items.Add(new MenuItem() { Header = "-" }); + var delete = new MenuItem(); delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name); delete.Icon = App.CreateMenuIcon("Icons.Clear"); From 96c2d0b3caad9dc7f9fea884639d88d95d5af720 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 10 Nov 2024 04:51:30 +0000 Subject: [PATCH 42/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 257c999f..99f4370e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index c5950f28..dd16b917 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -31,7 +31,7 @@ -### fr_FR.axaml: 86.56% +### fr_FR.axaml: 86.58%
From bbfc94d624d7ec2c1d77a64fc2661c77ebc70ca3 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Sun, 10 Nov 2024 04:56:08 +0000 Subject: [PATCH 43/53] enhance: several commit links improvements (#672) * Codeberge (https://codeberg.org/) * Gitea (https://gitea.org/) * sourcehut (https://git.sr.ht/) --- src/ViewModels/CommitDetail.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 1600c4cd..f1f39f6f 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -116,13 +116,19 @@ namespace SourceGit.ViewModels if (remote.TryGetVisitURL(out var url)) { if (url.StartsWith("https://github.com/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = "Github", URLPrefix = $"{url}/commit/" }); - else if (url.StartsWith("https://gitlab.com/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = "GitLab", URLPrefix = $"{url}/-/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Github", url), URLPrefix = $"{url}/commit/" }); + else if (url.StartsWith("https://gitlab.", StringComparison.Ordinal)) + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("GitLab", url), URLPrefix = $"{url}/-/commit/" }); else if (url.StartsWith("https://gitee.com/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = "Gitee", URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Gitee", url), URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://bitbucket.org/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = "Bitbucket", URLPrefix = $"{url}/commits/" }); + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Bitbucket", url), URLPrefix = $"{url}/commits/" }); + else if (url.StartsWith("https://codeberg.org/", StringComparison.Ordinal)) + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Codeberg", url), URLPrefix = $"{url}/commit/" }); + else if (url.StartsWith("https://gitea.org/", StringComparison.Ordinal)) + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Gitea", url), URLPrefix = $"{url}/commit/" }); + else if (url.StartsWith("https://git.sr.ht/", StringComparison.Ordinal)) + WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("sourcehut", url), URLPrefix = $"{url}/commit/" }); } } } @@ -639,6 +645,18 @@ namespace SourceGit.ViewModels menu.Items.Add(new MenuItem() { Header = "-" }); } + private string CommitUrlTitle(string provider, string url) + { + try + { + return string.Format("{0} ({1})", provider, string.Join('/', url.Split('/')[3..5])); + } + catch + { + return provider; + } + } + [GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")] private static partial Regex REG_LFS_FORMAT(); From daba8e5064dc4ff9dfef818f7b6f9c85e0c758f1 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 10 Nov 2024 13:19:05 +0800 Subject: [PATCH 44/53] code_review: PR #672 * use formatted string instead of `CommitUrlTitle` Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index f1f39f6f..3f41eb99 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -115,20 +115,24 @@ namespace SourceGit.ViewModels { if (remote.TryGetVisitURL(out var url)) { + var trimmedUrl = url; + if (url.EndsWith(".git")) + trimmedUrl = url.Substring(0, url.Length - 4); + if (url.StartsWith("https://github.com/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Github", url), URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"Github ({trimmedUrl.Substring(19)})", URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://gitlab.", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("GitLab", url), URLPrefix = $"{url}/-/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"GitLab ({trimmedUrl.Substring(trimmedUrl.Substring(15).IndexOf('/') + 16)})", URLPrefix = $"{url}/-/commit/" }); else if (url.StartsWith("https://gitee.com/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Gitee", url), URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"Gitee ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://bitbucket.org/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Bitbucket", url), URLPrefix = $"{url}/commits/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"BitBucket ({trimmedUrl.Substring(22)})", URLPrefix = $"{url}/commits/" }); else if (url.StartsWith("https://codeberg.org/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Codeberg", url), URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"Codeberg ({trimmedUrl.Substring(21)})", URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://gitea.org/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("Gitea", url), URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"Gitea ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" }); else if (url.StartsWith("https://git.sr.ht/", StringComparison.Ordinal)) - WebLinks.Add(new Models.CommitLink() { Name = CommitUrlTitle("sourcehut", url), URLPrefix = $"{url}/commit/" }); + WebLinks.Add(new Models.CommitLink() { Name = $"sourcehut ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" }); } } } @@ -645,18 +649,6 @@ namespace SourceGit.ViewModels menu.Items.Add(new MenuItem() { Header = "-" }); } - private string CommitUrlTitle(string provider, string url) - { - try - { - return string.Format("{0} ({1})", provider, string.Join('/', url.Split('/')[3..5])); - } - catch - { - return provider; - } - } - [GeneratedRegex(@"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$")] private static partial Regex REG_LFS_FORMAT(); From 8de37720faff606935be2fed5a278d18fe8a6237 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 10 Nov 2024 13:19:25 +0800 Subject: [PATCH 45/53] code_style: remove Rider warnings Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 2 +- src/ViewModels/Histories.cs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 3f41eb99..cf677c34 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -196,7 +196,7 @@ namespace SourceGit.ViewModels var stream = Commands.QueryFileContent.Run(_repo.FullPath, _commit.SHA, file.Path); var fileSize = stream.Length; var bitmap = fileSize > 0 ? new Bitmap(stream) : null; - var imageType = Path.GetExtension(file.Path).TrimStart('.').ToUpper(CultureInfo.CurrentCulture); + var imageType = ext!.Substring(1).ToUpper(CultureInfo.CurrentCulture); var image = new Models.RevisionImageFile() { Image = bitmap, FileSize = fileSize, ImageType = imageType }; Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = image); } diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 47736a06..55b04713 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -153,12 +153,9 @@ namespace SourceGit.ViewModels } else if (commits.Count == 1) { - var commit = commits[0] as Models.Commit; - + var commit = (commits[0] as Models.Commit)!; if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA) - { _repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA); - } AutoSelectedCommit = commit; NavigationId = _navigationId + 1; @@ -224,7 +221,7 @@ namespace SourceGit.ViewModels public ContextMenu MakeContextMenu(ListBox list) { var current = _repo.CurrentBranch; - if (current == null) + if (current == null || list.SelectedItems == null) return null; if (list.SelectedItems.Count > 1) From 8b3212e287c72b3afd219468da179bc3b2fc5f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A0s=20Civil?= <70479573+BernatBC@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:19:41 +0100 Subject: [PATCH 46/53] localization: update spanish translation (#676) --- src/Resources/Locales/es_ES.axaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 8ae1d789..6bc96dd1 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -242,6 +242,7 @@ Siguiente Diferencia SIN CAMBIOS O SOLO CAMBIOS DE EOL Diferencia Anterior + Guardar como Patch Mostrar símbolos ocultos Diferencia Lado a Lado SUBMÓDULO @@ -367,8 +368,12 @@ Commit cambios staged Commit y push cambios staged Stage todos los cambios y commit + Crea una nueva rama basada en el commit seleccionado Descartar cambios seleccionados + Fetch, empieza directamente Modo Dashboard (Por Defecto) + Pull, empieza directamente + Push, empieza directamente Forzar a recargar este repositorio Stage/Unstage cambios seleccionados Modo de búsqueda de commits @@ -434,6 +439,7 @@ APARIENCIA Fuente por defecto Tamaño de fuente por defecto + Tamaño de fuente del editor Fuente Monospace Usar solo fuente monospace en el editor de texto Tema From e2e79fe1b34a5524dac49dbfb53b27accabd9049 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 Nov 2024 01:19:53 +0000 Subject: [PATCH 47/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 99f4370e..e464f74c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index dd16b917..587ba99a 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -16,18 +16,13 @@
-### es_ES.axaml: 99.13% +### es_ES.axaml: 100.00%
Missing Keys -- Text.Diff.SaveAsPatch -- Text.Hotkeys.Repo.CreateBranchOnCommit -- Text.Hotkeys.Repo.Fetch -- Text.Hotkeys.Repo.Pull -- Text.Hotkeys.Repo.Push -- Text.Preference.Appearance.EditorFontSize +
From 03f96cc9f8d76754d58b25509c258ea5e48177f5 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Mon, 11 Nov 2024 01:24:49 +0000 Subject: [PATCH 48/53] feature: add children list to the commit base info view (#673) --- src/Commands/QueryCommitChildren.cs | 34 +++++++++++++++++++++++++++++ src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/fr_FR.axaml | 1 + src/ViewModels/CommitDetail.cs | 13 +++++++++++ src/Views/CommitBaseInfo.axaml | 34 ++++++++++++++++++++++++----- src/Views/CommitBaseInfo.axaml.cs | 11 +++++++++- src/Views/CommitDetail.axaml | 1 + 7 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 src/Commands/QueryCommitChildren.cs diff --git a/src/Commands/QueryCommitChildren.cs b/src/Commands/QueryCommitChildren.cs new file mode 100644 index 00000000..22a44563 --- /dev/null +++ b/src/Commands/QueryCommitChildren.cs @@ -0,0 +1,34 @@ +namespace SourceGit.Commands +{ + public class QueryCommitChildren : Command + { + public QueryCommitChildren(string repo, string sha) + { + WorkingDirectory = repo; + Context = repo; + _sha = sha; + Args = $"rev-list --children --all {sha}^.."; + } + + public string[] Result() + { + var rs = ReadToEnd(); + if (!rs.IsSuccess) + return []; + + int start = rs.StdOut.IndexOf($"\n{_sha}"); + if (start != -1) + { + int end = rs.StdOut.IndexOf('\n', start + 1); + if (end == -1) + end = rs.StdOut.Length; + start = rs.StdOut.IndexOf(' ', start); + if (start != -1 && start < end) + return rs.StdOut.Substring(start + 1, end - start - 1).Split(' ', System.StringSplitOptions.RemoveEmptyEntries); + } + return []; + } + + private string _sha; + } +} diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 3803bd39..302f7cba 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -125,6 +125,7 @@ INFORMATION AUTHOR CHANGED + CHILDREN COMMITTER Check refs that contains this commit COMMIT IS CONTAINED BY diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 043e8f97..88e2a661 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -118,6 +118,7 @@ INFORMATIONS AUTEUR CHANGÉ + ENFANTS COMMITTER Vérifier les références contenant ce commit LE COMMIT EST CONTENU PAR diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index cf677c34..349dc56d 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -78,6 +78,12 @@ namespace SourceGit.ViewModels } } + public AvaloniaList Children + { + get; + private set; + } = new AvaloniaList(); + public string SearchChangeFilter { get => _searchChangeFilter; @@ -496,6 +502,7 @@ namespace SourceGit.ViewModels VisibleChanges = null; SelectedChanges = null; ViewRevisionFileContent = null; + Children.Clear(); if (_commit == null) return; @@ -512,6 +519,12 @@ namespace SourceGit.ViewModels Dispatcher.UIThread.Invoke(() => SignInfo = signInfo); }); + Task.Run(() => + { + var children = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA).Result(); + Dispatcher.UIThread.Invoke(() => Children.AddRange(children)); + }); + if (_cancelToken != null) _cancelToken.Requested = true; diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index a16143ae..a886cd9e 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -51,7 +51,7 @@ - + @@ -117,14 +117,36 @@ TextDecorations="Underline" Cursor="Hand" Margin="0,0,16,0" - PointerPressed="OnParentSHAPressed"/> + PointerPressed="OnSHAPressed"/> + + + + + + + + + + + + + + + + - - + + - - + SetValue(IssueTrackerRulesProperty, value); } + public static readonly StyledProperty> ChildrenProperty = + AvaloniaProperty.Register>(nameof(Children)); + + public AvaloniaList Children + { + get => GetValue(ChildrenProperty); + set => SetValue(ChildrenProperty, value); + } + public CommitBaseInfo() { InitializeComponent(); @@ -113,7 +122,7 @@ namespace SourceGit.Views e.Handled = true; } - private void OnParentSHAPressed(object sender, PointerPressedEventArgs e) + private void OnSHAPressed(object sender, PointerPressedEventArgs e) { if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha }) { diff --git a/src/Views/CommitDetail.axaml b/src/Views/CommitDetail.axaml index cb99b3d9..4c6fd5dc 100644 --- a/src/Views/CommitDetail.axaml +++ b/src/Views/CommitDetail.axaml @@ -24,6 +24,7 @@ SignInfo="{Binding SignInfo}" SupportsContainsIn="True" WebLinks="{Binding WebLinks}" + Children="{Binding Children}" IssueTrackerRules="{Binding IssueTrackerRules}"/> From 055835cac2d571c02047cf9f4c83f1141ebc5173 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 Nov 2024 01:25:03 +0000 Subject: [PATCH 49/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e464f74c..23a68cd7 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.56%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.86%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.60%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.86%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.86%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 587ba99a..bbc6ff9f 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,9 +1,10 @@ -### de_DE.axaml: 98.70% +### de_DE.axaml: 98.56%
Missing Keys +- Text.CommitDetail.Info.Children - Text.Diff.SaveAsPatch - Text.Diff.VisualLines.All - Text.Hotkeys.Repo.CreateBranchOnCommit @@ -16,17 +17,17 @@
-### es_ES.axaml: 100.00% +### es_ES.axaml: 99.86%
Missing Keys - +- Text.CommitDetail.Info.Children
-### fr_FR.axaml: 86.58% +### fr_FR.axaml: 86.60%
@@ -128,42 +129,42 @@
-### pt_BR.axaml: 100.00% +### pt_BR.axaml: 99.86%
Missing Keys - +- Text.CommitDetail.Info.Children
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.86%
Missing Keys - +- Text.CommitDetail.Info.Children
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.86%
Missing Keys - +- Text.CommitDetail.Info.Children
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.86%
Missing Keys - +- Text.CommitDetail.Info.Children
From bbac6c14781286b5c76e911810cd8b712b70e937 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 09:31:04 +0800 Subject: [PATCH 50/53] code_review: PR #673 * add translations for zh_CN and zh_TW * hide `CHILDREN` line if it is empty Signed-off-by: leo --- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/CommitBaseInfo.axaml | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 3df54899..34c8e647 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -128,6 +128,7 @@ 基本信息 修改者 变更列表 + 子提交 提交者 查看包含此提交的分支/标签 本提交已被以下分支/标签包含 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 4dcb31aa..a35abc1c 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -128,6 +128,7 @@ 基本資訊 作者 變更列表 + 子提交 提交者 檢視包含此提交的分支或標籤 本提交包含於以下分支或標籤 diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index a886cd9e..5f80f5f9 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -123,8 +123,14 @@ - - + + From 06656f625e4e92d306c1d2c519f96bc193087950 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 11 Nov 2024 01:31:18 +0000 Subject: [PATCH 51/53] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 23a68cd7..1cc9b64e 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.56%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.86%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.60%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.86%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.86%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.86%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.86%25-yellow)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.56%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.86%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.60%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.86%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.86%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index bbc6ff9f..fa6701f0 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -149,22 +149,22 @@ -### zh_CN.axaml: 99.86% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.CommitDetail.Info.Children +
-### zh_TW.axaml: 99.86% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.CommitDetail.Info.Children +
From 67cf23267a76a5c2727833c5e8716ec34050e03f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 09:37:27 +0800 Subject: [PATCH 52/53] feature: supports open selected revision file with default editor (#674) Signed-off-by: leo --- src/ViewModels/CommitDetail.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 349dc56d..d180f6d6 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -384,6 +384,16 @@ namespace SourceGit.ViewModels ev.Handled = true; }; + var openWith = new MenuItem(); + openWith.Header = App.Text("OpenWith"); + openWith.Icon = App.CreateMenuIcon("Icons.OpenWith"); + openWith.IsEnabled = File.Exists(fullPath); + openWith.Click += (_, ev) => + { + Native.OS.OpenWithDefaultEditor(fullPath); + ev.Handled = true; + }; + var saveAs = new MenuItem(); saveAs.Header = App.Text("SaveAs"); saveAs.Icon = App.CreateMenuIcon("Icons.Save"); @@ -413,6 +423,7 @@ namespace SourceGit.ViewModels }; menu.Items.Add(explore); + menu.Items.Add(openWith); menu.Items.Add(saveAs); menu.Items.Add(new MenuItem() { Header = "-" }); From 7df6d32ad2c55894863411bc24a8694163c260de Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 11 Nov 2024 09:55:40 +0800 Subject: [PATCH 53/53] version: release 8.38 Signed-off-by: leo --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a5e93156..833d11c8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.37 \ No newline at end of file +8.38 \ No newline at end of file