From 9f5cbaba09ec3726e3eda86a2b450dac89958c7d Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 09:56:07 +0800 Subject: [PATCH 01/51] fix: `publish-packages` should depends on `package` and `version` --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a38c174..223fe75f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,7 @@ jobs: with: version: ${{ needs.version.outputs.version }} publish-packages: + needs: [package, version] name: Publish Packages uses: ./.github/workflows/publish-packages.yml secrets: From a9011ddc2c2a4667d8aa99fe042df480ecae670f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 10:24:59 +0800 Subject: [PATCH 02/51] readme: update tooltips for Linux users --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 06842e37..9c317267 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ For **macOS** users: For **Linux** users: +* `DEB` or `RPM` packages are available at [buildkite](https://buildkite.com/organizations/sourcegit/packages). * `xdg-open` must be installed to support open native file manager. * Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your linux. * Maybe you need to set environment variable `AVALONIA_SCREEN_SCALE_FACTORS`. See https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI. From 19307cebc00822b64372d3f194563ea5c106941f Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 16:11:20 +0800 Subject: [PATCH 03/51] ux: update icon for `Block-Navigation` --- 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 8fa23fb7..59cb1ca1 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -15,7 +15,7 @@ M797 829a49 49 0 1049 49 49 49 0 00-49-49zm147-114A49 49 0 10992 764a49 49 0 00-49-49zM928 861a49 49 0 1049 49A49 49 0 00928 861zm-5-586L992 205 851 64l-71 71a67 67 0 00-94 0l235 235a67 67 0 000-94zm-853 128a32 32 0 00-32 50 1291 1291 0 0075 112L288 552c20 0 25 21 8 37l-93 86a1282 1282 0 00120 114l100-32c19-6 28 15 14 34l-40 55c26 19 53 36 82 53a89 89 0 00115-20 1391 1391 0 00256-485l-188-188s-306 224-595 198z M1280 704c0 141-115 256-256 256H288C129 960 0 831 0 672c0-126 80-232 192-272A327 327 0 01192 384c0-177 143-320 320-320 119 0 222 64 277 160C820 204 857 192 896 192c106 0 192 86 192 192 0 24-5 48-13 69C1192 477 1280 580 1280 704zm-493-128H656V352c0-18-14-32-32-32h-96c-18 0-32 14-32 32v224h-131c-29 0-43 34-23 55l211 211c12 12 33 12 45 0l211-211c20-20 6-55-23-55z M853 102H171C133 102 102 133 102 171v683C102 891 133 922 171 922h683C891 922 922 891 922 853V171C922 133 891 102 853 102zM390 600l-48 48L205 512l137-137 48 48L301 512l88 88zM465 819l-66-18L559 205l66 18L465 819zm218-171L634 600 723 512l-88-88 48-48L819 512 683 649z - M320 171A21 21 0 00299 192v213c0 49-32 85-61 107 30 22 61 58 61 107V832A21 21 0 00320 853h85v85H320A107 107 0 01213 832V619c0-11-8-26-32-42a157 157 0 00-33-17c-11-4-18-5-20-5v-85c2 0 9-1 20-5a157 157 0 0033-17c24-16 32-32 32-42V192A107 107 0 01320 85h85v85H320zm384 0h-85V85H704A107 107 0 01811 192v213c0 11 8 26 32 42 11 7 22 13 33 17 11 4 18 5 20 5v85c-2 0-9 1-20 5a157 157 0 00-33 17c-24 16-32 31-32 42V832A107 107 0 01704 939h-85v-85H704A21 21 0 00725 832V619c0-49 32-85 61-107-30-22-61-58-61-107V192A21 21 0 00704 171z + M684 736 340 736l0-53 344 1-0 53zM552 565l-213-2 0-53 212 2-0 53zM684 392 340 392l0-53 344 1-0 53zM301 825c-45 0-78-9-100-27-22-18-33-43-33-75v-116c0-22-4-37-12-45-7-9-20-13-40-13v-61c19 0 32-4 40-12 8-9 12-24 12-46v-116c0-32 11-57 33-75 22-18 56-27 100-27h24v61h-24a35 35 0 00-27 12 41 41 0 00-11 29v116c0 35-10 60-31 75a66 66 0 01-31 14c11 2 22 6 31 14 20 17 31 42 31 75v116c0 12 4 22 11 29 7 8 16 12 27 12h24v61h-24zM701 764h24c10 0 19-4 27-12a41 41 0 0011-29v-116c0-33 10-58 31-75 9-7 19-12 31-14a66 66 0 01-31-14c-20-15-31-40-31-75v-116a41 41 0 00-11-29 35 35 0 00-27-12h-24v-61h24c45 0 78 9 100 27 22 18 33 43 33 75v116c0 22 4 37 11 46 8 8 21 12 40 12v61c-19 0-33 4-40 13-7 8-11 23-11 45v116c0 32-11 57-33 75-22 18-55 27-100 27h-24v-61z M128 854h768v86H128zM390 797c13 13 29 19 48 19s35-6 45-19l291-288c26-22 26-64 0-90L435 83l-61 61L426 192l-272 269c-22 22-22 64 0 90l237 246zm93-544 211 211-32 32H240l243-243zM707 694c0 48 38 86 86 86 48 0 86-38 86-86 0-22-10-45-26-61L794 576l-61 61c-13 13-26 35-26 58z M796 471A292 292 0 00512 256a293 293 0 00-284 215H0v144h228A293 293 0 00512 832a291 291 0 00284-217H1024V471h-228M512 688A146 146 0 01366 544A145 145 0 01512 400c80 0 146 63 146 144A146 146 0 01512 688 M796 561a5 5 0 014 7l-39 90a5 5 0 004 7h100a5 5 0 014 8l-178 247a5 5 0 01-9-4l32-148a5 5 0 00-5-6h-89a5 5 0 01-4-7l86-191a5 5 0 014-3h88zM731 122a73 73 0 0173 73v318a54 54 0 00-8-1H731V195H244v634h408l-16 73H244a73 73 0 01-73-73V195a73 73 0 0173-73h488zm-219 366v73h-195v-73h195zm146-146v73H317v-73h341z From bea2a39feb18cf4ef427f319f0436bd3f80546f5 Mon Sep 17 00:00:00 2001 From: Luigi Grilli Date: Mon, 9 Dec 2024 08:35:49 +0000 Subject: [PATCH 04/51] =?UTF-8?q?feature:=20added=20`Ctrl+N/=E2=8C=98+N`?= =?UTF-8?q?=20=20shortcut=20(#795)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 726cf0d376a9af9167145560977ec6e1bf748277) --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/it_IT.axaml | 1 + src/Views/Hotkeys.axaml | 9 ++++++--- src/Views/Launcher.axaml.cs | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 89309bef..a5767355 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -357,6 +357,7 @@ Keyboard Shortcuts Reference GLOBAL Cancel current popup + Clone new repository Close current page Go to previous page Go to next page diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 2e3acf3e..fbf918b8 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -357,6 +357,7 @@ Riferimento Scorciatoie da Tastiera GLOBALE Annulla il popup corrente + Clona una nuova repository Chiudi la pagina corrente Vai alla pagina precedente Vai alla pagina successiva diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 4fe77066..19f9dc78 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -45,7 +45,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,0,0,8"/> - + @@ -61,8 +61,11 @@ - - + + + + + Date: Mon, 9 Dec 2024 08:36:52 +0000 Subject: [PATCH 05/51] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9c317267..e5306898 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.58%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-97.03%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.45%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.87%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.44%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.72%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.89%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.73%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 761edbf6..da30aaa8 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,4 +1,4 @@ -### de_DE.axaml: 99.58% +### de_DE.axaml: 99.44%
@@ -6,21 +6,23 @@ - Text.CommitDetail.Files.Search - Text.Diff.UseBlockNavigation +- Text.Hotkeys.Global.Clone - Text.WorkingCopy.CommitToEdit
-### es_ES.axaml: 99.86% +### es_ES.axaml: 99.72%
Missing Keys - Text.Diff.UseBlockNavigation +- Text.Hotkeys.Global.Clone
-### fr_FR.axaml: 97.03% +### fr_FR.axaml: 96.89%
@@ -32,6 +34,7 @@ - Text.CommitDetail.Files.Search - Text.Diff.UseBlockNavigation - Text.Fetch.Force +- Text.Hotkeys.Global.Clone - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor @@ -50,7 +53,7 @@
-### it_IT.axaml: 97.45% +### it_IT.axaml: 97.46%
@@ -77,7 +80,7 @@
-### pt_BR.axaml: 98.87% +### pt_BR.axaml: 98.73%
@@ -87,6 +90,7 @@ - Text.CommitDetail.Info.Children - Text.Diff.UseBlockNavigation - Text.Fetch.Force +- Text.Hotkeys.Global.Clone - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.SHALinkCM.NavigateTo @@ -94,32 +98,32 @@
-### ru_RU.axaml: 100.00% +### ru_RU.axaml: 99.86%
Missing Keys - +- Text.Hotkeys.Global.Clone
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.86%
Missing Keys - +- Text.Hotkeys.Global.Clone
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.86%
Missing Keys - +- Text.Hotkeys.Global.Clone
From ee3942fec6fee5249347b414fab2d4153cb89f3b Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 16:44:16 +0800 Subject: [PATCH 06/51] code_review: PR #795 * update zh_CN and zh_TW translations * simplify calling `Welcome.Clone` --- src/Resources/Locales/zh_CN.axaml | 1 + src/Resources/Locales/zh_TW.axaml | 1 + src/Views/Launcher.axaml.cs | 10 ++-------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index d6bbad3f..d567abaa 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -360,6 +360,7 @@ 快捷键参考 全局快捷键 取消弹出面板 + 克隆远程仓库 关闭当前页面 切换到上一个页面 切换到下一个页面 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 0034c3f4..2803c400 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -360,6 +360,7 @@ 快速鍵參考 全域快速鍵 取消彈出面板 + 複製 (clone) 遠端存放庫 關閉目前頁面 切換到上一個頁面 切換到下一個頁面 diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index b71208ba..a3a3af8b 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -139,15 +139,9 @@ namespace SourceGit.Views if (e.Key == Key.N) { if (vm.ActivePage.Data is not ViewModels.Welcome) - { vm.AddNewTab(); - } - - if (vm.ActivePage.Data is ViewModels.Welcome welcome) - { - welcome.Clone(); - } - + + ViewModels.Welcome.Instance.Clone(); e.Handled = true; return; } From c9c7fb5d5ba0d4a1cd02d0c4a55804375772926d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Dec 2024 08:44:36 +0000 Subject: [PATCH 07/51] 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 e5306898..a3432d24 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.44%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.72%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.89%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.73%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-99.44%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.72%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.89%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.73%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 da30aaa8..2773a2e3 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -108,22 +108,22 @@ -### zh_CN.axaml: 99.86% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Global.Clone +
-### zh_TW.axaml: 99.86% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.Hotkeys.Global.Clone +
From dce33fdf607093f57b136a3f9a12673b6807d561 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Mon, 9 Dec 2024 13:04:25 +0000 Subject: [PATCH 08/51] feature: merge multiple heads (#793) * feature: allow merging multiple heads * feature: allow merging multiple branches from branch tree --- src/Commands/Merge.cs | 6 ++- src/Models/MergeStrategy.cs | 24 ++++++++++ src/Resources/Locales/en_US.axaml | 6 +++ src/ViewModels/Histories.cs | 34 ++++++++++--- src/ViewModels/Merge.cs | 2 +- src/ViewModels/MergeMultiple.cs | 59 +++++++++++++++++++++++ src/ViewModels/Pull.cs | 2 +- src/ViewModels/Repository.cs | 7 +++ src/Views/BranchTree.axaml.cs | 11 +++++ src/Views/MergeMultiple.axaml | 79 +++++++++++++++++++++++++++++++ src/Views/MergeMultiple.axaml.cs | 12 +++++ 11 files changed, 232 insertions(+), 10 deletions(-) create mode 100644 src/Models/MergeStrategy.cs create mode 100644 src/ViewModels/MergeMultiple.cs create mode 100644 src/Views/MergeMultiple.axaml create mode 100644 src/Views/MergeMultiple.axaml.cs diff --git a/src/Commands/Merge.cs b/src/Commands/Merge.cs index cf2e285f..a524af05 100644 --- a/src/Commands/Merge.cs +++ b/src/Commands/Merge.cs @@ -4,13 +4,15 @@ namespace SourceGit.Commands { public class Merge : Command { - public Merge(string repo, string source, string mode, Action outputHandler) + public Merge(string repo, string source, string mode, string strategy, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; Context = repo; TraitErrorAsOutput = true; - Args = $"merge --progress {source} {mode}"; + if (strategy != null) + strategy = string.Concat("--strategy=", strategy); + Args = $"merge --progress {strategy} {source} {mode}"; } protected override void OnReadline(string line) diff --git a/src/Models/MergeStrategy.cs b/src/Models/MergeStrategy.cs new file mode 100644 index 00000000..a79bcf59 --- /dev/null +++ b/src/Models/MergeStrategy.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace SourceGit.Models +{ + public class MergeStrategy + { + public string Name { get; internal set; } + public string Desc { get; internal set; } + public string Arg { get; internal set; } + + public static List ForMultiple { get; private set; } = [ + new MergeStrategy(string.Empty, "Let Git automatically select a strategy", null), + new MergeStrategy("Octopus", "Attempt merging multiple heads", "octopus"), + new MergeStrategy("Ours", "Record the merge without modifying the tree", "ours"), + ]; + + public MergeStrategy(string n, string d, string a) + { + Name = n; + Desc = d; + Arg = a; + } + } +} diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index a5767355..c50f3c4f 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -58,6 +58,7 @@ Fetch ${0}$ into ${1}$... Git Flow - Finish ${0}$ Merge ${0}$ into ${1}$... + Merge selected {0} branches Pull ${0}$ Pull ${0}$ into ${1}$... Push ${0}$ @@ -110,6 +111,7 @@ Copy SHA Custom Action Interactive Rebase ${0}$ to Here + Merge ... Rebase ${0}$ to Here Reset ${0}$ to Here Revert Commit @@ -404,6 +406,10 @@ Into: Merge Option: Source Branch: + Merge commits + Commit(s): + Commit all changes + Strategy: Move Repository Node Select parent node for: Name: diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 18ca2e51..b38b4afc 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -228,22 +228,28 @@ namespace SourceGit.ViewModels { var selected = new List(); var canCherryPick = true; + var canMerge = true; + foreach (var item in list.SelectedItems) { if (item is Models.Commit c) { selected.Add(c); - if (c.IsMerged || c.Parents.Count > 1) + if (c.IsMerged) + { + canMerge = false; canCherryPick = false; + } + else if (c.Parents.Count > 1) + { + canCherryPick = false; + } } } // Sort selected commits in order. - selected.Sort((l, r) => - { - return _commits.IndexOf(r) - _commits.IndexOf(l); - }); + selected.Sort((l, r) => _commits.IndexOf(r) - _commits.IndexOf(l)); var multipleMenu = new ContextMenu(); @@ -259,9 +265,25 @@ namespace SourceGit.ViewModels e.Handled = true; }; multipleMenu.Items.Add(cherryPickMultiple); - multipleMenu.Items.Add(new MenuItem() { Header = "-" }); } + if (canMerge) + { + var mergeMultiple = new MenuItem(); + mergeMultiple.Header = App.Text("CommitCM.MergeMultiple"); + mergeMultiple.Icon = App.CreateMenuIcon("Icons.Merge"); + mergeMultiple.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new MergeMultiple(_repo, selected)); + e.Handled = true; + }; + multipleMenu.Items.Add(mergeMultiple); + } + + if (canCherryPick || canMerge) + multipleMenu.Items.Add(new MenuItem() { Header = "-" }); + var saveToPatchMultiple = new MenuItem(); saveToPatchMultiple.Icon = App.CreateMenuIcon("Icons.Diff"); saveToPatchMultiple.Header = App.Text("CommitCM.SaveAsPatch"); diff --git a/src/ViewModels/Merge.cs b/src/ViewModels/Merge.cs index b7630101..116797a8 100644 --- a/src/ViewModels/Merge.cs +++ b/src/ViewModels/Merge.cs @@ -37,7 +37,7 @@ namespace SourceGit.ViewModels return Task.Run(() => { - var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, SetProgressDescription).Exec(); + var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, null, SetProgressDescription).Exec(); CallUIThread(() => _repo.SetWatcherEnabled(true)); return succ; }); diff --git a/src/ViewModels/MergeMultiple.cs b/src/ViewModels/MergeMultiple.cs new file mode 100644 index 00000000..03d24773 --- /dev/null +++ b/src/ViewModels/MergeMultiple.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using SourceGit.Models; + +namespace SourceGit.ViewModels +{ + public class MergeMultiple : Popup + { + public List Strategies = ["octopus", "ours"]; + + public List Targets + { + get; + private set; + } + + public bool AutoCommit + { + get; + set; + } + + public MergeStrategy Strategy + { + get; + set; + } + + public MergeMultiple(Repository repo, List targets) + { + _repo = repo; + Targets = targets; + AutoCommit = true; + Strategy = MergeStrategy.ForMultiple.Find(s => s.Arg == null); + View = new Views.MergeMultiple() { DataContext = this }; + } + + public override Task Sure() + { + _repo.SetWatcherEnabled(false); + ProgressDescription = "Merge head(s) ..."; + + return Task.Run(() => + { + var succ = new Commands.Merge( + _repo.FullPath, + string.Join(" ", Targets.ConvertAll(c => c.Decorators.Find(d => d.Type == DecoratorType.RemoteBranchHead || d.Type == DecoratorType.LocalBranchHead)?.Name ?? c.Decorators.Find(d => d.Type == DecoratorType.Tag)?.Name ?? c.SHA)), + AutoCommit ? string.Empty : "--no-commit", + Strategy?.Arg, + SetProgressDescription).Exec(); + + CallUIThread(() => _repo.SetWatcherEnabled(true)); + return succ; + }); + } + + private readonly Repository _repo = null; + } +} diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index e7c62980..2d0e8da2 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -172,7 +172,7 @@ namespace SourceGit.ViewModels else { SetProgressDescription($"Merge {_selectedBranch.FriendlyName} into {_current.Name} ..."); - rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", SetProgressDescription).Exec(); + rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", null, SetProgressDescription).Exec(); } } else diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 38855fef..d593171e 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -13,6 +13,7 @@ using Avalonia.Media.Imaging; using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; +using SourceGit.Models; namespace SourceGit.ViewModels { @@ -950,6 +951,12 @@ namespace SourceGit.ViewModels PopupHost.ShowPopup(new DeleteMultipleBranches(this, branches, isLocal)); } + public void MergeMultipleBranches(List branches) + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new MergeMultiple(this, branches.ConvertAll(b => _histories?.Commits?.Find(c => c.SHA == b.Head)))); + } + public void CreateNewTag() { if (_currentBranch == null) diff --git a/src/Views/BranchTree.axaml.cs b/src/Views/BranchTree.axaml.cs index 92c2b043..d9588a0f 100644 --- a/src/Views/BranchTree.axaml.cs +++ b/src/Views/BranchTree.axaml.cs @@ -405,6 +405,17 @@ namespace SourceGit.Views ev.Handled = true; }; menu.Items.Add(deleteMulti); + + var mergeMulti = new MenuItem(); + mergeMulti.Header = App.Text("BranchCM.MergeMultiBranches", branches.Count); + mergeMulti.Icon = App.CreateMenuIcon("Icons.Merge"); + mergeMulti.Click += (_, ev) => + { + repo.MergeMultipleBranches(branches); + ev.Handled = true; + }; + menu.Items.Add(mergeMulti); + menu?.Open(this); } } diff --git a/src/Views/MergeMultiple.axaml b/src/Views/MergeMultiple.axaml new file mode 100644 index 00000000..01a6b976 --- /dev/null +++ b/src/Views/MergeMultiple.axaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/MergeMultiple.axaml.cs b/src/Views/MergeMultiple.axaml.cs new file mode 100644 index 00000000..c0997067 --- /dev/null +++ b/src/Views/MergeMultiple.axaml.cs @@ -0,0 +1,12 @@ +using Avalonia.Controls; + +namespace SourceGit.Views +{ + public partial class MergeMultiple : UserControl + { + public MergeMultiple() + { + InitializeComponent(); + } + } +} From 4eed9674b432c2770717cb6c7fa95d60e1afa481 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Dec 2024 13:04:39 +0000 Subject: [PATCH 09/51] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 66 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a3432d24..f88dc74c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ## Translation Status -[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.44%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.72%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.89%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.46%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-98.73%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) +[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.60%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.88%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.08%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-96.64%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-97.90%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.02%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.16%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.16%25-yellow)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index 2773a2e3..c6152ede 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -1,40 +1,58 @@ -### de_DE.axaml: 99.44% +### de_DE.axaml: 98.60%
Missing Keys +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple - Text.CommitDetail.Files.Search - Text.Diff.UseBlockNavigation - Text.Hotkeys.Global.Clone +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy - Text.WorkingCopy.CommitToEdit
-### es_ES.axaml: 99.72% +### es_ES.axaml: 98.88%
Missing Keys +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple - Text.Diff.UseBlockNavigation - Text.Hotkeys.Global.Clone +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy
-### fr_FR.axaml: 96.89% +### fr_FR.axaml: 96.08%
Missing Keys +- Text.BranchCM.MergeMultiBranches - Text.CherryPick.AppendSourceToMessage - Text.CherryPick.Mainline.Tips - Text.CommitCM.CherryPickMultiple +- Text.CommitCM.MergeMultiple - Text.CommitDetail.Files.Search - Text.Diff.UseBlockNavigation - Text.Fetch.Force - Text.Hotkeys.Global.Clone +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor @@ -53,12 +71,14 @@
-### it_IT.axaml: 97.46% +### it_IT.axaml: 96.64%
Missing Keys +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple - Text.CommitDetail.Files.Search - Text.CommitDetail.Info.Children - Text.Configure.IssueTracker.AddSampleGitLabMergeRequest @@ -66,6 +86,10 @@ - Text.Configure.OpenAI.Preferred.Tip - Text.Diff.UseBlockNavigation - Text.Fetch.Force +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.Repository.FilterCommits.Default @@ -80,17 +104,23 @@
-### pt_BR.axaml: 98.73% +### pt_BR.axaml: 97.90%
Missing Keys +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple - Text.CommitDetail.Files.Search - Text.CommitDetail.Info.Children - Text.Diff.UseBlockNavigation - Text.Fetch.Force - Text.Hotkeys.Global.Clone +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.SHALinkCM.NavigateTo @@ -98,32 +128,48 @@
-### ru_RU.axaml: 99.86% +### ru_RU.axaml: 99.02%
Missing Keys +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple - Text.Hotkeys.Global.Clone +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy
-### zh_CN.axaml: 100.00% +### zh_CN.axaml: 99.16%
Missing Keys - +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy
-### zh_TW.axaml: 100.00% +### zh_TW.axaml: 99.16%
Missing Keys - +- Text.BranchCM.MergeMultiBranches +- Text.CommitCM.MergeMultiple +- Text.MergeMultiple +- Text.MergeMultiple.Commit +- Text.MergeMultiple.CommitChanges +- Text.MergeMultiple.Strategy
From 94daa46db9ae370679927ee3e004b964cb3af601 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 21:12:58 +0800 Subject: [PATCH 10/51] code_review: PR #793 * do NOT modify the existing merge, and add a new constructor for `Commands.Merge` instead * rewrite `ViewModels.MergeMultiple` - since `_histories.Commits.Find` may returns null, use `List` instead of `List` - supports display merge target as both `Models.Commit` and `Models.Branch` * rename translation key `Text.MergeMultiple.Commit` to `Text.MergeMultiple.Targets`, and add translations for zh_CN and zh_TW * some UI/UX changes --- src/Commands/Merge.cs | 31 ++++++++++++++--- src/Models/MergeStrategy.cs | 4 +-- src/Resources/Locales/en_US.axaml | 6 ++-- src/Resources/Locales/zh_CN.axaml | 6 ++++ src/Resources/Locales/zh_TW.axaml | 6 ++++ src/ViewModels/Merge.cs | 2 +- src/ViewModels/MergeMultiple.cs | 58 ++++++++++++++++++++++++------- src/ViewModels/Pull.cs | 2 +- src/ViewModels/Repository.cs | 3 +- src/Views/MergeMultiple.axaml | 44 +++++++++++++++-------- 10 files changed, 122 insertions(+), 40 deletions(-) diff --git a/src/Commands/Merge.cs b/src/Commands/Merge.cs index a524af05..bd1f3653 100644 --- a/src/Commands/Merge.cs +++ b/src/Commands/Merge.cs @@ -1,18 +1,41 @@ using System; +using System.Collections.Generic; +using System.Text; namespace SourceGit.Commands { public class Merge : Command { - public Merge(string repo, string source, string mode, string strategy, Action outputHandler) + public Merge(string repo, string source, string mode, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; Context = repo; TraitErrorAsOutput = true; - if (strategy != null) - strategy = string.Concat("--strategy=", strategy); - Args = $"merge --progress {strategy} {source} {mode}"; + Args = $"merge --progress {source} {mode}"; + } + + public Merge(string repo, List targets, bool autoCommit, string strategy, Action outputHandler) + { + _outputHandler = outputHandler; + WorkingDirectory = repo; + Context = repo; + TraitErrorAsOutput = true; + + var builder = new StringBuilder(); + builder.Append("merge --progress "); + if (!string.IsNullOrEmpty(strategy)) + builder.Append($"--strategy={strategy} "); + if (!autoCommit) + builder.Append("--no-commit "); + + foreach (var t in targets) + { + builder.Append(t); + builder.Append(' '); + } + + Args = builder.ToString(); } protected override void OnReadline(string line) diff --git a/src/Models/MergeStrategy.cs b/src/Models/MergeStrategy.cs index a79bcf59..ab1d446b 100644 --- a/src/Models/MergeStrategy.cs +++ b/src/Models/MergeStrategy.cs @@ -9,10 +9,10 @@ namespace SourceGit.Models public string Arg { get; internal set; } public static List ForMultiple { get; private set; } = [ - new MergeStrategy(string.Empty, "Let Git automatically select a strategy", null), + new MergeStrategy("Default", "Let Git automatically select a strategy", string.Empty), new MergeStrategy("Octopus", "Attempt merging multiple heads", "octopus"), new MergeStrategy("Ours", "Record the merge without modifying the tree", "ours"), - ]; + ]; public MergeStrategy(string n, string d, string a) { diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index c50f3c4f..2369c3a6 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -58,7 +58,7 @@ Fetch ${0}$ into ${1}$... Git Flow - Finish ${0}$ Merge ${0}$ into ${1}$... - Merge selected {0} branches + Merge selected {0} branches into current Pull ${0}$ Pull ${0}$ into ${1}$... Push ${0}$ @@ -406,10 +406,10 @@ Into: Merge Option: Source Branch: - Merge commits - Commit(s): + Merge (Multiple) Commit all changes Strategy: + Targets: Move Repository Node Select parent node for: Name: diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index d567abaa..95224ec2 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -61,6 +61,7 @@ 拉取(fetch) ${0}$ 至 ${1}$... GIT工作流 - 完成 ${0}$ 合并 ${0}$ 到 ${1}$... + 合并 {0} 个分支到当前分支 拉回(pull) ${0}$ 拉回(pull) ${0}$ 内容至 ${1}$... 推送(push)${0}$ @@ -113,6 +114,7 @@ 复制提交指纹 自定义操作 交互式变基(rebase -i) ${0}$ 到此处 + 合并(merge)... 变基(rebase) ${0}$ 到此处 重置(reset) ${0}$ 到此处 回滚此提交 @@ -407,6 +409,10 @@ 目标分支 : 合并方式 : 合并分支 : + 合并(多目标) + 提交变化 + 合并策略 : + 目标列表 : 调整仓库分组 请选择目标分组: 名称 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 2803c400..6eb31d6b 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -61,6 +61,7 @@ 提取 (fetch) ${0}$ 到 ${1}$... Git 工作流 - 完成 ${0}$ 合併 ${0}$ 到 ${1}$... + 合併 {0} 個分支到目前分支 拉取 (pull) ${0}$ 拉取 (pull) ${0}$ 內容至 ${1}$... 推送 (push) ${0}$ @@ -113,6 +114,7 @@ 複製提交編號 自訂動作 互動式重定基底 (rebase -i) ${0}$ 到此處 + 合併 (merge)... 重定基底 (rebase) ${0}$ 到此處 重設 (reset) ${0}$ 到此處 復原此提交 @@ -407,6 +409,10 @@ 目標分支: 合併方式: 合併分支: + 合併(多目標) + 提交變更 + 合併策略: + 目標列表: 調整存放庫分組 請選擇目標分組: 名稱: diff --git a/src/ViewModels/Merge.cs b/src/ViewModels/Merge.cs index 116797a8..b7630101 100644 --- a/src/ViewModels/Merge.cs +++ b/src/ViewModels/Merge.cs @@ -37,7 +37,7 @@ namespace SourceGit.ViewModels return Task.Run(() => { - var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, null, SetProgressDescription).Exec(); + var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, SetProgressDescription).Exec(); CallUIThread(() => _repo.SetWatcherEnabled(true)); return succ; }); diff --git a/src/ViewModels/MergeMultiple.cs b/src/ViewModels/MergeMultiple.cs index 03d24773..dd984a15 100644 --- a/src/ViewModels/MergeMultiple.cs +++ b/src/ViewModels/MergeMultiple.cs @@ -1,18 +1,15 @@ using System.Collections.Generic; using System.Threading.Tasks; -using SourceGit.Models; namespace SourceGit.ViewModels { public class MergeMultiple : Popup { - public List Strategies = ["octopus", "ours"]; - - public List Targets + public List Targets { get; private set; - } + } = []; public bool AutoCommit { @@ -20,18 +17,27 @@ namespace SourceGit.ViewModels set; } - public MergeStrategy Strategy + public Models.MergeStrategy Strategy { get; set; } - public MergeMultiple(Repository repo, List targets) + public MergeMultiple(Repository repo, List commits) { _repo = repo; - Targets = targets; + Targets.AddRange(commits); AutoCommit = true; - Strategy = MergeStrategy.ForMultiple.Find(s => s.Arg == null); + Strategy = Models.MergeStrategy.ForMultiple[0]; + View = new Views.MergeMultiple() { DataContext = this }; + } + + public MergeMultiple(Repository repo, List branches) + { + _repo = repo; + Targets.AddRange(branches); + AutoCommit = true; + Strategy = Models.MergeStrategy.ForMultiple[0]; View = new Views.MergeMultiple() { DataContext = this }; } @@ -44,9 +50,9 @@ namespace SourceGit.ViewModels { var succ = new Commands.Merge( _repo.FullPath, - string.Join(" ", Targets.ConvertAll(c => c.Decorators.Find(d => d.Type == DecoratorType.RemoteBranchHead || d.Type == DecoratorType.LocalBranchHead)?.Name ?? c.Decorators.Find(d => d.Type == DecoratorType.Tag)?.Name ?? c.SHA)), - AutoCommit ? string.Empty : "--no-commit", - Strategy?.Arg, + ConvertTargetToMergeSources(), + AutoCommit, + Strategy.Arg, SetProgressDescription).Exec(); CallUIThread(() => _repo.SetWatcherEnabled(true)); @@ -54,6 +60,34 @@ namespace SourceGit.ViewModels }); } + private List ConvertTargetToMergeSources() + { + var ret = new List(); + foreach (var t in Targets) + { + if (t is Models.Branch branch) + { + ret.Add(branch.FriendlyName); + } + else if (t is Models.Commit commit) + { + var d = commit.Decorators.Find(x => + { + return x.Type == Models.DecoratorType.LocalBranchHead || + x.Type == Models.DecoratorType.RemoteBranchHead || + x.Type == Models.DecoratorType.Tag; + }); + + if (d != null) + ret.Add(d.Name); + else + ret.Add(commit.SHA); + } + } + + return ret; + } + private readonly Repository _repo = null; } } diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 2d0e8da2..e7c62980 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -172,7 +172,7 @@ namespace SourceGit.ViewModels else { SetProgressDescription($"Merge {_selectedBranch.FriendlyName} into {_current.Name} ..."); - rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", null, SetProgressDescription).Exec(); + rs = new Commands.Merge(_repo.FullPath, _selectedBranch.FriendlyName, "", SetProgressDescription).Exec(); } } else diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index d593171e..fd4899a4 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -13,7 +13,6 @@ using Avalonia.Media.Imaging; using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; -using SourceGit.Models; namespace SourceGit.ViewModels { @@ -954,7 +953,7 @@ namespace SourceGit.ViewModels public void MergeMultipleBranches(List branches) { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new MergeMultiple(this, branches.ConvertAll(b => _histories?.Commits?.Find(c => c.SHA == b.Head)))); + PopupHost.ShowPopup(new MergeMultiple(this, branches)); } public void CreateNewTag() diff --git a/src/Views/MergeMultiple.axaml b/src/Views/MergeMultiple.axaml index 01a6b976..9fcdaa3d 100644 --- a/src/Views/MergeMultiple.axaml +++ b/src/Views/MergeMultiple.axaml @@ -12,13 +12,14 @@ + + Text="{DynamicResource Text.MergeMultiple.Targets}"/> - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - + + From 2b6210e61cb8227173e1a326daa97161645ce49f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Dec 2024 13:13:16 +0000 Subject: [PATCH 11/51] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index f88dc74c..7abddca6 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.60%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.88%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.08%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-96.64%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-97.90%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.02%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.16%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.16%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.60%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.88%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-96.08%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-96.64%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-97.90%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.02%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 c6152ede..0f89e3a0 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -10,9 +10,9 @@ - Text.Diff.UseBlockNavigation - Text.Hotkeys.Global.Clone - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets - Text.WorkingCopy.CommitToEdit @@ -28,9 +28,9 @@ - Text.Diff.UseBlockNavigation - Text.Hotkeys.Global.Clone - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets @@ -50,9 +50,9 @@ - Text.Fetch.Force - Text.Hotkeys.Global.Clone - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets - Text.Preference.Appearance.FontSize - Text.Preference.Appearance.FontSize.Default - Text.Preference.Appearance.FontSize.Editor @@ -87,9 +87,9 @@ - Text.Diff.UseBlockNavigation - Text.Fetch.Force - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.Repository.FilterCommits.Default @@ -118,9 +118,9 @@ - Text.Fetch.Force - Text.Hotkeys.Global.Clone - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets - Text.Preference.General.ShowChildren - Text.Repository.FilterCommits - Text.SHALinkCM.NavigateTo @@ -138,38 +138,28 @@ - Text.CommitCM.MergeMultiple - Text.Hotkeys.Global.Clone - Text.MergeMultiple -- Text.MergeMultiple.Commit - Text.MergeMultiple.CommitChanges - Text.MergeMultiple.Strategy +- Text.MergeMultiple.Targets -### zh_CN.axaml: 99.16% +### zh_CN.axaml: 100.00%
Missing Keys -- Text.BranchCM.MergeMultiBranches -- Text.CommitCM.MergeMultiple -- Text.MergeMultiple -- Text.MergeMultiple.Commit -- Text.MergeMultiple.CommitChanges -- Text.MergeMultiple.Strategy +
-### zh_TW.axaml: 99.16% +### zh_TW.axaml: 100.00%
Missing Keys -- Text.BranchCM.MergeMultiBranches -- Text.CommitCM.MergeMultiple -- Text.MergeMultiple -- Text.MergeMultiple.Commit -- Text.MergeMultiple.CommitChanges -- Text.MergeMultiple.Strategy +
From 64bedd2ae901d40f3035e4d2271033f2a97baa5e Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Dec 2024 21:21:16 +0800 Subject: [PATCH 12/51] ux: layout for `Views.MergeMultiple` --- src/Views/MergeMultiple.axaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/MergeMultiple.axaml b/src/Views/MergeMultiple.axaml index 9fcdaa3d..f9935bcc 100644 --- a/src/Views/MergeMultiple.axaml +++ b/src/Views/MergeMultiple.axaml @@ -15,8 +15,8 @@ Date: Tue, 10 Dec 2024 06:26:15 +0500 Subject: [PATCH 13/51] readme: added appimagehub link (#798) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7abddca6..d352e9a6 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ For **macOS** users: For **Linux** users: * `DEB` or `RPM` packages are available at [buildkite](https://buildkite.com/organizations/sourcegit/packages). +* `Appimage` files can be found on [AppimageHub](https://appimage.github.io/SourceGit/) * `xdg-open` must be installed to support open native file manager. * Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your linux. * Maybe you need to set environment variable `AVALONIA_SCREEN_SCALE_FACTORS`. See https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI. From 967429cea6a3e70fd50c34f0158470a1e5a0e88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernat=20Borr=C3=A0s=20Civil?= <70479573+BernatBC@users.noreply.github.com> Date: Tue, 10 Dec 2024 02:27:26 +0100 Subject: [PATCH 14/51] doc: add repository instructions to readme (#797) --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index d352e9a6..c78f20a4 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,32 @@ For **macOS** users: For **Linux** users: +* For Debian/Ubuntu based distributions, you can add the `sourcegit` repository by following: + You may need to install curl and/or gpg first, if you're on a very minimal host: + ```shell + apt update && apt install curl gpg -y + ``` + Install the registry signing key: + ```shell + curl -fsSL "https://packages.buildkite.com/sourcegit/sourcegit-deb/gpgkey" | gpg --dearmor -o /etc/apt/keyrings/sourcegit_sourcegit-deb-archive-keyring.gpg + ``` + Configure the source: + ```shell + echo -e "deb [signed-by=/etc/apt/keyrings/sourcegit_sourcegit-deb-archive-keyring.gpg] https://packages.buildkite.com/sourcegit/sourcegit-deb/any/ any main\ndeb-src [signed-by=/etc/apt/keyrings/sourcegit_sourcegit-deb-archive-keyring.gpg] https://packages.buildkite.com/sourcegit/sourcegit-deb/any/ any main" > /etc/apt/sources.list.d/buildkite-sourcegit-sourcegit-deb.list + ``` + Update your local repository and install the package: + ```shell + apt update && apt install sourcegit + ``` +* For RHEL/Fedora based distributions, you can add the `sourcegit` repository by following: + Configure the source: + ```shell + sudo sh -c 'echo -e "[sourcegit-rpm]\nname=sourcegit-rpm\nbaseurl=https://packages.buildkite.com/sourcegit/sourcegit-rpm/rpm_any/rpm_any/\$basearch\nenabled=1\nrepo_gpgcheck=1\ngpgcheck=0\ngpgkey=https://packages.buildkite.com/sourcegit/sourcegit-rpm/gpgkey\npriority=1"' > /etc/yum.repos.d/sourcegit-rpm.repo + ``` + Install the package with this command: + ```shell + sudo dnf install -y sourcegit + ``` * `DEB` or `RPM` packages are available at [buildkite](https://buildkite.com/organizations/sourcegit/packages). * `Appimage` files can be found on [AppimageHub](https://appimage.github.io/SourceGit/) * `xdg-open` must be installed to support open native file manager. From 1644b4c8ce1fb52b805a948a71e32c2982b1091a Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 10 Dec 2024 09:28:35 +0800 Subject: [PATCH 15/51] readme: remove unnecessary tips --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c78f20a4..350f60ef 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,6 @@ For **Linux** users: ```shell sudo dnf install -y sourcegit ``` -* `DEB` or `RPM` packages are available at [buildkite](https://buildkite.com/organizations/sourcegit/packages). * `Appimage` files can be found on [AppimageHub](https://appimage.github.io/SourceGit/) * `xdg-open` must be installed to support open native file manager. * Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your linux. From aee3abfffbda5e1c13f6a6232f1d44ad141c0e4c Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 10 Dec 2024 11:17:30 +0800 Subject: [PATCH 16/51] enhance: redesign in-progress banner (#790) * show head for cherry-pick * show stopped at for rebase * supports `--skip` for cherry-pick and rebase --- src/Resources/Locales/de_DE.axaml | 9 ++-- src/Resources/Locales/en_US.axaml | 12 +++--- src/Resources/Locales/es_ES.axaml | 9 ++-- src/Resources/Locales/fr_FR.axaml | 9 ++-- src/Resources/Locales/it_IT.axaml | 9 ++-- src/Resources/Locales/pt_BR.axaml | 9 ++-- src/Resources/Locales/ru_RU.axaml | 9 ++-- src/Resources/Locales/zh_CN.axaml | 12 +++--- src/Resources/Locales/zh_TW.axaml | 12 +++--- src/ViewModels/InProgressContexts.cs | 49 +++++++++++++++++++--- src/ViewModels/WorkingCopy.cs | 4 +- src/Views/Repository.axaml | 61 ++++++++++++++++++++-------- 12 files changed, 135 insertions(+), 69 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index bb31fa8f..4461ede5 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -389,10 +389,10 @@ Verwerfen Initialisiere Repository Pfad: - Cherry-Pick wird durchgeführt. Drücke 'Abbrechen' um den originalen HEAD wiederherzustellen. - Merge request wird durchgeführt. Drücke 'Abbrechen' um den originalen HEAD wiederherzustellen. - Rebase wird durchgeführt. Drücke 'Abbrechen' um den originalen HEAD wiederherzustellen. - Revert wird durchgeführt. Drücke 'Abbrechen' um den originalen HEAD wiederherzustellen. + Cherry-Pick wird durchgeführt. + Merge request wird durchgeführt. + Rebase wird durchgeführt. + Revert wird durchgeführt. Interaktiver Rebase Ziel Branch: Auf: @@ -562,7 +562,6 @@ Aktualisiern REMOTES REMOTE HINZUFÜGEN - KONFLIKTE BEHEBEN Commit suchen Dateiname Commit-Nachricht diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2369c3a6..9a721100 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -391,10 +391,12 @@ Discard Initialize Repository Path: - Cherry-Pick in progress. Press 'Abort' to restore original HEAD. - Merge request in progress. Press 'Abort' to restore original HEAD. - Rebase in progress. Press 'Abort' to restore original HEAD. - Revert in progress. Press 'Abort' to restore original HEAD. + Cherry-Pick in progress. + Current commit + Merge request in progress. + Rebase in progress. + Stopped at + Revert in progress. Interactive Rebase Target Branch: On: @@ -568,7 +570,6 @@ Refresh REMOTES ADD REMOTE - RESOLVE Search Commit File Message @@ -576,6 +577,7 @@ Author & Committer Current Branch Show Tags as Tree + SKIP Statistics SUBMODULES ADD SUBMODULE diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 7c7f8d7c..abdc9367 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -392,10 +392,10 @@ Descartar Inicializar Repositorio Ruta: - Cherry-Pick en progreso. Presiona 'Abort' para restaurar el HEAD original. - Merge en progreso. Presiona 'Abort' para restaurar el HEAD original. - Rebase en progreso. Presiona 'Abort' para restaurar el HEAD original. - Revert en progreso. Presiona 'Abort' para restaurar el HEAD original. + Cherry-Pick en progreso. + Merge en progreso. + Rebase en progreso. + Revert en progreso. Rebase Interactivo Rama Objetivo: En: @@ -564,7 +564,6 @@ Refrescar REMOTOS AÑADIR REMOTO - RESOLVER Buscar Commit Archivo Mensaje diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index a9a18be3..c6c2b39d 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -386,10 +386,10 @@ Rejeter Initialiser le repository Chemin : - Cherry-Pick en cours. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. - Merge request in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. - Rebase in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. - Revert in progress. Appuyer sur 'Abort' pour restaurer le HEAD d'origine. + Cherry-Pick en cours. + Merge request in progress. + Rebase in progress. + Revert in progress. Rebase interactif Branche cible : Sur : @@ -549,7 +549,6 @@ Rafraîchir DEPOTS DISTANTS AJOUTER DEPOT DISTANT - RESOUDRE Rechercher un commit Fichier Message diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index fbf918b8..9a504677 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -389,10 +389,10 @@ Scarta Inizializza Repository Percorso: - Cherry-Pick in corso. Premi 'Annulla' per ripristinare l'HEAD originale. - Richiesta di merge in corso. Premi 'Annulla' per ripristinare l'HEAD originale. - Rebase in corso. Premi 'Annulla' per ripristinare l'HEAD originale. - Revert in corso. Premi 'Annulla' per ripristinare l'HEAD originale. + Cherry-Pick in corso. + Richiesta di merge in corso. + Rebase in corso. + Revert in corso. Rebase Interattivo Branch di destinazione: Su: @@ -555,7 +555,6 @@ Aggiorna REMOTI AGGIUNGI REMOTO - RISOLVI Cerca Commit File Messaggio diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 4d011b32..1b7ac39d 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -412,10 +412,10 @@ Descartar Inicializar Repositório Caminho: - Cherry-Pick em andamento. Pressione 'Abort' para restaurar o HEAD original. - Merge em andamento. Pressione 'Abort' para restaurar o HEAD original. - Rebase em andamento. Pressione 'Abort' para restaurar o HEAD original. - Revert em andamento. Pressione 'Abort' para restaurar o HEAD original. + Cherry-Pick em andamento. + Merge em andamento. + Rebase em andamento. + Revert em andamento. Rebase Interativo Ramo Alvo: Em: @@ -583,7 +583,6 @@ Atualizar REMOTOS ADICIONAR REMOTO - RESOLVER Pesquisar Commit Arquivo Mensagem diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 5b2cf129..fe8cb02f 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -392,10 +392,10 @@ Отклонить Инициализировать хранилище Путь: - Выполняется частичный забор. Нажмите «Отказ» для восстановления заголовка. - Выполняет запрос слияния. Нажмите «Отказ» для восстановления заголовка. - Выполняется перенос. Нажмите «Отказ» для восстановления заголовка. - Выполняется возврат. Нажмите «Отказ» для восстановления заголовка. + Выполняется частичный забор. + Выполняет запрос слияния. + Выполняется перенос. + Выполняется возврат. Интерактивное перемещение Целевая ветка: На: @@ -566,7 +566,6 @@ Обновить ВНЕШНИЕ ХРАНИЛИЩА ДОБАВИТЬ ВНЕШНЕЕ ХРАНИЛИЩЕ - РАЗРЕШИТЬ Поиск фиксации Файл Сообщение diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 95224ec2..4527b4c4 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -394,10 +394,12 @@ 丢弃 初始化新仓库 路径 : - 挑选(Cherry-Pick)操作进行中。点击【终止】回滚到操作前的状态。 - 合并操作进行中。点击【终止】回滚到操作前的状态。 - 变基(Rebase)操作进行中。点击【终止】回滚到操作前的状态。 - 回滚提交操作进行中。点击【终止】回滚到操作前的状态。 + 挑选(Cherry-Pick)操作进行中。 + 当前提交 + 合并操作进行中。 + 变基(Rebase)操作进行中。 + 当前停止于 + 回滚提交操作进行中。 交互式变基 目标分支 : 起始提交 : @@ -572,7 +574,6 @@ 重新加载 远程列表 添加远程 - 解决冲突 查找提交 文件 提交信息 @@ -580,6 +581,7 @@ 作者及提交者 仅在当前分支中查找 以树型结构展示 + 跳过此提交 提交统计 子模块列表 添加子模块 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 6eb31d6b..bb2a3733 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -394,10 +394,12 @@ 捨棄 初始化存放庫 路徑: - 揀選 (cherry-pick) 操作進行中。點選 [中止] 復原到操作前的狀態。 - 合併操作進行中。點選 [中止] 復原到操作前的狀態。 - 重定基底 (rebase) 操作進行中。點選 [中止] 復原到操作前的狀態。 - 復原提交操作進行中。點選 [中止] 復原到操作前的狀態。 + 揀選 (cherry-pick) 操作進行中。 + 当前提交 + 合併操作進行中。 + 重定基底 (rebase) 操作進行中。 + 当前停止于 + 復原提交操作進行中。 互動式重定基底 目標分支: 起始提交: @@ -571,7 +573,6 @@ 重新載入 遠端列表 新增遠端 - 解決衝突 搜尋提交 檔案 提交訊息 @@ -579,6 +580,7 @@ 作者及提交者 僅搜尋目前分支 以樹型結構展示 + 跳過此提交 提交統計 子模組列表 新增子模組 diff --git a/src/ViewModels/InProgressContexts.cs b/src/ViewModels/InProgressContexts.cs index f7b85032..06417e9e 100644 --- a/src/ViewModels/InProgressContexts.cs +++ b/src/ViewModels/InProgressContexts.cs @@ -16,10 +16,17 @@ namespace SourceGit.ViewModels set; } - public InProgressContext(string repo, string cmd) + public bool CanSkip + { + get; + protected set; + } + + public InProgressContext(string repo, string cmd, bool canSkip) { Repository = repo; Cmd = cmd; + CanSkip = canSkip; } public bool Abort() @@ -32,6 +39,19 @@ namespace SourceGit.ViewModels }.Exec(); } + public bool Skip() + { + if (!CanSkip) + return true; + + return new Commands.Command() + { + WorkingDirectory = Repository, + Context = Repository, + Args = $"{Cmd} --skip", + }.Exec(); + } + public virtual bool Continue() { return new Commands.Command() @@ -46,14 +66,33 @@ namespace SourceGit.ViewModels public class CherryPickInProgress : InProgressContext { - public CherryPickInProgress(string repo) : base(repo, "cherry-pick") { } + public Models.Commit Head + { + get; + private set; + } + + public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick", true) + { + var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim(); + Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result(); + } } public class RebaseInProgress : InProgressContext { - public RebaseInProgress(Repository repo) : base(repo.FullPath, "rebase") + public Models.Commit StoppedAt + { + get; + private set; + } + + public RebaseInProgress(Repository repo) : base(repo.FullPath, "rebase", true) { _gitDir = repo.GitDir; + + var stoppedSHA = File.ReadAllText(Path.Combine(repo.GitDir, "rebase-merge", "stopped-sha")).Trim(); + StoppedAt = new Commands.QuerySingleCommit(repo.FullPath, stoppedSHA).Result(); } public override bool Continue() @@ -90,11 +129,11 @@ namespace SourceGit.ViewModels public class RevertInProgress : InProgressContext { - public RevertInProgress(string repo) : base(repo, "revert") { } + public RevertInProgress(string repo) : base(repo, "revert", false) { } } public class MergeInProgress : InProgressContext { - public MergeInProgress(string repo) : base(repo, "merge") { } + public MergeInProgress(string repo) : base(repo, "merge", false) { } } } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 4a6e5a01..f708306c 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -237,7 +237,7 @@ namespace SourceGit.ViewModels var inProgress = null as InProgressContext; if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD"))) - inProgress = new CherryPickInProgress(_repo.FullPath); + inProgress = new CherryPickInProgress(_repo); else if (File.Exists(Path.Combine(_repo.GitDir, "REBASE_HEAD")) && Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge"))) inProgress = new RebaseInProgress(_repo); else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD"))) @@ -310,7 +310,7 @@ namespace SourceGit.ViewModels var inProgress = null as InProgressContext; if (File.Exists(Path.Combine(_repo.GitDir, "CHERRY_PICK_HEAD"))) - inProgress = new CherryPickInProgress(_repo.FullPath); + inProgress = new CherryPickInProgress(_repo); else if (File.Exists(Path.Combine(_repo.GitDir, "REBASE_HEAD")) && Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge"))) inProgress = new RebaseInProgress(_repo); else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD"))) diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index a0e83046..186bbb7d 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -550,12 +550,32 @@ + + + + + + + + + + + + - + + + + + - + + + + + @@ -568,23 +588,30 @@ - - From e17b53da42f557bd21d50e51c05b89482d591bdb Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 12 Dec 2024 09:44:55 +0800 Subject: [PATCH 37/51] enhance: block-navigation in text diff view * It is not necessary to re-calculate all the contents when `UseBlockNavigation` changed * Redraw the text view after `block-navigation` has turned off --- src/Views/TextDiffView.axaml.cs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index a4c2bd0a..cca3751d 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -719,19 +719,22 @@ namespace SourceGit.Views else if (change.Property == BlockNavigationProperty) { var oldValue = change.OldValue as ViewModels.BlockNavigation; - var newValue = change.NewValue as ViewModels.BlockNavigation; if (oldValue != null) + { oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged; + if (oldValue.Current != -1) + TextArea?.TextView?.Redraw(); + } + + var newValue = change.NewValue as ViewModels.BlockNavigation; if (newValue != null) newValue.PropertyChanged += OnBlockNavigationPropertyChanged; - - InvalidateVisual(); } } private void OnBlockNavigationPropertyChanged(object _1, PropertyChangedEventArgs _2) { - TextArea.TextView.Redraw(); + TextArea?.TextView?.Redraw(); } private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e) @@ -1576,7 +1579,7 @@ namespace SourceGit.Views UseBlockNavigationProperty.Changed.AddClassHandler((v, _) => { - v.RefreshContent(v.DataContext as Models.TextDiff, false); + v.RefreshBlockNavigation(); }); SelectedChunkProperty.Changed.AddClassHandler((v, _) => @@ -1664,6 +1667,14 @@ namespace SourceGit.Views Editor.Content = diff; } + RefreshBlockNavigation(); + + IsUnstagedChange = diff.Option.IsUnstaged; + EnableChunkSelection = diff.Option.WorkingCopyChange != null; + } + + private void RefreshBlockNavigation() + { if (UseBlockNavigation) { BlockNavigation = new ViewModels.BlockNavigation(Editor.Content); @@ -1674,9 +1685,6 @@ namespace SourceGit.Views BlockNavigation = null; BlockNavigationIndicator = "-/-"; } - - IsUnstagedChange = diff.Option.IsUnstaged; - EnableChunkSelection = diff.Option.WorkingCopyChange != null; } private void OnStageChunk(object _1, RoutedEventArgs _2) From 2053ce033d1e24e9e6b74cecfcc0761fad899f6f Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 12 Dec 2024 10:03:34 +0800 Subject: [PATCH 38/51] feature: supports merge selected commit to current branch (#800) --- 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 | 15 +++++++++++++++ src/ViewModels/Merge.cs | 11 +++++++++++ src/Views/LauncherPage.axaml | 4 ++-- src/Views/Merge.axaml | 11 ++++++++++- 7 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 5bb61b9c..2eb38873 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -111,6 +111,7 @@ Copy SHA Custom Action Interactive Rebase ${0}$ to Here + Merge to ${0}$ Merge ... Rebase ${0}$ to Here Reset ${0}$ to Here diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 7a0bc47e..f711cdee 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -114,6 +114,7 @@ 复制提交指纹 自定义操作 交互式变基(rebase -i) ${0}$ 到此处 + 合并(merge)此提交至 ${0}$ 合并(merge)... 变基(rebase) ${0}$ 到此处 重置(reset) ${0}$ 到此处 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 3ffbebc0..90444967 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -114,6 +114,7 @@ 複製提交編號 自訂動作 互動式重定基底 (rebase -i) ${0}$ 到此處 + 合併 (merge) 此提交到 ${0}$ 合併 (merge)... 重定基底 (rebase) ${0}$ 到此處 重設 (reset) ${0}$ 到此處 diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 8c4de43e..8f1e2662 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -513,6 +513,21 @@ namespace SourceGit.ViewModels e.Handled = true; }; menu.Items.Add(cherryPick); + + if (!commit.HasDecorators) + { + var merge = new MenuItem(); + merge.Header = new Views.NameHighlightedTextBlock("CommitCM.Merge", current.Name); + merge.Icon = App.CreateMenuIcon("Icons.Merge"); + merge.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new Merge(_repo, commit, current.Name)); + + e.Handled = true; + }; + menu.Items.Add(merge); + } } else { diff --git a/src/ViewModels/Merge.cs b/src/ViewModels/Merge.cs index 670a1ba5..d07ee9b7 100644 --- a/src/ViewModels/Merge.cs +++ b/src/ViewModels/Merge.cs @@ -32,6 +32,17 @@ namespace SourceGit.ViewModels View = new Views.Merge() { DataContext = this }; } + public Merge(Repository repo, Models.Commit source, string into) + { + _repo = repo; + _sourceName = source.SHA; + + Source = source; + Into = into; + SelectedMode = AutoSelectMergeMode(); + View = new Views.Merge() { DataContext = this }; + } + public Merge(Repository repo, Models.Tag source, string into) { _repo = repo; diff --git a/src/Views/LauncherPage.axaml b/src/Views/LauncherPage.axaml index be2b339f..34e93841 100644 --- a/src/Views/LauncherPage.axaml +++ b/src/Views/LauncherPage.axaml @@ -77,7 +77,7 @@ HorizontalAlignment="Right" IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"> + - - - + + + + + diff --git a/src/Views/LauncherPage.axaml.cs b/src/Views/LauncherPage.axaml.cs index d37d22bd..3fa8269e 100644 --- a/src/Views/LauncherPage.axaml.cs +++ b/src/Views/LauncherPage.axaml.cs @@ -32,6 +32,14 @@ namespace SourceGit.Views OnPopupCancel(sender, e); } + private void OnCopyNotification(object sender, RoutedEventArgs e) + { + if (sender is Button { DataContext: Models.Notification notice }) + App.CopyText(notice.Message); + + e.Handled = true; + } + private void OnDismissNotification(object sender, RoutedEventArgs e) { if (sender is Button { DataContext: Models.Notification notice } && From 26923435e7ef995e5327b67ccfa4354942f8f37b Mon Sep 17 00:00:00 2001 From: Ezra Date: Fri, 13 Dec 2024 15:08:47 +1300 Subject: [PATCH 45/51] enhance: improve readability of default clone dir errors. (#813) --- src/ViewModels/Welcome.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/Welcome.cs b/src/ViewModels/Welcome.cs index 04ffef87..3645744f 100644 --- a/src/ViewModels/Welcome.cs +++ b/src/ViewModels/Welcome.cs @@ -119,9 +119,9 @@ namespace SourceGit.ViewModels { var defaultCloneDir = Preference.Instance.GitDefaultCloneDir; if (string.IsNullOrEmpty(defaultCloneDir)) - App.RaiseException(PopupHost.Active.GetId(), "The default clone dir haven't been configured!"); + App.RaiseException(PopupHost.Active.GetId(), "The default clone dir hasn't been configured!"); else if (!Directory.Exists(defaultCloneDir)) - App.RaiseException(PopupHost.Active.GetId(), $"The default clone dir '{defaultCloneDir}' is not exists!"); + App.RaiseException(PopupHost.Active.GetId(), $"The default clone dir '{defaultCloneDir}' does not exist!"); else if (PopupHost.CanCreatePopup()) PopupHost.ShowAndStartPopup(new ScanRepositories(defaultCloneDir)); } From a99bd2e9738d42d7ff145855181fb400685a3a89 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Dec 2024 10:41:30 +0800 Subject: [PATCH 46/51] enhance: only dispatch error message if it contains valid data --- src/Commands/Command.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 20659082..96a5b9c9 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -104,12 +104,8 @@ namespace SourceGit.Commands catch (Exception e) { if (RaiseError) - { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(Context, e.Message); - }); - } + Dispatcher.UIThread.Post(() => App.RaiseException(Context, e.Message)); + return false; } @@ -120,15 +116,15 @@ namespace SourceGit.Commands int exitCode = proc.ExitCode; proc.Close(); - if (!isCancelled && exitCode != 0 && errs.Count > 0) + if (!isCancelled && exitCode != 0) { if (RaiseError) { - Dispatcher.UIThread.Invoke(() => - { - App.RaiseException(Context, string.Join("\n", errs)); - }); + var errMsg = string.Join("\n", errs); + if (!string.IsNullOrWhiteSpace(errMsg)) + Dispatcher.UIThread.Post(() => App.RaiseException(Context, errMsg)); } + return false; } From 751991c8168d833c58ee840dbe69e58ad3620dd8 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Dec 2024 11:00:03 +0800 Subject: [PATCH 47/51] refactor: rewrite the way reading full message of commit --- src/Commands/QueryCommitsWithFullMessage.cs | 17 ++++++++++------- src/Views/CommitMessageTextBox.axaml.cs | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Commands/QueryCommitsWithFullMessage.cs b/src/Commands/QueryCommitsWithFullMessage.cs index efa16df9..c15cdbe1 100644 --- a/src/Commands/QueryCommitsWithFullMessage.cs +++ b/src/Commands/QueryCommitsWithFullMessage.cs @@ -52,28 +52,31 @@ namespace SourceGit.Commands _current.Commit.CommitterTime = ulong.Parse(line); break; default: - if (line.Equals(_boundary, StringComparison.Ordinal)) + var boundary = rs.StdOut.IndexOf(_boundary, end + 1); + if (boundary > end) { - nextPartIdx = -1; - _current.Message = _current.Message.Trim(); + _current.Message = rs.StdOut.Substring(start, boundary - start - 1); + end = boundary + _boundary.Length; } else { - _current.Message = _current.Message + "\n" + line; + _current.Message = rs.StdOut.Substring(start); + end = rs.StdOut.Length - 2; } + nextPartIdx = -1; break; } nextPartIdx++; start = end + 1; + if (start >= rs.StdOut.Length - 1) + break; + end = rs.StdOut.IndexOf('\n', start); } - if (_current != null) - _current.Message = _current.Message.Trim(); - return _commits; } diff --git a/src/Views/CommitMessageTextBox.axaml.cs b/src/Views/CommitMessageTextBox.axaml.cs index 91f8c47e..0811d97d 100644 --- a/src/Views/CommitMessageTextBox.axaml.cs +++ b/src/Views/CommitMessageTextBox.axaml.cs @@ -95,7 +95,7 @@ namespace SourceGit.Views if (change.Property == TextProperty && _changingWay == TextChangeWay.None) { _changingWay = TextChangeWay.FromSource; - var normalized = Text.ReplaceLineEndings("\n").Trim(); + var normalized = Text.ReplaceLineEndings("\n"); var subjectEnd = normalized.IndexOf("\n\n", StringComparison.Ordinal); if (subjectEnd == -1) { From 24b61532266db654185e4622d5ec4075fcb9f2b2 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Dec 2024 16:00:41 +0800 Subject: [PATCH 48/51] ux: context menu of selected commits * update English translation * re-order the menu items --- src/Resources/Locales/en_US.axaml | 8 ++-- src/ViewModels/Histories.cs | 75 ++++++++++++++++--------------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 2eb38873..65b4dd96 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -102,7 +102,7 @@ Repository URL: CLOSE Editor - Cherry-Pick This Commit + Cherry-Pick Commit Cherry-Pick ... Checkout Commit Compare with HEAD @@ -110,16 +110,16 @@ Copy Info Copy SHA Custom Action - Interactive Rebase ${0}$ to Here + Interactively Rebase ${0}$ on Here Merge to ${0}$ Merge ... - Rebase ${0}$ to Here + Rebase ${0}$ on Here Reset ${0}$ to Here Revert Commit Reword Save as Patch... Squash into Parent - Squash Child Commits to Here + Squash Children into Here CHANGES Search Changes... FILES diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 8f1e2662..10cb0499 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -482,6 +482,21 @@ namespace SourceGit.ViewModels }; menu.Items.Add(rebase); + if (!commit.HasDecorators) + { + var merge = new MenuItem(); + merge.Header = new Views.NameHighlightedTextBlock("CommitCM.Merge", current.Name); + merge.Icon = App.CreateMenuIcon("Icons.Merge"); + merge.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new Merge(_repo, commit, current.Name)); + + e.Handled = true; + }; + menu.Items.Add(merge); + } + var cherryPick = new MenuItem(); cherryPick.Header = App.Text("CommitCM.CherryPick"); cherryPick.Icon = App.CreateMenuIcon("Icons.CherryPick"); @@ -513,21 +528,6 @@ namespace SourceGit.ViewModels e.Handled = true; }; menu.Items.Add(cherryPick); - - if (!commit.HasDecorators) - { - var merge = new MenuItem(); - merge.Header = new Views.NameHighlightedTextBlock("CommitCM.Merge", current.Name); - merge.Icon = App.CreateMenuIcon("Icons.Merge"); - merge.Click += (_, e) => - { - if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(_repo, commit, current.Name)); - - e.Handled = true; - }; - menu.Items.Add(merge); - } } else { @@ -541,27 +541,6 @@ namespace SourceGit.ViewModels e.Handled = true; }; menu.Items.Add(revert); - - var interactiveRebase = new MenuItem(); - interactiveRebase.Header = new Views.NameHighlightedTextBlock("CommitCM.InteractiveRebase", current.Name); - interactiveRebase.Icon = App.CreateMenuIcon("Icons.InteractiveRebase"); - interactiveRebase.IsVisible = current.Head != commit.SHA; - interactiveRebase.Click += (_, e) => - { - if (_repo.LocalChangesCount > 0) - { - App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first."); - return; - } - - App.OpenDialog(new Views.InteractiveRebase() - { - DataContext = new InteractiveRebase(_repo, current, commit) - }); - - e.Handled = true; - }; - menu.Items.Add(interactiveRebase); } if (current.Head != commit.SHA) @@ -580,6 +559,30 @@ namespace SourceGit.ViewModels menu.Items.Add(new MenuItem() { Header = "-" }); + if (commit.IsMerged && current.Head != commit.SHA) + { + var interactiveRebase = new MenuItem(); + interactiveRebase.Header = new Views.NameHighlightedTextBlock("CommitCM.InteractiveRebase", current.Name); + interactiveRebase.Icon = App.CreateMenuIcon("Icons.InteractiveRebase"); + interactiveRebase.Click += (_, e) => + { + if (_repo.LocalChangesCount > 0) + { + App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first."); + return; + } + + App.OpenDialog(new Views.InteractiveRebase() + { + DataContext = new InteractiveRebase(_repo, current, commit) + }); + + e.Handled = true; + }; + menu.Items.Add(interactiveRebase); + menu.Items.Add(new MenuItem() { Header = "-" }); + } + if (current.Head != commit.SHA) { var compareWithHead = new MenuItem(); From 0a0e2bc04405b7feb608790aee6bc5a10d22546e Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Dec 2024 16:24:39 +0800 Subject: [PATCH 49/51] enhance: only create `squash` menu item if it is needed --- src/ViewModels/Histories.cs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 10cb0499..59f420eb 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -407,24 +407,26 @@ namespace SourceGit.ViewModels }; menu.Items.Add(reset); - var squash = new MenuItem(); - squash.Header = App.Text("CommitCM.SquashCommitsSinceThis"); - squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent"); - squash.IsVisible = commit.IsMerged; - squash.Click += (_, e) => + if (commit.IsMerged) { - if (_repo.LocalChangesCount > 0) + var squash = new MenuItem(); + squash.Header = App.Text("CommitCM.SquashCommitsSinceThis"); + squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent"); + squash.Click += (_, e) => { - App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first."); - return; - } + if (_repo.LocalChangesCount > 0) + { + App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first."); + return; + } - if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Squash(_repo, commit, commit.SHA)); + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new Squash(_repo, commit, commit.SHA)); - e.Handled = true; - }; - menu.Items.Add(squash); + e.Handled = true; + }; + menu.Items.Add(squash); + } } else { From f986e59a9403d1da6e8b768fe382ed7800520d42 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 14 Dec 2024 20:25:25 +0800 Subject: [PATCH 50/51] fix: tag filter hidden behind the scroll bar (#815) Signed-off-by: leo --- src/Views/TagsView.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/TagsView.axaml b/src/Views/TagsView.axaml index 5dedb661..6e607edb 100644 --- a/src/Views/TagsView.axaml +++ b/src/Views/TagsView.axaml @@ -26,7 +26,7 @@ SelectionChanged="OnRowSelectionChanged"> - Date: Mon, 16 Dec 2024 09:29:06 +0800 Subject: [PATCH 51/51] version: Release 8.43 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d72e21bd..50a1eb5b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.42 \ No newline at end of file +8.43 \ No newline at end of file