From 2504a523987f0279afacef0b80b2ea00547d2145 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 10 Dec 2024 15:35:46 +0800 Subject: [PATCH] fix: wrong display when merge tag * remove `Text.Merge.Source` translations from `de_DE`/`es_ES`/`fr_FR`/`it_IT`/`pt_BR`/`ru_RU` because its content has been changed --- src/Resources/Locales/de_DE.axaml | 1 - src/Resources/Locales/en_US.axaml | 2 +- src/Resources/Locales/es_ES.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/it_IT.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 2 +- src/Resources/Locales/zh_TW.axaml | 2 +- src/ViewModels/Histories.cs | 13 +++++++++---- src/ViewModels/Merge.cs | 22 ++++++++++++++++++---- src/ViewModels/Repository.cs | 11 ++++++++--- src/Views/Merge.axaml | 21 +++++++++++++++++---- 13 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 4461ede5..2045a229 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -403,7 +403,6 @@ Branch mergen Ziel-Branch: Merge Option: - Quell-Branch: Bewege Repository Knoten Wähle Vorgänger-Knoten für: Name: diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index de8df8cb..0c3eff84 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -408,7 +408,7 @@ Merge Branch Into: Merge Option: - Source Branch: + Source: Merge (Multiple) Commit all changes Strategy: diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index abdc9367..cf0f05b5 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -404,7 +404,6 @@ Merge Rama En: Opción de Merge: - Rama Fuente: Mover Nodo del Repositorio Seleccionar nodo padre para: Nombre: diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index c6c2b39d..20237bb9 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -400,7 +400,6 @@ Merger la branche Dans : Option de merge: - Branche source : Déplacer le noeud du repository Sélectionnier le noeud parent pour : Nom : diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 9a504677..18754c8e 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -403,7 +403,6 @@ Unisci Branch In: Opzione di Merge: - Branch Sorgente: Sposta Nodo Repository Seleziona nodo padre per: Nome: diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 1b7ac39d..d72dd370 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -426,7 +426,6 @@ Mesclar Ramo Para: Opção de Mesclagem: - Ramo de Origem: Mover nó do repositório Selecionar nó pai para: Nome: diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index fe8cb02f..76142274 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -406,7 +406,6 @@ Слить ветку В: Опции слияния: - Исходная ветка: Переместить узел хранилища Выбрать родительский узел для: Имя: diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 1ee30437..4560cc49 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -411,7 +411,7 @@ 合并分支 目标分支 : 合并方式 : - 合并分支 : + 合并目标 : 合并(多目标) 提交变化 合并策略 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index b604755b..fcc3f070 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -411,7 +411,7 @@ 合併分支 目標分支: 合併方式: - 合併分支: + 合併目標: 合併(多目標) 提交變更 合併策略: diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index b38b4afc..8c4de43e 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -847,8 +847,13 @@ namespace SourceGit.ViewModels fastForward.IsEnabled = current.TrackStatus.Ahead.Count == 0; fastForward.Click += (_, e) => { + var b = _repo.Branches.Find(x => x.FriendlyName == upstream); + if (b == null) + return; + if (PopupHost.CanCreatePopup()) - PopupHost.ShowAndStartPopup(new Merge(_repo, upstream, current.Name)); + PopupHost.ShowAndStartPopup(new Merge(_repo, b, current.Name)); + e.Handled = true; }; submenu.Items.Add(fastForward); @@ -943,7 +948,7 @@ namespace SourceGit.ViewModels merge.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(_repo, branch.Name, current.Name)); + PopupHost.ShowPopup(new Merge(_repo, branch, current.Name)); e.Handled = true; }; submenu.Items.Add(merge); @@ -1027,7 +1032,7 @@ namespace SourceGit.ViewModels merge.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(_repo, name, current.Name)); + PopupHost.ShowPopup(new Merge(_repo, branch, current.Name)); e.Handled = true; }; @@ -1086,7 +1091,7 @@ namespace SourceGit.ViewModels merge.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(_repo, tag.Name, current.Name)); + PopupHost.ShowPopup(new Merge(_repo, tag, current.Name)); e.Handled = true; }; submenu.Items.Add(merge); diff --git a/src/ViewModels/Merge.cs b/src/ViewModels/Merge.cs index b7630101..670a1ba5 100644 --- a/src/ViewModels/Merge.cs +++ b/src/ViewModels/Merge.cs @@ -5,7 +5,7 @@ namespace SourceGit.ViewModels { public class Merge : Popup { - public string Source + public object Source { get; } @@ -21,9 +21,22 @@ namespace SourceGit.ViewModels set; } - public Merge(Repository repo, string source, string into) + public Merge(Repository repo, Models.Branch source, string into) { _repo = repo; + _sourceName = source.FriendlyName; + + Source = source; + Into = into; + SelectedMode = AutoSelectMergeMode(); + View = new Views.Merge() { DataContext = this }; + } + + public Merge(Repository repo, Models.Tag source, string into) + { + _repo = repo; + _sourceName = source.Name; + Source = source; Into = into; SelectedMode = AutoSelectMergeMode(); @@ -33,11 +46,11 @@ namespace SourceGit.ViewModels public override Task Sure() { _repo.SetWatcherEnabled(false); - ProgressDescription = $"Merging '{Source}' into '{Into}' ..."; + ProgressDescription = $"Merging '{_sourceName}' into '{Into}' ..."; return Task.Run(() => { - var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, SetProgressDescription).Exec(); + var succ = new Commands.Merge(_repo.FullPath, _sourceName, SelectedMode.Arg, SetProgressDescription).Exec(); CallUIThread(() => _repo.SetWatcherEnabled(true)); return succ; }); @@ -59,5 +72,6 @@ namespace SourceGit.ViewModels } private readonly Repository _repo = null; + private readonly string _sourceName = string.Empty; } } diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index fd4899a4..176ee04f 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -1311,8 +1311,13 @@ namespace SourceGit.ViewModels fastForward.IsEnabled = branch.TrackStatus.Ahead.Count == 0; fastForward.Click += (_, e) => { + var b = _branches.Find(x => x.FriendlyName == upstream); + if (b == null) + return; + if (PopupHost.CanCreatePopup()) - PopupHost.ShowAndStartPopup(new Merge(this, upstream, branch.Name)); + PopupHost.ShowAndStartPopup(new Merge(this, b, branch.Name)); + e.Handled = true; }; @@ -1391,7 +1396,7 @@ namespace SourceGit.ViewModels merge.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(this, branch.Name, _currentBranch.Name)); + PopupHost.ShowPopup(new Merge(this, branch, _currentBranch.Name)); e.Handled = true; }; @@ -1687,7 +1692,7 @@ namespace SourceGit.ViewModels merge.Click += (_, e) => { if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new Merge(this, name, _currentBranch.Name)); + PopupHost.ShowPopup(new Merge(this, branch, _currentBranch.Name)); e.Handled = true; }; diff --git a/src/Views/Merge.axaml b/src/Views/Merge.axaml index b63bfc04..a80dbb12 100644 --- a/src/Views/Merge.axaml +++ b/src/Views/Merge.axaml @@ -16,10 +16,23 @@ HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Text="{DynamicResource Text.Merge.Source}"/> - - - - + + + + + + + + + + + + + + + + +