From 78fcc0117e6ef661289ee368425ad39a5ac1e198 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 25 Nov 2024 11:42:48 +0800 Subject: [PATCH 0001/1053] ux: style for tooltip Signed-off-by: leo --- src/Resources/Styles.axaml | 1 + src/Views/CommitBaseInfo.axaml | 26 +------------------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 82970549..fd4cac0c 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -164,6 +164,7 @@ - - @@ -119,12 +113,6 @@ Margin="0,0,16,0" PointerEntered="OnSHAPointerEntered" PointerPressed="OnSHAPressed"> - - - - @@ -162,12 +150,6 @@ Margin="0,0,16,0" PointerEntered="OnSHAPointerEntered" PointerPressed="OnSHAPressed"> - - - - @@ -205,13 +187,7 @@ Message="{Binding #ThisControl.Message}" IssueTrackerRules="{Binding #ThisControl.IssueTrackerRules}" HorizontalAlignment="Stretch" - TextWrapping="Wrap"> - - - - + TextWrapping="Wrap"> From a1c48dd11b00832c99590558d6c9c19306d3e5d1 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 26 Nov 2024 14:39:58 +0800 Subject: [PATCH 0002/1053] project: upgrade AvaloniaUI to 11.2.2 --- src/SourceGit.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj index a5a97df9..32f68d03 100644 --- a/src/SourceGit.csproj +++ b/src/SourceGit.csproj @@ -37,11 +37,11 @@ - - - - - + + + + + From bb41fcea3eaa071ef2d1d23b55b73ccda68235e0 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 26 Nov 2024 19:52:13 +0800 Subject: [PATCH 0003/1053] fix: `DisplayRange` is not updated when text diff view is opened for the first time --- src/Views/TextDiffView.axaml.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index da2d9ed1..ea70ac93 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -619,6 +619,7 @@ namespace SourceGit.Views TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged; UpdateTextMate(); + OnTextViewVisualLinesChanged(null, null); } protected override void OnUnloaded(RoutedEventArgs e) From 4fc32b2b59f414d508941a01777b6b74a733115e Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 27 Nov 2024 09:17:18 +0800 Subject: [PATCH 0004/1053] fix: crash due to font family name is an empty space (#745) --- src/ViewModels/Preference.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 70f0041f..1ccee4cd 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -65,7 +65,8 @@ namespace SourceGit.ViewModels get => _defaultFontFamily; set { - if (SetProperty(ref _defaultFontFamily, value) && !_isLoading) + var trimmed = value.Trim(); + if (SetProperty(ref _defaultFontFamily, trimmed) && !_isLoading) App.SetFonts(_defaultFontFamily, _monospaceFontFamily, _onlyUseMonoFontInEditor); } } @@ -75,7 +76,8 @@ namespace SourceGit.ViewModels get => _monospaceFontFamily; set { - if (SetProperty(ref _monospaceFontFamily, value) && !_isLoading) + var trimmed = value.Trim(); + if (SetProperty(ref _monospaceFontFamily, trimmed) && !_isLoading) App.SetFonts(_defaultFontFamily, _monospaceFontFamily, _onlyUseMonoFontInEditor); } } From cb9110baef8cd7efb96a3ab262ff4608a4188035 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 27 Nov 2024 10:02:26 +0800 Subject: [PATCH 0005/1053] ux: new style for repository sub-view switcher --- src/Resources/Locales/en_US.axaml | 6 +++--- src/Views/Repository.axaml | 34 +++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 8a0ee04e..e814d671 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -341,7 +341,7 @@ Remote: Track files named '{0}' Track all *{0} files - Histories + HISTORY Switch Horizontal/Vertical Layout AUTHOR AUTHOR TIME @@ -621,7 +621,7 @@ Pop Drop Stash Drop: - Stashes + STASHES CHANGES STASHES Statistics @@ -668,7 +668,7 @@ Rescan Repositories in Default Clone Dir Search Repositories... Sort - Changes + LOCAL CHANGES Git Ignore Ignore all *{0} files Ignore *{0} files in the same folder diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 079af6ab..1f5c0706 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -42,6 +42,16 @@ + + + + @@ -67,9 +83,9 @@ - - - + + + - - - + + + - - - + + + Date: Wed, 27 Nov 2024 10:08:20 +0800 Subject: [PATCH 0006/1053] ux: change `Height` of repository search bar --- src/Views/Repository.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index 1f5c0706..a0e83046 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -152,7 +152,7 @@ Date: Wed, 27 Nov 2024 11:10:44 +0800 Subject: [PATCH 0007/1053] ux: new style for ToggleButton.toggle_untracked --- src/Resources/Styles.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index fd4cac0c..6ea2af10 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -1182,7 +1182,7 @@ From d38d1b11e8e330c23d9f28d35753d2d5dd10260f Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 27 Nov 2024 15:27:57 +0800 Subject: [PATCH 0008/1053] fix: typo in `Text.Preference.General.ShowChildren` --- src/Resources/Locales/en_US.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index e814d671..fd42b0f5 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -453,7 +453,7 @@ Language History Commits Show author time instead of commit time in graph - Show children in the comment details + Show children in the commit details Subject Guide Length GIT Enable Auto CRLF From 1c0d8a26972d9b70f53fc0b4e02d4a4e13b6d51c Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 27 Nov 2024 17:06:44 +0800 Subject: [PATCH 0009/1053] fix: `git rev-list` do not support `--decorate-refs-exclude` (#746) Do not use histories filters to query commit children --- src/Commands/QueryCommitChildren.cs | 6 ++---- src/ViewModels/CommitDetail.cs | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Commands/QueryCommitChildren.cs b/src/Commands/QueryCommitChildren.cs index 293de912..bef09abb 100644 --- a/src/Commands/QueryCommitChildren.cs +++ b/src/Commands/QueryCommitChildren.cs @@ -4,14 +4,12 @@ namespace SourceGit.Commands { public class QueryCommitChildren : Command { - public QueryCommitChildren(string repo, string commit, int max, string filters) + public QueryCommitChildren(string repo, string commit, int max) { WorkingDirectory = repo; Context = repo; _commit = commit; - if (string.IsNullOrEmpty(filters)) - filters = "--branches --remotes --tags"; - Args = $"rev-list -{max} --parents {filters} ^{commit}"; + Args = $"rev-list -{max} --parents --branches --remotes ^{commit}"; } public IEnumerable Result() diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 05b60e2f..f14b0359 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -576,8 +576,7 @@ namespace SourceGit.ViewModels Task.Run(() => { var max = Preference.Instance.MaxHistoryCommits; - var filter = _repo.Settings.BuildHistoriesFilter(); - var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, max, filter) { Cancel = _cancelToken }; + var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, max) { Cancel = _cancelToken }; var children = cmdChildren.Result(); if (!cmdChildren.Cancel.Requested) Dispatcher.UIThread.Post(() => Children.AddRange(children)); From 1872148d985515f3bd50938aacffec47cd2688ae Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 27 Nov 2024 18:31:50 +0800 Subject: [PATCH 0010/1053] fix: the way to deal with local changes did not update after radio toggle changed (#748) --- src/Views/Checkout.axaml | 15 +++++------ src/Views/Checkout.axaml.cs | 47 +++++++++++++++++++++++++++++++++ src/Views/CreateBranch.axaml | 13 +++++---- src/Views/CreateBranch.axaml.cs | 47 +++++++++++++++++++++++++++++++++ src/Views/Pull.axaml | 13 +++++---- src/Views/Pull.axaml.cs | 47 +++++++++++++++++++++++++++++++++ 6 files changed, 160 insertions(+), 22 deletions(-) diff --git a/src/Views/Checkout.axaml b/src/Views/Checkout.axaml index eaf2e79e..eb1c9de0 100644 --- a/src/Views/Checkout.axaml +++ b/src/Views/Checkout.axaml @@ -32,22 +32,21 @@ HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,8,0" Text="{DynamicResource Text.Checkout.LocalChanges}"/> - - - - - + + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> diff --git a/src/Views/Checkout.axaml.cs b/src/Views/Checkout.axaml.cs index f8398a1d..da6e6b31 100644 --- a/src/Views/Checkout.axaml.cs +++ b/src/Views/Checkout.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Interactivity; namespace SourceGit.Views { @@ -8,5 +9,51 @@ namespace SourceGit.Views { InitializeComponent(); } + + protected override void OnLoaded(RoutedEventArgs e) + { + base.OnLoaded(e); + + var vm = DataContext as ViewModels.Checkout; + if (vm == null) + return; + + switch (vm.PreAction) + { + case Models.DealWithLocalChanges.DoNothing: + RadioDoNothing.IsChecked = true; + break; + case Models.DealWithLocalChanges.StashAndReaply: + RadioStashAndReply.IsChecked = true; + break; + default: + RadioDiscard.IsChecked = true; + break; + } + } + + private void OnLocalChangeActionIsCheckedChanged(object sender, RoutedEventArgs e) + { + var vm = DataContext as ViewModels.Checkout; + if (vm == null) + return; + + if (RadioDoNothing.IsChecked == true) + { + if (vm.PreAction != Models.DealWithLocalChanges.DoNothing) + vm.PreAction = Models.DealWithLocalChanges.DoNothing; + return; + } + + if (RadioStashAndReply.IsChecked == true) + { + if (vm.PreAction != Models.DealWithLocalChanges.StashAndReaply) + vm.PreAction = Models.DealWithLocalChanges.StashAndReaply; + return; + } + + if (vm.PreAction != Models.DealWithLocalChanges.Discard) + vm.PreAction = Models.DealWithLocalChanges.Discard; + } } } diff --git a/src/Views/CreateBranch.axaml b/src/Views/CreateBranch.axaml index 3516c317..caea0be4 100644 --- a/src/Views/CreateBranch.axaml +++ b/src/Views/CreateBranch.axaml @@ -69,21 +69,20 @@ Margin="0,0,8,0" Text="{DynamicResource Text.CreateBranch.LocalChanges}"/> - - - - + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> - - - - + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> + IsCheckedChanged="OnLocalChangeActionIsCheckedChanged"/> Date: Wed, 27 Nov 2024 20:21:01 +0800 Subject: [PATCH 0011/1053] enhance: clear unhandled key modifer before running command (#748) --- src/Views/Launcher.axaml.cs | 5 +++++ src/Views/RepositoryToolbar.axaml.cs | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index 29d90e09..4137579d 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -72,6 +72,11 @@ namespace SourceGit.Views return _unhandledModifiers.HasFlag(modifier); } + public void ClearKeyModifier() + { + _unhandledModifiers = KeyModifiers.None; + } + protected override void OnOpened(EventArgs e) { base.OnOpened(e); diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index afc8ac5a..1d9d634b 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -53,6 +53,7 @@ namespace SourceGit.Views if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + launcher.ClearKeyModifier(); repo.Fetch(startDirectly); e.Handled = true; } @@ -67,6 +68,7 @@ namespace SourceGit.Views if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + launcher.ClearKeyModifier(); repo.Pull(startDirectly); e.Handled = true; } @@ -81,6 +83,7 @@ namespace SourceGit.Views if (!startDirectly && OperatingSystem.IsMacOS()) startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta); + launcher.ClearKeyModifier(); repo.Push(startDirectly); e.Handled = true; } @@ -89,8 +92,16 @@ namespace SourceGit.Views private void StashAll(object _, RoutedEventArgs e) { var launcher = this.FindAncestorOfType(); - (DataContext as ViewModels.Repository)?.StashAll(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); + + launcher.ClearKeyModifier(); + repo.StashAll(startDirectly); + e.Handled = true; + } } private void OpenGitFlowMenu(object sender, RoutedEventArgs e) From e66179aeb88060e04c6481395a8497efc5014981 Mon Sep 17 00:00:00 2001 From: Efrem Ropelato Date: Thu, 28 Nov 2024 02:44:59 +0100 Subject: [PATCH 0012/1053] Italian translation (#759) --- TRANSLATION.md | 9 + src/App.axaml | 1 + src/Models/Locales.cs | 1 + src/Resources/Locales/it_IT.axaml | 696 ++++++++++++++++++++++++++++++ 4 files changed, 707 insertions(+) create mode 100644 src/Resources/Locales/it_IT.axaml diff --git a/TRANSLATION.md b/TRANSLATION.md index 03b26e1b..af8f4938 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -56,6 +56,15 @@ - Text.ScanRepositories - Text.SHALinkCM.NavigateTo + + +### it_IT.axaml: 100.0% + + +
+Missing Keys + +
### pt_BR.axaml: 99.29% diff --git a/src/App.axaml b/src/App.axaml index fc55776e..0f40031d 100644 --- a/src/App.axaml +++ b/src/App.axaml @@ -14,6 +14,7 @@ + diff --git a/src/Models/Locales.cs b/src/Models/Locales.cs index 9d24f491..e30977bf 100644 --- a/src/Models/Locales.cs +++ b/src/Models/Locales.cs @@ -12,6 +12,7 @@ namespace SourceGit.Models new Locale("English", "en_US"), new Locale("Español", "es_ES"), new Locale("Français", "fr_FR"), + new Locale("Italiano", "it_IT"), new Locale("Português (Brasil)", "pt_BR"), new Locale("Русский", "ru_RU"), new Locale("简体中文", "zh_CN"), diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml new file mode 100644 index 00000000..432daa08 --- /dev/null +++ b/src/Resources/Locales/it_IT.axaml @@ -0,0 +1,696 @@ + + Informazioni + Informazioni su SourceGit + • Creato con + • Il grafico è reso da + © 2024 sourcegit-scm + • Editor di testo da + • I font monospaziati provengono da + • Il codice sorgente è disponibile su + Client GUI Git open source e gratuito + Aggiungi Worktree + Cosa fare il checkout: + Branch esistente + Crea nuovo branch + Posizione: + Percorso per questo worktree. Supportato il percorso relativo. + Nome Branch: + Facoltativo. Predefinito è il nome della cartella di destinazione. + Traccia Branch: + Traccia branch remoto + Assistente AI + Usa AI per generare il messaggio di commit + Applica + Errore + Genera errori e si rifiuta di applicare la patch + Tutti gli errori + Simile a 'errore', ma mostra di più + File Patch: + Seleziona file .patch da applicare + Ignora modifiche agli spazi + Nessun avviso + Disattiva l'avviso sugli spazi finali + Applica Patch + Avviso + Mostra avvisi per alcuni errori, ma applica comunque + Spazi: + Archivia... + Salva Archivio In: + Seleziona il percorso del file archivio + Revisione: + Archivia + Richiedi Password SourceGit + FILE ASSUNTI COME INVARIATI + NESSUN FILE ASSUNTO COME INVARIATO + RIMUOVI + FILE BINARIO NON SUPPORTATO!!! + Attribuisci + L'ATTRIBUZIONE SU QUESTO FILE NON È SUPPORTATA!!! + Checkout ${0}$... + Confronta con Branch + Confronta con HEAD + Confronta con Worktree + Copia Nome Branch + Elimina ${0}$... + Elimina i {0} branch selezionati + Scarta tutte le modifiche + Avanzamento Veloce a ${0}$ + Recupera ${0}$ in ${1}$... + Git Flow - Completa ${0}$ + Unisci ${0}$ in ${1}$... + Recupera ${0}$ + Recupera ${0}$ in ${1}$... + Invia ${0}$ + Riallinea ${0}$ su ${1}$... + Rinomina ${0}$... + Imposta Branch di Tracciamento + Rimuovi Tracciamento + Confronto Branch + Byte + ANNULLA + Ripristina Questa Revisione + Ripristina la Revisione Padre + Genera messaggio di commit + CAMBIA MODALITÀ DI VISUALIZZAZIONE + Mostra come elenco di file e directory + Mostra come elenco di percorsi + Mostra come albero del filesystem + Checkout Branch + Checkout Commit + Avviso: Effettuando un checkout del commit, la tua HEAD sarà separata + Commit: + Branch: + Modifiche Locali: + Scarta + Non fare nulla + Stash e Ripristina + Cherry Pick + Aggiungi sorgente al messaggio di commit + Commit(s): + Conferma tutte le modifiche + Mainline: + Di solito non è possibile cherry-pick su una fusione perché non si sa quale lato della fusione deve essere considerato il mainline. Questa opzione consente di riprodurre la modifica relativa al genitore specificato. + Cancella Stash + Stai per cancellare tutti gli stash. Sei sicuro di voler continuare? + Clona Repository Remoto + Parametri Extra: + Argomenti addizionali per clonare il repository. Facoltativo. + Nome Locale: + Nome del repository. Facoltativo. + Cartella Principale: + URL del Repository: + CHIUDI + Editor + Cherry-Pick Questo Commit + Cherry-Pick... + Checkout Commit + Confronta con HEAD + Confronta con Worktree + Copia Info + Copia SHA + Azione Personalizzata + Rebase Interattivo ${0}$ fino a Qui + Riallinea ${0}$ fino a Qui + Ripristina ${0}$ fino a Qui + Annulla Commit + Modifica + Salva come Patch... + Unisci al Genitore + Unisci Commit Figli fino a Qui + MODIFICHE + Cerca Modifiche... + FILE + File LFS + Sottomodulo + INFORMAZIONI + AUTORE + MODIFICATO + CHI HA COMMITTATO + Controlla i riferimenti che contengono questo commit + IL COMMIT È CONTENUTO DA + Mostra solo le prime 100 modifiche. Vedi tutte le modifiche nella scheda MODIFICHE. + MESSAGGIO + GENITORI + RIFERIMENTI + SHA + Apri nel Browser + Inserisci l'oggetto del commit + Descrizione + Configura Repository + TEMPLATE DI COMMIT + Nome Template: + Contenuto Template: + AZIONE PERSONALIZZATA + Argomenti: + ${REPO} - Percorso del repository; ${SHA} - SHA del commit selezionato + File Eseguibile: + Nome: + Ambito: + Commit + Repository + Indirizzo Email + Indirizzo email + GIT + Recupera automaticamente i remoti + Minuto/i + Remoto Predefinito + Abilita --prune durante il fetch + Abilita --signoff per i commit + TRACCIAMENTO ISSUE + Aggiungi Regola Esempio per GitHub + Aggiungi Regola Esempio per Jira + Aggiungi Regola Esempio per Issue GitLab + Aggiungi Regola Esempio per Merge Request GitLab + Nuova Regola + Espressione Regex Issue: + Nome Regola: + URL Risultato: + Utilizza $1, $2 per accedere ai valori dei gruppi regex. + AI + Servizio Preferito: + Se il 'Servizio Preferito' è impostato, SourceGit utilizzerà solo quello per questo repository. In caso contrario, se sono disponibili più servizi, verrà mostrato un menu contestuale per sceglierne uno. + Proxy HTTP + Proxy HTTP usato da questo repository + Nome Utente + Nome utente per questo repository + Spazi di Lavoro + Colore + Ripristina schede all'avvio + Guida Commit Convenzionali + Modifica Sostanziale: + Issue Chiusa: + Dettaglio Modifiche: + Ambito: + Descrizione Breve: + Tipo di Modifica: + Copia + Copia Tutto il Testo + Copia Percorso + Copia Nome File + Crea Branch... + Basato Su: + Checkout del Branch Creato + Modifiche Locali: + Scarta + Non Fare Nulla + Stash e Ripristina + Nome Nuovo Branch: + Inserisci il nome del branch. + Crea Branch Locale + Crea Tag... + Nuovo Tag Su: + Firma con GPG + Messaggio Tag: + Facoltativo. + Nome Tag: + Formato consigliato: v1.0.0-alpha + Invia a tutti i remoti dopo la creazione + Crea Nuovo Tag + Tipo: + annotato + leggero + Tieni premuto Ctrl per avviare direttamente + Taglia + Elimina Branch + Branch: + Stai per eliminare un branch remoto!!! + Elimina anche il branch remoto ${0}$ + Elimina Branch Multipli + Stai per eliminare più branch contemporaneamente. Controlla attentamente prima di procedere! + Elimina Remoto + Remoto: + Destinazione: + Conferma Eliminazione Gruppo + Conferma Eliminazione Repository + Elimina Sottomodulo + Percorso Sottomodulo: + Elimina Tag + Tag: + Elimina dai repository remoti + DIFF BINARIO + NUOVO + VECCHIO + Copia + Modalità File Modificata + Ignora Modifiche agli Spazi + MODIFICA OGGETTO LFS + Differenza Successiva + NESSUNA MODIFICA O SOLO CAMBIAMENTI DI FINE LINEA + Differenza Precedente + Salva come Patch + Mostra Simboli Nascosti + Diff Affiancato + SOTTOMODULO + NUOVO + Scambia + Evidenziazione Sintassi + Avvolgimento delle Parole + Apri nello Strumento di Merge + Mostra Tutte le Righe + Diminuisci Numero di Righe Visibili + Aumenta Numero di Righe Visibili + SELEZIONA UN FILE PER VISUALIZZARE LE MODIFICHE + Apri nello Strumento di Merge + Scarta Modifiche + Tutte le modifiche locali nella copia di lavoro. + Modifiche: + Includi file ignorati + Un totale di {0} modifiche saranno scartate + Questa azione non può essere annullata!!! + Segnalibro: + Nuovo Nome: + Destinazione: + Modifica Gruppo Selezionato + Modifica Repository Selezionato + Esegui Azione Personalizzata + Nome Azione: + Avanzamento Veloce (senza verifica) + Recupera + Recupera da tutti i remoti + Recupera senza tag + Remoto: + Recupera Modifiche Remote + Presumi invariato + Scarta... + Scarta {0} file... + Scarta Modifiche nelle Righe Selezionate + Apri Strumento di Merge Esterno + Salva come Patch... + Staging + Staging {0} file + Staging Modifiche nelle Righe Selezionate + Stash... + Stash {0} file... + Rimuovi dallo Staging + Rimuovi dallo Staging {0} file + Rimuovi dallo Staging Modifiche nelle Righe Selezionate + Usa Il Loro (checkout --theirs) + Usa Il Mio (checkout --ours) + Cronologia File + CONTENUTO + MODIFICA + FILTRO + Git-Flow + Branch di Sviluppo: + Feature: + Prefisso Feature: + FLOW - Completa Feature + FLOW - Completa Hotfix + FLOW - Completa Release + Target: + Hotfix: + Prefisso Hotfix: + Inizializza Git-Flow + Mantieni branch + Branch di Produzione: + Release: + Prefisso Release: + Inizia Feature... + FLOW - Inizia Feature + Inizia Hotfix... + FLOW - Inizia Hotfix + Inserisci nome + Inizia Release... + FLOW - Inizia Release + Prefisso Tag Versione: + Git LFS + Aggiungi Modello di Tracciamento... + Il modello è un nome file + Modello Personalizzato: + Aggiungi Modello di Tracciamento a Git LFS + Recupera + Recupera Oggetti LFS + Esegui `git lfs fetch` per scaricare gli oggetti Git LFS. Questo non aggiorna la copia di lavoro. + Installa hook di Git LFS + Mostra Bloccaggi + Nessun File Bloccato + Blocca + Mostra solo i miei bloccaggi + Bloccaggi LFS + Sblocca + Forza Sblocco + Elimina + Esegui `git lfs prune` per eliminare vecchi file LFS dallo storage locale + Pull + Pull Oggetti LFS + Esegui `git lfs pull` per scaricare tutti i file LFS per il ref corrente e fare il checkout + Push + Push Oggetti LFS + Invia grandi file in coda al punto finale di Git LFS + Remoto: + Traccia file con nome '{0}' + Traccia tutti i file *{0} + Storico + Passa Layout Orizzontale/Verticale + AUTORE + ORA AUTORE + GRAFICO & OGGETTO + SHA + ORA COMMIT + {0} COMMIT SELEZIONATI + Tieni premuto 'Ctrl' o 'Shift' per selezionare più commit. + Tieni premuto ⌘ o ⇧ per selezionare più commit. + SUGGERIMENTI: + Riferimento Scorciatoie da Tastiera + GLOBALE + Annulla il popup corrente + Chiudi la pagina corrente + Vai alla pagina precedente + Vai alla pagina successiva + Crea una nuova pagina + Apri la finestra di preferenze + REPOSITORY + Conferma le modifiche in fase + Conferma e invia le modifiche in fase + Aggiungi tutte le modifiche e conferma + Crea un nuovo branch dal commit selezionato + Scarta le modifiche selezionate + Recupera, avvia direttamente + Modalità Dashboard (Predefinita) + Recupera e integra, avvia direttamente + Invia, avvia direttamente + Forza il ricaricamento di questo repository + Aggiungi/Rimuovi le modifiche selezionate + Modalità ricerca commit + Passa a 'Modifiche' + Passa a 'Storico' + Passa a 'Stashes' + EDITOR TESTO + Chiudi il pannello di ricerca + Trova il prossimo risultato + Trova il risultato precedente + Apri il pannello di ricerca + Aggiungi + Rimuovi + 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. + Rebase Interattivo + Branch di destinazione: + Su: + Apri nel Browser + Copia il Link + ERRORE + AVVISO + Unisci Branch + In: + Opzione di Merge: + Branch Sorgente: + Sposta Nodo Repository + Seleziona nodo padre per: + Nome: + Git NON è configurato. Vai su [Preferenze] e configurarlo prima. + Apri Cartella Dati App + Apri con... + Opzionale. + Crea Nuova Pagina + Segnalibro + Chiudi Tab + Chiudi Altri Tab + Chiudi i Tab a Destra + Copia Percorso Repository + Repository + Incolla + Proprio ora + {0} minuti fa + {0} ore fa + Ieri + {0} giorni fa + Il mese scorso + {0} mesi fa + L'anno scorso + {0} anni fa + Preferenze + AI + Analizza il Prompt Differenza + Chiave API + Genera Prompt Soggetto + Modello + Nome + Server + ASPETTO + Font Predefinito + Font Size + Dimensione Font Predefinita + Dimensione Font Editor + Font Monospaziato + Usa solo font monospaziato nell'editor + Tema + Sostituzioni Tema + Usa larghezza fissa per i tab nella barra del titolo + Usa cornice finestra nativa + STRUMENTO DI DIFFERENZA/UNIONE + Percorso Installazione + Inserisci il percorso per lo strumento di differenza/unione + Strumento + GENERALE + Controlla aggiornamenti all'avvio + Lingua + Numero massimo di commit nella cronologia + Mostra l'orario dell'autore anziché quello del commit nel grafico + Lunghezza Guida Soggetto + GIT + Abilita Auto CRLF + Cartella predefinita per cloni + Email Utente + Email globale utente Git + Percorso Installazione + Nome Utente + Nome globale utente Git + Versione di Git + Git (>= 2.23.0) è richiesto da questa applicazione + FIRMA GPG + Firma GPG per commit + Firma GPG per tag + Formato GPG + Percorso Programma Installato + Inserisci il percorso per il programma GPG installato + Chiave Firma Utente + Chiave GPG dell'utente per la firma + INTEGRAZIONE + SHELL/TERMINALE + Shell/Terminale + Percorso + Potatura Remota + Destinazione: + Potatura Worktrees + Potatura delle informazioni di worktree in `$GIT_DIR/worktrees` + Pull + Branch: + Recupera tutti i branch + In: + Modifiche Locali: + Scarta + Non fare nulla + Accantona e Riapplica + Recupera senza tag + Remoto: + Pull (Fetch & Merge) + Usa rebase anziché merge + Push + Assicurati che i submoduli siano stati spinti + Forza il push + Branch Locale: + Remoto: + Invia modifiche al remoto + Branch Remoto: + Imposta come branch di tracking + Invia tutti i tag + Invia Tag al Remoto + Invia a tutti i remoti + Remoto: + Tag: + Esci + Rebase Branch Corrente + Accantona & Riapplica modifiche locali + Su: + Rebase: + Aggiorna + Aggiungi Remoto + Modifica Remoto + Nome: + Nome del remoto + URL del Repository: + URL del repository Git remoto + Copia URL + Elimina... + Modifica... + Recupera + Apri nel Browser + Pota + Conferma Rimozione Worktree + Abilita opzione `--force` + Destinazione: + Rinomina Branch + Nuovo Nome: + Nome univoco per questo branch + Branch: + ANNULLA + Recupero automatico delle modifiche dai remoti... + Pulizia (GC & Potatura) + Esegui il comando `git gc` per questo repository. + Cancella tutto + Configura questo repository + CONTINUA + Azioni Personalizzate + Nessuna Azione Personalizzata + Abilita opzione '--reflog' + Apri nel Browser File + Cerca Branch/Tag/Submodule + FILTRATO DA: + BRANCH LOCALI + Vai a HEAD + Abilita opzione '--first-parent' + Crea Branch + Apri in {0} + Apri in Strumenti Esterni + Aggiorna + REMOTI + AGGIUNGI REMOTO + RISOLVI + Cerca Commit + File + Messaggio + SHA + Autore & Committente + Branch Corrente + Mostra Tag come Albero + Statistiche + SUBMODULE + AGGIUNGI SUBMODULE + AGGIORNA SUBMODULE + TAG + NUOVO TAG + Apri nel Terminale + WORKTREE + AGGIUNGI WORKTREE + POTATURA + URL del Repository Git + Reset Branch Corrente alla Revisione + Modalità Reset: + Sposta a: + Branch Corrente: + Mostra nel File Explorer + Revert Commit + Commit: + Commit delle modifiche di revert + Modifica Messaggio di Commit + Usa 'Shift+Enter' per inserire una nuova riga. 'Enter' è il tasto rapido per il pulsante OK + In esecuzione. Attendere... + SALVA + Salva come... + La patch è stata salvata con successo! + Scansiona Repository + Cartella Principale: + Controlla Aggiornamenti... + È disponibile una nuova versione del software: + Errore durante il controllo degli aggiornamenti! + Scarica + Salta questa versione + Aggiornamento Software + Non ci sono aggiornamenti disponibili. + Squash Commit + In: + Chiave Privata SSH: + Percorso per la chiave SSH privata + AVVIA + Accantona + Includi file non tracciati + Mantieni file indicizzati + Messaggio: + Opzionale. Nome di questo accantonamento + Solo modifiche indicizzate + Sia le modifiche indicizzate che quelle non indicizzate dei file selezionati saranno accantonate!!! + Accantona Modifiche Locali + Applica + Elimina + Estrai + Elimina Accantonamento + Elimina: + Accantonamenti + MODIFICHE + ACCANTONAMENTI + Statistiche + COMMIT + COMMITTER + MESE + SETTIMANA + COMMIT: + AUTORI: + PANORAMICA + SUBMODULE + Aggiungi Submodule + Copia Percorso Relativo + Recupera submodule annidati + Apri Repository Submodule + Percorso Relativo: + Cartella relativa per memorizzare questo modulo. + Elimina Submodule + OK + Copia Nome Tag + Copia Messaggio Tag + Elimina ${0}$... + Unisci ${0}$ in ${1}$... + Invia ${0}$... + URL: + Aggiorna Submodule + Tutti i submodule + Inizializza se necessario + Ricorsivamente + Submodule: + Usa opzione --remote + Avviso + Pagina di Benvenuto + Crea Gruppo + Crea Sottogruppo + Clona Repository + Elimina + TRASCINA & RILASCIA CARTELLA SUPPORTATO. RAGGRUPPAMENTI PERSONALIZZATI SUPPORTATI. + Modifica + Sposta in un Altro Gruppo + Apri Tutti i Repository + Apri Repository + Apri Terminale + Riscansiona Repository nella Cartella Clone Predefinita + Cerca Repository... + Ordina + Modifiche + Git Ignore + Ignora tutti i file *{0} + Ignora i file *{0} nella stessa cartella + Ignora i file nella stessa cartella + Ignora solo questo file + Modifica + Puoi indicizzare questo file ora. + COMMIT + COMMIT & PUSH + Template/Storico + Attiva evento click + Indica tutte le modifiche e fai il commit + Commit vuoto rilevato! Vuoi continuare (--allow-empty)? + CONFLITTI RILEVATI + CONFLITTI NEI FILE RISOLTI + INCLUDI FILE NON TRACCIATI + NESSUN MESSAGGIO RECENTE INSERITO + NESSUN TEMPLATE DI COMMIT + INDICIZZATI + RIMUOVI DALL'INDICIZZAZIONE + RIMUOVI TUTTO DALL'INDICIZZAZIONE + NON INDICIZZATI + INDICIZZA + INDICIZZA TUTTO + VISUALIZZA COME NON MODIFICATO + Template: ${0}$ + Clicca con il tasto destro sul file(i) selezionato, quindi scegli come risolvere i conflitti. + WORKSPACE: + Configura Workspaces... + WORKTREE + Copia Percorso + Blocca + Rimuovi + Sblocca + From ba0bb35ca6f6bc16f019505a14be951ffcbd675b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Nov 2024 01:45:10 +0000 Subject: [PATCH 0013/1053] doc: Update translation status and missing keys --- README.md | 2 +- TRANSLATION.md | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45d6bbf5..07cdc098 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.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%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.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-98.01%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-97.44%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-97.87%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.29%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md) ## How to Use diff --git a/TRANSLATION.md b/TRANSLATION.md index af8f4938..c15fdcfb 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -58,12 +58,27 @@ -### it_IT.axaml: 100.0% +### it_IT.axaml: 97.87%
Missing Keys +- Text.CommitDetail.Info.Children +- Text.Configure.IssueTracker.AddSampleGitLabMergeRequest +- Text.Configure.OpenAI.Preferred +- Text.Configure.OpenAI.Preferred.Tip +- Text.Fetch.Force +- Text.Preference.General.ShowChildren +- Text.Repository.FilterCommits +- Text.Repository.FilterCommits.Default +- Text.Repository.FilterCommits.Exclude +- Text.Repository.FilterCommits.Include +- Text.Repository.HistoriesOrder +- Text.Repository.HistoriesOrder.ByDate +- Text.Repository.HistoriesOrder.Topo +- Text.SHALinkCM.CopySHA +- Text.SHALinkCM.NavigateTo
From 315a226365884eb68b6dc2f1e69e0a754c9cae9a Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 28 Nov 2024 09:48:07 +0800 Subject: [PATCH 0014/1053] code_review: PR #759 * code indent * update README.md --- README.md | 2 +- src/Models/Locales.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 07cdc098..d83642a5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ * Supports Windows/macOS/Linux * Opensource/Free * Fast -* Deutsch/English/Español/Français/Português/Русский/简体中文/繁體中文 +* Deutsch/English/Español/Français/Italiano/Português/Русский/简体中文/繁體中文 * Built-in light/dark themes * Customize theme * Visual commit graph diff --git a/src/Models/Locales.cs b/src/Models/Locales.cs index e30977bf..d5e1534c 100644 --- a/src/Models/Locales.cs +++ b/src/Models/Locales.cs @@ -12,7 +12,7 @@ namespace SourceGit.Models new Locale("English", "en_US"), new Locale("Español", "es_ES"), new Locale("Français", "fr_FR"), - new Locale("Italiano", "it_IT"), + new Locale("Italiano", "it_IT"), new Locale("Português (Brasil)", "pt_BR"), new Locale("Русский", "ru_RU"), new Locale("简体中文", "zh_CN"), From ccf03ce2de2921325d49c4ee30d09ab0ed2fe565 Mon Sep 17 00:00:00 2001 From: Efrem Ropelato Date: Thu, 28 Nov 2024 06:57:46 +0100 Subject: [PATCH 0015/1053] fix ita locale: add ResourceInclude en_US.axaml (#762) * Italian translation * fix ita locale: add ResourceInclude en_US.axaml --- TRANSLATION.md | 2 +- src/Resources/Locales/it_IT.axaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index c15fdcfb..31ab7efa 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -58,8 +58,8 @@ -### it_IT.axaml: 97.87% +### it_IT.axaml: 97.87%
Missing Keys diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 432daa08..2e3acf3e 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -1,4 +1,7 @@ + + + Informazioni Informazioni su SourceGit • Creato con From 8f4d3fd957872bdcf351dc8ac4f101fb8280c415 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 28 Nov 2024 05:57:58 +0000 Subject: [PATCH 0016/1053] doc: Update translation status and missing keys --- TRANSLATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TRANSLATION.md b/TRANSLATION.md index 31ab7efa..c15fdcfb 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -58,9 +58,9 @@
- ### it_IT.axaml: 97.87% +
Missing Keys From 58eeeab67b1a0a67c6d93711f52cb34db1d61ab2 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 28 Nov 2024 19:36:07 +0800 Subject: [PATCH 0017/1053] enhance: set `core.autocrlf` to `false` when run `git diff` to get detail changes of selected file (#761) --- src/Commands/Diff.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index dea15592..da971e58 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -28,9 +28,9 @@ namespace SourceGit.Commands Context = repo; if (ignoreWhitespace) - Args = $"diff --no-ext-diff --patch --ignore-cr-at-eol --ignore-all-space --unified={unified} {opt}"; + Args = $"-c core.autocrlf=false diff --no-ext-diff --patch --ignore-cr-at-eol --ignore-all-space --unified={unified} {opt}"; else - Args = $"diff --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}"; + Args = $"-c core.autocrlf=false diff --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}"; } public Models.DiffResult Result() From 400aaacf183b15eed98c64d2cfaa562896a34352 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 28 Nov 2024 21:40:51 +0800 Subject: [PATCH 0018/1053] fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) --- src/Views/InteractiveRebase.axaml | 55 +++++++++++++++++-------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/Views/InteractiveRebase.axaml b/src/Views/InteractiveRebase.axaml index c008193b..6679fbb6 100644 --- a/src/Views/InteractiveRebase.axaml +++ b/src/Views/InteractiveRebase.axaml @@ -76,13 +76,16 @@ - + - + @@ -170,8 +173,8 @@ - - - - - - - + + - - - + + + + - + + + - + - - From dfc03d7a8f80b1ca98a4b8ed03845b54577bc462 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 09:51:50 +0800 Subject: [PATCH 0019/1053] feature: allows to copy branch/tag name from the context menu of selected commit --- src/ViewModels/Histories.cs | 108 ++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 34 deletions(-) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index f77fc87b..18ca2e51 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -813,6 +813,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = current.Name; + FillBranchVisibilityMenu(submenu, current); + if (!string.IsNullOrEmpty(current.Upstream)) { var upstream = current.Upstream.Substring(13); @@ -852,6 +854,17 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(push); + + var rename = new MenuItem(); + rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name); + rename.Icon = App.CreateMenuIcon("Icons.Rename"); + rename.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new RenameBranch(_repo, current)); + e.Handled = true; + }; + submenu.Items.Add(rename); submenu.Items.Add(new MenuItem() { Header = "-" }); var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name); @@ -870,18 +883,15 @@ namespace SourceGit.ViewModels submenu.Items.Add(new MenuItem() { Header = "-" }); } - FillBranchVisibilityMenu(submenu, current); - - var rename = new MenuItem(); - rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name); - rename.Icon = App.CreateMenuIcon("Icons.Rename"); - rename.Click += (_, e) => + var copy = new MenuItem(); + copy.Header = App.Text("BranchCM.CopyName"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, e) => { - if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new RenameBranch(_repo, current)); + App.CopyText(current.Name); e.Handled = true; }; - submenu.Items.Add(rename); + submenu.Items.Add(copy); menu.Items.Add(submenu); } @@ -892,6 +902,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = branch.Name; + FillBranchVisibilityMenu(submenu, branch); + var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -913,25 +925,6 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(merge); - submenu.Items.Add(new MenuItem() { Header = "-" }); - - var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name); - if (detect.IsGitFlowBranch) - { - var finish = new MenuItem(); - finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name); - finish.Icon = App.CreateMenuIcon("Icons.GitFlow"); - finish.Click += (_, e) => - { - if (PopupHost.CanCreatePopup()) - PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix)); - e.Handled = true; - }; - submenu.Items.Add(finish); - submenu.Items.Add(new MenuItem() { Header = "-" }); - } - - FillBranchVisibilityMenu(submenu, branch); var rename = new MenuItem(); rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name); @@ -954,6 +947,33 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(delete); + submenu.Items.Add(new MenuItem() { Header = "-" }); + + var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name); + if (detect.IsGitFlowBranch) + { + var finish = new MenuItem(); + finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name); + finish.Icon = App.CreateMenuIcon("Icons.GitFlow"); + finish.Click += (_, e) => + { + if (PopupHost.CanCreatePopup()) + PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix)); + e.Handled = true; + }; + submenu.Items.Add(finish); + submenu.Items.Add(new MenuItem() { Header = "-" }); + } + + var copy = new MenuItem(); + copy.Header = App.Text("BranchCM.CopyName"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, e) => + { + App.CopyText(branch.Name); + e.Handled = true; + }; + submenu.Items.Add(copy); menu.Items.Add(submenu); } @@ -966,6 +986,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Branch"); submenu.Header = name; + FillBranchVisibilityMenu(submenu, branch); + var checkout = new MenuItem(); checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name); checkout.Icon = App.CreateMenuIcon("Icons.Check"); @@ -988,9 +1010,6 @@ namespace SourceGit.ViewModels }; submenu.Items.Add(merge); - submenu.Items.Add(new MenuItem() { Header = "-" }); - - FillBranchVisibilityMenu(submenu, branch); var delete = new MenuItem(); delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name); @@ -1002,6 +1021,17 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(delete); + submenu.Items.Add(new MenuItem() { Header = "-" }); + + var copy = new MenuItem(); + copy.Header = App.Text("BranchCM.CopyName"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, e) => + { + App.CopyText(name); + e.Handled = true; + }; + submenu.Items.Add(copy); menu.Items.Add(submenu); } @@ -1013,6 +1043,8 @@ namespace SourceGit.ViewModels submenu.Icon = App.CreateMenuIcon("Icons.Tag"); submenu.MinWidth = 200; + FillTagVisibilityMenu(submenu, tag); + var push = new MenuItem(); push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name); push.Icon = App.CreateMenuIcon("Icons.Push"); @@ -1036,9 +1068,6 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(merge); - submenu.Items.Add(new MenuItem() { Header = "-" }); - - FillTagVisibilityMenu(submenu, tag); var delete = new MenuItem(); delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name); @@ -1050,6 +1079,17 @@ namespace SourceGit.ViewModels e.Handled = true; }; submenu.Items.Add(delete); + submenu.Items.Add(new MenuItem() { Header = "-" }); + + var copy = new MenuItem(); + copy.Header = App.Text("TagCM.Copy"); + copy.Icon = App.CreateMenuIcon("Icons.Copy"); + copy.Click += (_, e) => + { + App.CopyText(tag.Name); + e.Handled = true; + }; + submenu.Items.Add(copy); menu.Items.Add(submenu); } From db8ee3410bf19f6d81f6f0871bd6635efd8d1c7d Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 09:59:07 +0800 Subject: [PATCH 0020/1053] refactor: users should change the `SystemAccentColor` from system-wide settings --- src/App.axaml.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 0615724a..a4e5bd5b 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -164,12 +164,7 @@ namespace SourceGit var resDic = new ResourceDictionary(); var overrides = JsonSerializer.Deserialize(File.ReadAllText(themeOverridesFile), JsonCodeGen.Default.ThemeOverrides); foreach (var kv in overrides.BasicColors) - { - if (kv.Key.Equals("SystemAccentColor", StringComparison.Ordinal)) - resDic["SystemAccentColor"] = kv.Value; - else - resDic[$"Color.{kv.Key}"] = kv.Value; - } + resDic[$"Color.{kv.Key}"] = kv.Value; if (overrides.GraphColors.Count > 0) Models.CommitGraph.SetPens(overrides.GraphColors, overrides.GraphPenThickness); From 4aad6a7f8610db2e3b57449f44e316e4c177b0e8 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 10:26:36 +0800 Subject: [PATCH 0021/1053] fix: `System.ArgumentException` when hover the commit link multiple times before the first time tooltip shows (#765) --- src/ViewModels/CherryPick.cs | 1 - src/Views/CommitMessagePresenter.cs | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ViewModels/CherryPick.cs b/src/ViewModels/CherryPick.cs index ea601d5a..19dac059 100644 --- a/src/ViewModels/CherryPick.cs +++ b/src/ViewModels/CherryPick.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace SourceGit.ViewModels diff --git a/src/Views/CommitMessagePresenter.cs b/src/Views/CommitMessagePresenter.cs index 7ca823dc..a767b395 100644 --- a/src/Views/CommitMessagePresenter.cs +++ b/src/Views/CommitMessagePresenter.cs @@ -296,7 +296,8 @@ namespace SourceGit.Views if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } && currentDetail.Commit.SHA == lastDetailCommit) { - _inlineCommits.Add(sha, c); + if (!_inlineCommits.ContainsKey(sha)) + _inlineCommits.Add(sha, c); // Make sure user still hovers the target SHA. if (_lastHover == link && c != null) From 4cb9dbfd143ec4fbcb3102b5f3d18fb2e77252dc Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 10:35:23 +0800 Subject: [PATCH 0022/1053] code_style: remove unused namespace using --- .editorconfig | 3 +++ src/Commands/QueryLocalChanges.cs | 3 +-- src/ViewModels/RepositoryConfigure.cs | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 83b15884..22c741b9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -206,6 +206,9 @@ dotnet_diagnostic.CA1854.severity = warning #CA2211:Non-constant fields should not be visible dotnet_diagnostic.CA2211.severity = error +# IDE0005: remove used namespace using +dotnet_diagnostic.IDE0005.severity = error + # Wrapping preferences csharp_wrap_before_ternary_opsigns = false diff --git a/src/Commands/QueryLocalChanges.cs b/src/Commands/QueryLocalChanges.cs index bdef9bf8..ea422215 100644 --- a/src/Commands/QueryLocalChanges.cs +++ b/src/Commands/QueryLocalChanges.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text.RegularExpressions; namespace SourceGit.Commands diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs index 620db074..95fb5517 100644 --- a/src/ViewModels/RepositoryConfigure.cs +++ b/src/ViewModels/RepositoryConfigure.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Avalonia.Collections; using CommunityToolkit.Mvvm.ComponentModel; From f028513d499273d2dfd67a8897300cb776d1cf35 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 11:46:27 +0800 Subject: [PATCH 0023/1053] doc: update tips for manually build --- build/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/README.md b/build/README.md index a75f4d73..b4358a55 100644 --- a/build/README.md +++ b/build/README.md @@ -5,7 +5,7 @@ ## How to build this project manually -1. Make sure [.NET SDK 8](https://dotnet.microsoft.com/en-us/download) is installed on your machine. +1. Make sure [.NET SDK 9](https://dotnet.microsoft.com/en-us/download) is installed on your machine. 2. Clone this project 3. Run the follow command under the project root dir ```sh From e65ac18afc55f69741e6bd3788f5c485c89e7a56 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 19:00:53 +0800 Subject: [PATCH 0024/1053] fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) --- src/Views/InteractiveRebase.axaml | 51 ++++++++++++++++--------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/Views/InteractiveRebase.axaml b/src/Views/InteractiveRebase.axaml index 6679fbb6..846be5f2 100644 --- a/src/Views/InteractiveRebase.axaml +++ b/src/Views/InteractiveRebase.axaml @@ -65,6 +65,7 @@ + @@ -76,7 +77,7 @@ - + - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - From 938876e92478b07c64638254faef2b5a0393cc2d Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 29 Nov 2024 19:12:27 +0800 Subject: [PATCH 0025/1053] fix: wrong column indentation on right side of Interactive Rebase window, for wide commit messages (#764) --- src/Views/InteractiveRebase.axaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Views/InteractiveRebase.axaml b/src/Views/InteractiveRebase.axaml index 846be5f2..f02f15ae 100644 --- a/src/Views/InteractiveRebase.axaml +++ b/src/Views/InteractiveRebase.axaml @@ -212,7 +212,9 @@ - + + +
-### es_ES.axaml: 97.73% +### es_ES.axaml: 100.00%
Missing Keys -- Text.CommitDetail.Files.Search -- Text.CommitDetail.Info.Children -- Text.Fetch.Force -- Text.Preference.Appearance.FontSize -- Text.Preference.Appearance.FontSize.Default -- Text.Preference.Appearance.FontSize.Editor -- Text.Preference.General.ShowChildren -- Text.Repository.FilterCommits -- Text.Repository.FilterCommits.Default -- Text.Repository.FilterCommits.Exclude -- Text.Repository.FilterCommits.Include -- Text.Repository.HistoriesOrder -- Text.Repository.HistoriesOrder.ByDate -- Text.Repository.HistoriesOrder.Topo -- Text.SHALinkCM.NavigateTo -- Text.WorkingCopy.CommitToEdit +
diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 563419be..7c7f8d7c 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -126,10 +126,12 @@ Buscar Cambios... ARCHIVOS Archivo LFS + Buscar Archivos... Submódulo INFORMACIÓN AUTOR CAMBIADO + HIJOS COMMITTER Ver refs que contienen este commit COMMIT ESTÁ CONTENIDO EN @@ -272,6 +274,7 @@ Fast-Forward (sin checkout) Fetch Fetch todos los remotos + Utilizar opción '--force' Fetch sin etiquetas Remoto: Fetch Cambios Remotos @@ -437,6 +440,9 @@ Servidor APARIENCIA Fuente por defecto + Tamaño de fuente + Por defecto + Editor Fuente Monospace Usar solo fuente monospace en el editor de texto Tema @@ -452,6 +458,7 @@ Idioma Commits en el historial Mostrar hora del autor en lugar de la hora del commit en el gráfico + Mostrar hijos en los detalles de commit Longitud de la guía del asunto GIT Habilitar Auto CRLF @@ -541,6 +548,13 @@ Habilitar Opción '--reflog' Abrir en el Explorador Buscar Ramas/Etiquetas/Submódulos + Visibilidad en el Gráfico + Desestablecer + Ocultar en el Gráfico de Commits + Filtrar en el Gráfico de Commits + Cambiar Modo de Ordenación + Fecha de Commit (--date-order) + Topológicamente (--topo-order) RAMAS LOCALES Navegar a HEAD Habilitar Opción '--first-parent' @@ -593,6 +607,7 @@ Actualización de Software Actualmente no hay actualizaciones disponibles. Copiar SHA + Ir a Squash Commits En: Clave Privada SSH: @@ -670,6 +685,7 @@ COMMIT & PUSH Plantilla/Historias Activar evento de clic + Commit (Editar) Stagear todos los cambios y commit ¡Commit vacío detectado! ¿Quieres continuar (--allow-empty)? CONFLICTOS DETECTADOS From c062f270816581210896b21f1120e2a2b19a65fe Mon Sep 17 00:00:00 2001 From: GadflyFang Date: Fri, 6 Dec 2024 15:09:14 +0800 Subject: [PATCH 0050/1053] fix: Dispose _autoFetchTimer before _setting set to null (#792) Signed-off-by: Gadfly --- src/ViewModels/Repository.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 514bdb6d..38855fef 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -427,12 +427,12 @@ namespace SourceGit.ViewModels { // Ignore } - _settings = null; - _historiesFilterMode = Models.FilterMode.None; - _autoFetchTimer.Dispose(); _autoFetchTimer = null; + _settings = null; + _historiesFilterMode = Models.FilterMode.None; + _watcher?.Dispose(); _histories.Cleanup(); _workingCopy.Cleanup(); From 655d71b0bc163e35f18eb510df45f53bfdfb4095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20W?= <44604769+goran-w@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:50:33 +0100 Subject: [PATCH 0051/1053] Add navigation and highlighting of change-blocks in Text Diff (#616, #717) (#703) * Corrected misspelled local variable nextHigh(t)light * Implemented change-block navigation * Modified behavior of the Prev/Next Change buttons in DiffView toolbar. * Well-defined change-blocks are pre-calculated and can be navigated between. * Current change-block is highlighted in the Diff panel(s). * Prev/next at start/end of range (re-)scrolls to first/last change-block (I.e when unset, or already at first/last change-block, or at the only one.) * Current change-block is unset in RefreshContent(). * Added safeguards for edge cases * Added indicator of current/total change-blocks in DiffView toolbar * Added new Icon and String (en-US) for Highlighted Diff Navigation * Added Preference and ToggleButton for diff navigation style --- src/Commands/Diff.cs | 3 + src/Models/DiffResult.cs | 60 +++++++++++- src/Resources/Icons.axaml | 1 + src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/DiffContext.cs | 73 +++++++++++++- src/ViewModels/Preference.cs | 7 ++ src/ViewModels/TwoSideTextDiff.cs | 33 +++++++ src/Views/DiffView.axaml | 27 +++++- src/Views/DiffView.axaml.cs | 44 ++++++--- src/Views/TextDiffView.axaml | 3 + src/Views/TextDiffView.axaml.cs | 156 ++++++++++++++++++++++++------ 11 files changed, 361 insertions(+), 47 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index da971e58..f1bef7b7 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -51,6 +51,9 @@ namespace SourceGit.Commands _result.TextDiff.MaxLineNumber = Math.Max(_newLine, _oldLine); } + if (_result.TextDiff != null) + _result.TextDiff.ProcessChangeBlocks(); + return _result; } diff --git a/src/Models/DiffResult.cs b/src/Models/DiffResult.cs index e0ae82e0..afe22ad4 100644 --- a/src/Models/DiffResult.cs +++ b/src/Models/DiffResult.cs @@ -2,6 +2,8 @@ using System.Text; using System.Text.RegularExpressions; +using CommunityToolkit.Mvvm.ComponentModel; + using Avalonia; using Avalonia.Media.Imaging; @@ -59,16 +61,70 @@ namespace SourceGit.Models } } - public partial class TextDiff + public class TextDiffChangeBlock + { + public TextDiffChangeBlock(int startLine, int endLine) + { + StartLine = startLine; + EndLine = endLine; + } + + public int StartLine { get; set; } = 0; + public int EndLine { get; set; } = 0; + + public bool IsInRange(int line) + { + return line >= StartLine && line <= EndLine; + } + } + + public partial class TextDiff : ObservableObject { public string File { get; set; } = string.Empty; public List Lines { get; set; } = new List(); public Vector ScrollOffset { get; set; } = Vector.Zero; public int MaxLineNumber = 0; + public int CurrentChangeBlockIdx + { + get => _currentChangeBlockIdx; + set => SetProperty(ref _currentChangeBlockIdx, value); + } + public string Repo { get; set; } = null; public DiffOption Option { get; set; } = null; + public List ChangeBlocks { get; set; } = []; + + public void ProcessChangeBlocks() + { + ChangeBlocks.Clear(); + int lineIdx = 0, blockStartIdx = 0; + bool isNewBlock = true; + foreach (var line in Lines) + { + lineIdx++; + if (line.Type == Models.TextDiffLineType.Added || + line.Type == Models.TextDiffLineType.Deleted || + line.Type == Models.TextDiffLineType.None) // Empty + { + if (isNewBlock) + { + isNewBlock = false; + blockStartIdx = lineIdx; + } + } + else + { + if (!isNewBlock) + { + ChangeBlocks.Add(new TextDiffChangeBlock(blockStartIdx, lineIdx - 1)); + isNewBlock = true; + } + } + } + } + public TextDiffSelection MakeSelection(int startLine, int endLine, bool isCombined, bool isOldSide) { var rs = new TextDiffSelection(); @@ -626,6 +682,8 @@ namespace SourceGit.Models return true; } + private int _currentChangeBlockIdx = -1; // NOTE: Use -1 as "not set". + [GeneratedRegex(@"^@@ \-(\d+),?\d* \+(\d+),?\d* @@")] private static partial Regex REG_INDICATOR(); } diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 8d66a250..b2c347ba 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -54,6 +54,7 @@ M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z M0 512M1024 512M512 0M512 1024M955 323q0 23-16 39l-414 414-78 78q-16 16-39 16t-39-16l-78-78-207-207q-16-16-16-39t16-39l78-78q16-16 39-16t39 16l168 169 375-375q16-16 39-16t39 16l78 78q16 16 16 39z M416 64H768v64h-64v704h64v64H448v-64h64V512H416a224 224 0 1 1 0-448zM576 832h64V128H576v704zM416 128H512v320H416a160 160 0 0 1 0-320z + M20.2585648,2.00438474 C20.6382605,2.00472706 20.9518016,2.28716326 21.0011348,2.65328337 L21.0078899,2.75506004 L21.0038407,7.25276883 C21.0009137,8.40908568 20.1270954,9.36072944 19.0029371,9.48671858 L19.0024932,11.7464847 C19.0024932,12.9373487 18.0773316,13.9121296 16.906542,13.9912939 L16.7524932,13.9964847 L16.501,13.9963847 L16.5017549,16.7881212 C16.5017549,17.6030744 16.0616895,18.349347 15.3600767,18.7462439 L15.2057929,18.8258433 L8.57108142,21.9321389 C8.10484975,22.1504232 7.57411944,21.8450614 7.50959937,21.3535767 L7.50306874,21.2528982 L7.503,13.9963847 L7.25,13.9964847 C6.05913601,13.9964847 5.08435508,13.0713231 5.00519081,11.9005335 L5,11.7464847 L5.00043957,9.4871861 C3.92882124,9.36893736 3.08392302,8.49812196 3.0058865,7.41488149 L3,7.25086975 L3,2.75438506 C3,2.3401715 3.33578644,2.00438474 3.75,2.00438474 C4.12969577,2.00438474 4.44349096,2.28653894 4.49315338,2.6526145 L4.5,2.75438506 L4.5,7.25086975 C4.5,7.63056552 4.78215388,7.94436071 5.14822944,7.99402313 L5.25,8.00086975 L18.7512697,8.00087075 C19.1315998,8.00025031 19.4461483,7.71759877 19.4967392,7.3518545 L19.5038434,7.25019537 L19.5078902,2.75371008 C19.508263,2.33949668 19.8443515,2.00401258 20.2585648,2.00438474 Z M15.001,13.9963847 L9.003,13.9963847 L9.00306874,20.0736262 L14.5697676,17.4673619 C14.8004131,17.3593763 14.9581692,17.1431606 14.9940044,16.89581 L15.0017549,16.7881212 L15.001,13.9963847 Z M17.502,9.50038474 L6.5,9.50038474 L6.5,11.7464847 C6.5,12.1261805 6.78215388,12.4399757 7.14822944,12.4896381 L7.25,12.4964847 L16.7524932,12.4964847 C17.1321889,12.4964847 17.4459841,12.2143308 17.4956465,11.8482552 L17.5024932,11.7464847 L17.502,9.50038474 Z M24 512A488 488 0 01512 24A488 488 0 011000 512A488 488 0 01512 1000A488 488 0 0124 512zm447-325v327L243 619l51 111 300-138V187H471z M832 64h128v278l-128-146V64zm64 448L512 73 128 512H0L448 0h128l448 512h-128zm0 83V1024H640V704c0-35-29-64-64-64h-128a64 64 0 00-64 64v320H128V595l384-424 384 424z M512 0C229 0 0 229 0 512c0 283 229 512 512 512s512-229 512-512c0-283-229-512-512-512zm0 958C266 958 66 758 66 512S266 66 512 66 958 266 958 512 758 958 512 958zM192 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32zM384 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM576 416h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM832 320h-64a32 32 0 00-32 32v128h-160a32 32 0 00-32 32v32a32 32 0 0032 32h256a32 32 0 0032-32v-192a32 32 0 00-32-32zM320 544v-32a32 32 0 00-32-32H192a32 32 0 00-32 32v32a32 32 0 0032 32h96a32 32 0 0032-32zM384 576h96a32 32 0 0032-32v-32a32 32 0 00-32-32h-96a32 32 0 00-32 32v32a32 32 0 0032 32zM800 640H256a32 32 0 00-32 32v32a32 32 0 0032 32h544a32 32 0 0032-32v-32a32 32 0 00-32-32z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 6bea386d..792bc9b8 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -233,6 +233,7 @@ NEW OLD Copy + Highlighted Diff Navigation File Mode Changed Ignore Whitespace Change LFS OBJECT CHANGE diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index 87b1a6de..6e6e9fb5 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -51,6 +51,12 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _unifiedLines, value); } + public string ChangeBlockIndicator + { + get => _changeBlockIndicator; + private set => SetProperty(ref _changeBlockIndicator, value); + } + public DiffContext(string repo, Models.DiffOption option, DiffContext previous = null) { _repo = repo; @@ -73,12 +79,68 @@ namespace SourceGit.ViewModels LoadDiffContent(); } + public void PrevChange() + { + if (_content is Models.TextDiff textDiff) + { + if (textDiff.CurrentChangeBlockIdx > 0) + { + textDiff.CurrentChangeBlockIdx--; + } + else if (textDiff.ChangeBlocks.Count > 0) + { + // Force property value change and (re-)jump to first change block + textDiff.CurrentChangeBlockIdx = -1; + textDiff.CurrentChangeBlockIdx = 0; + } + } + RefreshChangeBlockIndicator(); + } + + public void NextChange() + { + if (_content is Models.TextDiff textDiff) + { + if (textDiff.CurrentChangeBlockIdx < textDiff.ChangeBlocks.Count - 1) + { + textDiff.CurrentChangeBlockIdx++; + } + else if (textDiff.ChangeBlocks.Count > 0) + { + // Force property value change and (re-)jump to last change block + textDiff.CurrentChangeBlockIdx = -1; + textDiff.CurrentChangeBlockIdx = textDiff.ChangeBlocks.Count - 1; + } + RefreshChangeBlockIndicator(); + } + } + + public void RefreshChangeBlockIndicator() + { + string curr = "-", tot = "-"; + if (_content is Models.TextDiff textDiff) + { + if (textDiff.CurrentChangeBlockIdx >= 0) + curr = (textDiff.CurrentChangeBlockIdx + 1).ToString(); + tot = (textDiff.ChangeBlocks.Count).ToString(); + } + ChangeBlockIndicator = curr + "/" + tot; + } + public void ToggleFullTextDiff() { Preference.Instance.UseFullTextDiff = !Preference.Instance.UseFullTextDiff; LoadDiffContent(); } + public void ToggleHighlightedDiffNavigation() + { + Preference.Instance.EnableChangeBlocks = !Preference.Instance.EnableChangeBlocks; + if (_content is Models.TextDiff textDiff) + textDiff.CurrentChangeBlockIdx = -1; + RefreshChangeBlockIndicator(); + } + public void IncrUnified() { UnifiedLines = _unifiedLines + 1; @@ -91,6 +153,12 @@ namespace SourceGit.ViewModels LoadDiffContent(); } + public void ToggleTwoSideDiff() + { + Preference.Instance.UseSideBySideDiff = !Preference.Instance.UseSideBySideDiff; + RefreshChangeBlockIndicator(); + } + public void OpenExternalMergeTool() { var toolType = Preference.Instance.ExternalMergeToolType; @@ -217,7 +285,9 @@ namespace SourceGit.ViewModels FileModeChange = latest.FileModeChange; Content = rs; IsTextDiff = rs is Models.TextDiff; - }); + + RefreshChangeBlockIndicator(); + }); }); } @@ -281,6 +351,7 @@ namespace SourceGit.ViewModels private string _title; private string _fileModeChange = string.Empty; private int _unifiedLines = 4; + private string _changeBlockIndicator = "-/-"; private bool _isTextDiff = false; private bool _ignoreWhitespace = false; private object _content = null; diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 1ccee4cd..8d09272f 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -206,6 +206,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _useFullTextDiff, value); } + public bool EnableChangeBlocks + { + get => _enableChangeBlocks; + set => SetProperty(ref _enableChangeBlocks, value); + } + public Models.ChangeViewMode UnstagedChangeViewMode { get => _unstagedChangeViewMode; @@ -614,6 +620,7 @@ namespace SourceGit.ViewModels private bool _enableDiffViewWordWrap = false; private bool _showHiddenSymbolsInDiffView = false; private bool _useFullTextDiff = false; + private bool _enableChangeBlocks = false; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/ViewModels/TwoSideTextDiff.cs b/src/ViewModels/TwoSideTextDiff.cs index 3fb1e63b..493174e0 100644 --- a/src/ViewModels/TwoSideTextDiff.cs +++ b/src/ViewModels/TwoSideTextDiff.cs @@ -45,10 +45,43 @@ namespace SourceGit.ViewModels FillEmptyLines(); + ProcessChangeBlocks(); + if (previous != null && previous.File == File) _syncScrollOffset = previous._syncScrollOffset; } + public List ChangeBlocks { get; set; } = []; + + public void ProcessChangeBlocks() + { + ChangeBlocks.Clear(); + int lineIdx = 0, blockStartIdx = 0; + bool isNewBlock = true; + foreach (var line in Old) // NOTE: Same block size in both Old and New lines. + { + lineIdx++; + if (line.Type == Models.TextDiffLineType.Added || + line.Type == Models.TextDiffLineType.Deleted || + line.Type == Models.TextDiffLineType.None) // Empty + { + if (isNewBlock) + { + isNewBlock = false; + blockStartIdx = lineIdx; + } + } + else + { + if (!isNewBlock) + { + ChangeBlocks.Add(new Models.TextDiffChangeBlock(blockStartIdx, lineIdx - 1)); + isNewBlock = true; + } + } + } + } + public void ConvertsToCombinedRange(Models.TextDiff combined, ref int startLine, ref int endLine, bool isOldSide) { endLine = Math.Min(endLine, combined.Lines.Count - 1); diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index e0627ad8..bf7b0339 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -34,6 +34,15 @@ + + + + + + + + + + + + + - - - + + + - + - - + + + +
+ + + +