Compare commits

..

No commits in common. "4b6bb70f20861ac9e52a300767f0d801425a04d7" and "a824adf6d314fa12e68505051e3248cb523c094c" have entirely different histories.

16 changed files with 260 additions and 215 deletions

View file

@ -47,7 +47,7 @@
## Translation Status ## 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.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.14%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.14%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.57%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.14%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-98.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-99.14%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.57%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 ## How to Use

View file

@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F45A
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{67B6D05F-A000-40BA-ADB4-C9065F880D7B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{67B6D05F-A000-40BA-ADB4-C9065F880D7B}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\ci.yml = .github\workflows\ci.yml .github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\package.yml = .github\workflows\package.yml .github\workflows\package.yml = .github\workflows\package.yml
.github\workflows\release.yml = .github\workflows\release.yml .github\workflows\release.yml = .github\workflows\release.yml

View file

@ -60,13 +60,15 @@
</details> </details>
### ru_RU.axaml: 100.00% ### ru_RU.axaml: 99.57%
<details> <details>
<summary>Missing Keys</summary> <summary>Missing Keys</summary>
- Text.Repository.FilterCommits.Default
- Text.Repository.FilterCommits.Exclude
- Text.Repository.FilterCommits.Include
</details> </details>

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Avalonia.Collections; using Avalonia.Collections;
using Avalonia.Threading;
namespace SourceGit.Models namespace SourceGit.Models
{ {
@ -217,26 +218,10 @@ namespace SourceGit.Models
return true; return true;
} }
public void RemoveChildrenBranchFilters(string pattern)
{
var dirty = new List<Filter>();
var prefix = $"{pattern}/";
foreach (var filter in HistoriesFilters)
{
if (filter.Type == FilterType.Tag)
continue;
if (filter.Pattern.StartsWith(prefix, StringComparison.Ordinal))
dirty.Add(filter);
}
foreach (var filter in dirty)
HistoriesFilters.Remove(filter);
}
public string BuildHistoriesFilter() public string BuildHistoriesFilter()
{ {
var builder = new StringBuilder();
var excludedBranches = new List<string>(); var excludedBranches = new List<string>();
var excludedRemotes = new List<string>(); var excludedRemotes = new List<string>();
var excludedTags = new List<string>(); var excludedTags = new List<string>();
@ -291,11 +276,14 @@ namespace SourceGit.Models
} }
} }
bool hasIncluded = includedBranches.Count > 0 || includedRemotes.Count > 0 || includedTags.Count > 0; foreach (var b in excludedBranches)
bool hasExcluded = excludedBranches.Count > 0 || excludedRemotes.Count > 0 || excludedTags.Count > 0; {
builder.Append("--exclude=");
builder.Append(b);
builder.Append(' ');
}
var builder = new StringBuilder(); if (includedBranches.Count > 0)
if (hasIncluded)
{ {
foreach (var b in includedBranches) foreach (var b in includedBranches)
{ {
@ -303,14 +291,44 @@ namespace SourceGit.Models
builder.Append(b); builder.Append(b);
builder.Append(' '); builder.Append(' ');
} }
}
else if (excludedBranches.Count > 0 || (includedRemotes.Count == 0 && includedTags.Count == 0))
{
builder.Append("--exclude=HEA[D] ");
builder.Append("--branches ");
}
foreach (var r in excludedRemotes)
{
builder.Append("--exclude=");
builder.Append(r);
builder.Append(' ');
}
if (includedRemotes.Count > 0)
{
foreach (var r in includedRemotes) foreach (var r in includedRemotes)
{ {
builder.Append("--remotes="); builder.Append("--remotes=");
builder.Append(r); builder.Append(r);
builder.Append(' '); builder.Append(' ');
} }
}
else if (excludedRemotes.Count > 0 || (includedBranches.Count == 0 && includedTags.Count == 0))
{
builder.Append("--exclude=origin/HEA[D] ");
builder.Append("--remotes ");
}
foreach (var t in excludedTags)
{
builder.Append("--exclude=");
builder.Append(t);
builder.Append(' ');
}
if (includedTags.Count > 0)
{
foreach (var t in includedTags) foreach (var t in includedTags)
{ {
builder.Append("--tags="); builder.Append("--tags=");
@ -318,42 +336,8 @@ namespace SourceGit.Models
builder.Append(' '); builder.Append(' ');
} }
} }
else if (hasExcluded) else if (excludedTags.Count > 0 || (includedBranches.Count == 0 && includedRemotes.Count == 0))
{ {
if (excludedBranches.Count > 0)
{
foreach (var b in excludedBranches)
{
builder.Append("--exclude=");
builder.Append(b);
builder.Append(' ');
}
}
builder.Append("--exclude=HEA[D] --branches ");
if (excludedRemotes.Count > 0)
{
foreach (var r in excludedRemotes)
{
builder.Append("--exclude=");
builder.Append(r);
builder.Append(' ');
}
}
builder.Append("--exclude=origin/HEA[D] --remotes ");
if (excludedTags.Count > 0)
{
foreach (var t in excludedTags)
{
builder.Append("--exclude=");
builder.Append(t);
builder.Append(' ');
}
}
builder.Append("--tags "); builder.Append("--tags ");
} }

View file

@ -82,11 +82,12 @@
<x:String x:Key="Text.Checkout.Commit" xml:space="preserve">Checkout ce commit</x:String> <x:String x:Key="Text.Checkout.Commit" xml:space="preserve">Checkout ce commit</x:String>
<x:String x:Key="Text.Checkout.Commit.Target" xml:space="preserve">Commit :</x:String> <x:String x:Key="Text.Checkout.Commit.Target" xml:space="preserve">Commit :</x:String>
<x:String x:Key="Text.Checkout.Commit.Warning" xml:space="preserve">Avertissement: un checkout vers un commit aboutiera vers un HEAD détaché</x:String> <x:String x:Key="Text.Checkout.Commit.Warning" xml:space="preserve">Avertissement: un checkout vers un commit aboutiera vers un HEAD détaché</x:String>
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branche :</x:String> <x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branche:</x:String>
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Changements locaux :</x:String> <x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Changements locaux :</x:String>
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Annuler</x:String> <x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Annuler</x:String>
<x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">Ne rien faire</x:String> <x:String x:Key="Text.Checkout.LocalChanges.DoNothing" xml:space="preserve">Ne rien faire</x:String>
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">Mettre en stash et réappliquer</x:String> <x:String x:Key="Text.Checkout.LocalChanges.StashAndReply" xml:space="preserve">Mettre en stash et réappliquer</x:String>
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branche :</x:String>
<x:String x:Key="Text.CherryPick" xml:space="preserve">Cherry-Pick de ce commit</x:String> <x:String x:Key="Text.CherryPick" xml:space="preserve">Cherry-Pick de ce commit</x:String>
<x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">Commit :</x:String> <x:String x:Key="Text.CherryPick.Commit" xml:space="preserve">Commit :</x:String>
<x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">Commit tous les changements</x:String> <x:String x:Key="Text.CherryPick.CommitChanges" xml:space="preserve">Commit tous les changements</x:String>
@ -101,6 +102,7 @@
<x:String x:Key="Text.Clone.LocalName.Placeholder" xml:space="preserve">Nom de dépôt. Optionnel.</x:String> <x:String x:Key="Text.Clone.LocalName.Placeholder" xml:space="preserve">Nom de dépôt. Optionnel.</x:String>
<x:String x:Key="Text.Clone.ParentFolder" xml:space="preserve">Dossier parent :</x:String> <x:String x:Key="Text.Clone.ParentFolder" xml:space="preserve">Dossier parent :</x:String>
<x:String x:Key="Text.Clone.RemoteURL" xml:space="preserve">URL du dépôt :</x:String> <x:String x:Key="Text.Clone.RemoteURL" xml:space="preserve">URL du dépôt :</x:String>
<x:String x:Key="Text.Clone" xml:space="preserve">Cloner le dépôt distant</x:String>
<x:String x:Key="Text.Close" xml:space="preserve">FERMER</x:String> <x:String x:Key="Text.Close" xml:space="preserve">FERMER</x:String>
<x:String x:Key="Text.CodeEditor" xml:space="preserve">Éditeur</x:String> <x:String x:Key="Text.CodeEditor" xml:space="preserve">Éditeur</x:String>
<x:String x:Key="Text.CommitCM.Checkout" xml:space="preserve">Changer de commit</x:String> <x:String x:Key="Text.CommitCM.Checkout" xml:space="preserve">Changer de commit</x:String>
@ -535,6 +537,7 @@
<x:String x:Key="Text.Repository.ClearAllCommitsFilter" xml:space="preserve">Tout effacer</x:String> <x:String x:Key="Text.Repository.ClearAllCommitsFilter" xml:space="preserve">Tout effacer</x:String>
<x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configurer ce repository</x:String> <x:String x:Key="Text.Repository.Configure" xml:space="preserve">Configurer ce repository</x:String>
<x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUER</x:String> <x:String x:Key="Text.Repository.Continue" xml:space="preserve">CONTINUER</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Ouvrir dans l'explorateur Windows</x:String>
<x:String x:Key="Text.Repository.CustomActions.Empty" xml:space="preserve">Pas d'actions personnalisées</x:String> <x:String x:Key="Text.Repository.CustomActions.Empty" xml:space="preserve">Pas d'actions personnalisées</x:String>
<x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">Activer l'option '--reflog'</x:String> <x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">Activer l'option '--reflog'</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Ouvrir dans l'explorateur de fichiers</x:String> <x:String x:Key="Text.Repository.Explore" xml:space="preserve">Ouvrir dans l'explorateur de fichiers</x:String>
@ -581,6 +584,7 @@
<x:String x:Key="Text.Save" xml:space="preserve">SAUVEGARDER</x:String> <x:String x:Key="Text.Save" xml:space="preserve">SAUVEGARDER</x:String>
<x:String x:Key="Text.SaveAs" xml:space="preserve">Sauvegarder en tant que...</x:String> <x:String x:Key="Text.SaveAs" xml:space="preserve">Sauvegarder en tant que...</x:String>
<x:String x:Key="Text.SaveAsPatchSuccess" xml:space="preserve">Le patch a été sauvegardé !</x:String> <x:String x:Key="Text.SaveAsPatchSuccess" xml:space="preserve">Le patch a été sauvegardé !</x:String>
<x:String x:Key="Text.SelfUpdate" xml:space="preserve">Vérifier les mises à jour...</x:String>
<x:String x:Key="Text.ScanRepositories.RootDir" xml:space="preserve">Dossier racine :</x:String> <x:String x:Key="Text.ScanRepositories.RootDir" xml:space="preserve">Dossier racine :</x:String>
<x:String x:Key="Text.SelfUpdate" xml:space="preserve">Rechercher des mises à jour...</x:String> <x:String x:Key="Text.SelfUpdate" xml:space="preserve">Rechercher des mises à jour...</x:String>
<x:String x:Key="Text.SelfUpdate.Available" xml:space="preserve">Une nouvelle version du logiciel est disponible :</x:String> <x:String x:Key="Text.SelfUpdate.Available" xml:space="preserve">Une nouvelle version du logiciel est disponible :</x:String>

View file

@ -176,6 +176,7 @@
<x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repositório</x:String> <x:String x:Key="Text.Configure.CustomAction.Scope.Repository" xml:space="preserve">Repositório</x:String>
<x:String x:Key="Text.Configure.Email" xml:space="preserve">Endereço de email</x:String> <x:String x:Key="Text.Configure.Email" xml:space="preserve">Endereço de email</x:String>
<x:String x:Key="Text.Configure.Email.Placeholder" xml:space="preserve">Endereço de email</x:String> <x:String x:Key="Text.Configure.Email.Placeholder" xml:space="preserve">Endereço de email</x:String>
<x:String x:Key="Text.Configure.Email" xml:space="preserve">Endereço de Email</x:String>
<x:String x:Key="Text.Configure.Git.AutoFetch" xml:space="preserve">Buscar remotos automaticamente</x:String> <x:String x:Key="Text.Configure.Git.AutoFetch" xml:space="preserve">Buscar remotos automaticamente</x:String>
<x:String x:Key="Text.Configure.Git.AutoFetchIntervalSuffix" xml:space="preserve">Minuto(s)</x:String> <x:String x:Key="Text.Configure.Git.AutoFetchIntervalSuffix" xml:space="preserve">Minuto(s)</x:String>
<x:String x:Key="Text.Configure.Git.DefaultRemote" xml:space="preserve">Remoto padrão</x:String> <x:String x:Key="Text.Configure.Git.DefaultRemote" xml:space="preserve">Remoto padrão</x:String>

View file

@ -62,7 +62,7 @@
<x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">Поток Git - Завершение ${0}$</x:String> <x:String x:Key="Text.BranchCM.Finish" xml:space="preserve">Поток Git - Завершение ${0}$</x:String>
<x:String x:Key="Text.BranchCM.Merge" xml:space="preserve">Слить ${0}$ в ${1}$...</x:String> <x:String x:Key="Text.BranchCM.Merge" xml:space="preserve">Слить ${0}$ в ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Pull" xml:space="preserve">Забрать ${0}$</x:String> <x:String x:Key="Text.BranchCM.Pull" xml:space="preserve">Забрать ${0}$</x:String>
<x:String x:Key="Text.BranchCM.PullInto" xml:space="preserve">Забрать ${0}$ в ${1}$...</x:String> <x:String x:Key="Text.BranchCM.PullInto" xml:space="preserve">Перетащить ${0}$ в ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Push" xml:space="preserve">Выложить ${0}$</x:String> <x:String x:Key="Text.BranchCM.Push" xml:space="preserve">Выложить ${0}$</x:String>
<x:String x:Key="Text.BranchCM.Rebase" xml:space="preserve">Переместить ${0}$ на ${1}$...</x:String> <x:String x:Key="Text.BranchCM.Rebase" xml:space="preserve">Переместить ${0}$ на ${1}$...</x:String>
<x:String x:Key="Text.BranchCM.Rename" xml:space="preserve">Переименовать ${0}$...</x:String> <x:String x:Key="Text.BranchCM.Rename" xml:space="preserve">Переименовать ${0}$...</x:String>
@ -213,7 +213,7 @@
<x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Вид:</x:String> <x:String x:Key="Text.CreateTag.Type" xml:space="preserve">Вид:</x:String>
<x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">Аннотированный</x:String> <x:String x:Key="Text.CreateTag.Type.Annotated" xml:space="preserve">Аннотированный</x:String>
<x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">Лёгкий</x:String> <x:String x:Key="Text.CreateTag.Type.Lightweight" xml:space="preserve">Лёгкий</x:String>
<x:String x:Key="Text.CtrlClickTip" xml:space="preserve">Удерживайте Ctrl, чтобы начать сразу</x:String> <x:String x:Key="Text.CtrlClickTip" xml:space="preserve">Удерживайте Ctrl, чтобы начать непосредственно</x:String>
<x:String x:Key="Text.Cut" xml:space="preserve">Вырезать</x:String> <x:String x:Key="Text.Cut" xml:space="preserve">Вырезать</x:String>
<x:String x:Key="Text.DeleteBranch" xml:space="preserve">Удалить ветку</x:String> <x:String x:Key="Text.DeleteBranch" xml:space="preserve">Удалить ветку</x:String>
<x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">Ветка:</x:String> <x:String x:Key="Text.DeleteBranch.Branch" xml:space="preserve">Ветка:</x:String>
@ -368,11 +368,11 @@
<x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">Подготовить все изменения и зафиксировать</x:String> <x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">Подготовить все изменения и зафиксировать</x:String>
<x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">Создать новую ветку на основе выбранной ветки</x:String> <x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">Создать новую ветку на основе выбранной ветки</x:String>
<x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">Отклонить выбранные изменения</x:String> <x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">Отклонить выбранные изменения</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Fetch" xml:space="preserve">Извлечение, запускается сразу</x:String> <x:String x:Key="Text.Hotkeys.Repo.Fetch" xml:space="preserve">Извлечение, запускается непосредственно</x:String>
<x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">Режим доски (по-умолчанию)</x:String> <x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">Режим доски (по-умолчанию)</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">Принудительно перезагрузить этот хранилище</x:String> <x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">Принудительно перезагрузить этот хранилище</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">Забрать, запускается сразу</x:String> <x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">Забрать, запускается непосредственно</x:String>
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">Выложить, запускается сразу</x:String> <x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">Выложить, запускается непосредственно</x:String>
<x:String x:Key="Text.Hotkeys.Repo.StageOrUnstageSelected" xml:space="preserve">Подготовленные/Неподготовленные выбранные изменения</x:String> <x:String x:Key="Text.Hotkeys.Repo.StageOrUnstageSelected" xml:space="preserve">Подготовленные/Неподготовленные выбранные изменения</x:String>
<x:String x:Key="Text.Hotkeys.Repo.OpenSearchCommits" xml:space="preserve">Режим поиска фиксаций</x:String> <x:String x:Key="Text.Hotkeys.Repo.OpenSearchCommits" xml:space="preserve">Режим поиска фиксаций</x:String>
<x:String x:Key="Text.Hotkeys.Repo.ViewChanges" xml:space="preserve">Переключить на «Изменения»</x:String> <x:String x:Key="Text.Hotkeys.Repo.ViewChanges" xml:space="preserve">Переключить на «Изменения»</x:String>
@ -544,10 +544,6 @@
<x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">Разрешить опцию --reflog</x:String> <x:String x:Key="Text.Repository.EnableReflog" xml:space="preserve">Разрешить опцию --reflog</x:String>
<x:String x:Key="Text.Repository.Explore" xml:space="preserve">Открыть в файловом менеджере</x:String> <x:String x:Key="Text.Repository.Explore" xml:space="preserve">Открыть в файловом менеджере</x:String>
<x:String x:Key="Text.Repository.Filter" xml:space="preserve">Поиск веток, меток и подмодулей</x:String> <x:String x:Key="Text.Repository.Filter" xml:space="preserve">Поиск веток, меток и подмодулей</x:String>
<x:String x:Key="Text.Repository.FilterCommits.Default" xml:space="preserve">Не установлен (По-умолчанию)</x:String>
<x:String x:Key="Text.Repository.FilterCommits.Exclude" xml:space="preserve">Скрыть в графе фиксации</x:String>
<x:String x:Key="Text.Repository.FilterCommits.Include" xml:space="preserve">Фильтр в графе фиксации</x:String>
<x:String x:Key="Text.Repository.FilterCommits.Prefix" xml:space="preserve">ОТФИЛЬТРОВАНО:</x:String>
<x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">ЛОКАЛЬНЫЕ ВЕТКИ</x:String> <x:String x:Key="Text.Repository.LocalBranches" xml:space="preserve">ЛОКАЛЬНЫЕ ВЕТКИ</x:String>
<x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Навигация по заголовку</x:String> <x:String x:Key="Text.Repository.NavigateToCurrentHead" xml:space="preserve">Навигация по заголовку</x:String>
<x:String x:Key="Text.Repository.FirstParentFilterToggle" xml:space="preserve">Включить опцию --first-parent</x:String> <x:String x:Key="Text.Repository.FirstParentFilterToggle" xml:space="preserve">Включить опцию --first-parent</x:String>

View file

@ -37,17 +37,17 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.1" /> <PackageReference Include="Avalonia" Version="11.1.4" />
<PackageReference Include="Avalonia.Desktop" Version="11.2.1" /> <PackageReference Include="Avalonia.Desktop" Version="11.1.4" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.1" /> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.1" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.4" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.2.1" Condition="'$(Configuration)' == 'Debug'" /> <PackageReference Include="Avalonia.Diagnostics" Version="11.1.4" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" /> <PackageReference Include="Avalonia.AvaloniaEdit" Version="11.1.0" />
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" /> <PackageReference Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-rc4.5" /> <PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" Version="2.0.0-rc3.3" />
<PackageReference Include="TextMateSharp" Version="1.0.64" /> <PackageReference Include="TextMateSharp" Version="1.0.63" />
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.64" /> <PackageReference Include="TextMateSharp.Grammars" Version="1.0.63" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -64,8 +64,8 @@ namespace SourceGit.ViewModels
CallUIThread(() => CallUIThread(() =>
{ {
var b = _repo.Branches.Find(x => x.IsLocal && x.Name == Branch); var b = _repo.Branches.Find(x => x.IsLocal && x.Name == Branch);
if (b != null && _repo.HistoriesFilterMode == Models.FilterMode.Included) if (b != null)
_repo.Settings.UpdateHistoriesFilter(b.FullName, Models.FilterType.LocalBranch, Models.FilterMode.Included); _repo.UpdateHistoriesFilterAfterCheckout(b);
_repo.MarkBranchesDirtyManually(); _repo.MarkBranchesDirtyManually();
_repo.SetWatcherEnabled(true); _repo.SetWatcherEnabled(true);

View file

@ -125,8 +125,14 @@ namespace SourceGit.ViewModels
CallUIThread(() => CallUIThread(() =>
{ {
if (CheckoutAfterCreated && _repo.HistoriesFilterMode == Models.FilterMode.Included) if (CheckoutAfterCreated)
_repo.Settings.UpdateHistoriesFilter($"refs/heads/{_name}", Models.FilterType.LocalBranch, Models.FilterMode.Included); {
_repo.UpdateHistoriesFilterAfterCheckout(new Models.Branch()
{
FullName = $"refs/heads/{_name}",
Upstream = BasedOn is Models.Branch { IsLocal: false } remoteBranch ? remoteBranch.FullName : string.Empty,
});
}
_repo.MarkBranchesDirtyManually(); _repo.MarkBranchesDirtyManually();
_repo.SetWatcherEnabled(true); _repo.SetWatcherEnabled(true);

View file

@ -46,12 +46,6 @@ namespace SourceGit.ViewModels
get => _settings; get => _settings;
} }
public Models.FilterMode HistoriesFilterMode
{
get => _historiesFilterMode;
private set => SetProperty(ref _historiesFilterMode, value);
}
public bool HasAllowedSignersFile public bool HasAllowedSignersFile
{ {
get => _hasAllowedSignersFile; get => _hasAllowedSignersFile;
@ -389,11 +383,6 @@ namespace SourceGit.ViewModels
App.RaiseException(string.Empty, $"Failed to start watcher for repository: '{_fullpath}'. You may need to press 'F5' to refresh repository manually!\n\nReason: {ex.Message}"); App.RaiseException(string.Empty, $"Failed to start watcher for repository: '{_fullpath}'. You may need to press 'F5' to refresh repository manually!\n\nReason: {ex.Message}");
} }
if (_settings.HistoriesFilters.Count > 0)
_historiesFilterMode = _settings.HistoriesFilters[0].Mode;
else
_historiesFilterMode = Models.FilterMode.None;
_histories = new Histories(this); _histories = new Histories(this);
_workingCopy = new WorkingCopy(this); _workingCopy = new WorkingCopy(this);
_stashesPage = new StashesPage(this); _stashesPage = new StashesPage(this);
@ -418,7 +407,6 @@ namespace SourceGit.ViewModels
// Ignore // Ignore
} }
_settings = null; _settings = null;
_historiesFilterMode = Models.FilterMode.None;
_autoFetchTimer.Dispose(); _autoFetchTimer.Dispose();
_autoFetchTimer = null; _autoFetchTimer = null;
@ -682,92 +670,49 @@ namespace SourceGit.ViewModels
public void ClearHistoriesFilter() public void ClearHistoriesFilter()
{ {
_settings.HistoriesFilters.Clear(); _settings.HistoriesFilters.Clear();
HistoriesFilterMode = Models.FilterMode.None;
ResetBranchTreeFilterMode(LocalBranchTrees); ResetBranchTreeFilterMode(LocalBranchTrees);
ResetBranchTreeFilterMode(RemoteBranchTrees); ResetBranchTreeFilterMode(RemoteBranchTrees);
ResetTagFilterMode(); ResetTagFilterMode();
Task.Run(RefreshCommits); Task.Run(RefreshCommits);
} }
public void SetTagFilterMode(Models.Tag tag, Models.FilterMode mode) public void MarkHistoriesFilterDirty()
{ {
var changed = _settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode); UpdateBranchTreeFilterMode(LocalBranchTrees, true);
if (changed) UpdateBranchTreeFilterMode(RemoteBranchTrees, false);
{ UpdateTagFilterMode();
if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0) Task.Run(RefreshCommits);
HistoriesFilterMode = mode;
RefreshHistoriesFilters();
}
} }
public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode) public void UpdateHistoriesFilterAfterCheckout(Models.Branch local)
{ {
var isLocal = node.Path.StartsWith("refs/heads/", StringComparison.Ordinal); var hasIncludedBranch = false;
var tree = isLocal ? _localBranchTrees : _remoteBranchTrees;
if (node.Backend is Models.Branch branch)
{
var type = isLocal ? Models.FilterType.LocalBranch : Models.FilterType.RemoteBranch;
var changed = _settings.UpdateHistoriesFilter(node.Path, type, mode);
if (!changed)
return;
if (isLocal && !string.IsNullOrEmpty(branch.Upstream) && mode != Models.FilterMode.Excluded)
{
var upstream = branch.Upstream;
var canUpdateUpstream = true;
foreach (var filter in _settings.HistoriesFilters) foreach (var filter in _settings.HistoriesFilters)
{ {
bool matched = false; if (filter.Type == Models.FilterType.LocalBranch)
if (filter.Type == Models.FilterType.RemoteBranch)
matched = filter.Pattern.Equals(upstream, StringComparison.Ordinal);
else if (filter.Type == Models.FilterType.RemoteBranchFolder)
matched = upstream.StartsWith(filter.Pattern, StringComparison.Ordinal);
if (matched && filter.Mode == Models.FilterMode.Excluded)
{ {
canUpdateUpstream = false; if (filter.Pattern.Equals(local.FullName, StringComparison.Ordinal))
break;
}
}
if (canUpdateUpstream)
_settings.UpdateHistoriesFilter(upstream, Models.FilterType.RemoteBranch, mode);
}
}
else
{
var type = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder;
var changed = _settings.UpdateHistoriesFilter(node.Path, type, mode);
if (!changed)
return; return;
_settings.RemoveChildrenBranchFilters(node.Path); hasIncludedBranch |= filter.Mode == Models.FilterMode.Included;
}
else if (filter.Type == Models.FilterType.LocalBranchFolder)
{
if (local.FullName.StartsWith(filter.Pattern, StringComparison.Ordinal))
return;
hasIncludedBranch |= filter.Mode == Models.FilterMode.Included;
}
else if (filter.Type == Models.FilterType.RemoteBranch || filter.Type == Models.FilterType.RemoteBranchFolder)
{
hasIncludedBranch |= filter.Mode == Models.FilterMode.Included;
}
} }
var parentType = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder; if (!hasIncludedBranch)
var cur = node; return;
do
{
var lastSepIdx = cur.Path.LastIndexOf('/');
if (lastSepIdx <= 0)
break;
var parentPath = cur.Path.Substring(0, lastSepIdx); _settings.UpdateHistoriesFilter(local.FullName, Models.FilterType.LocalBranch, Models.FilterMode.Included);
var parent = FindBranchNode(tree, parentPath);
if (parent == null)
break;
_settings.UpdateHistoriesFilter(parent.Path, parentType, Models.FilterMode.None);
cur = parent;
} while (true);
if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0)
HistoriesFilterMode = mode;
RefreshHistoriesFilters();
} }
public void StashAll(bool autoStart) public void StashAll(bool autoStart)
@ -2078,14 +2023,6 @@ namespace SourceGit.ViewModels
return visible; return visible;
} }
private void RefreshHistoriesFilters()
{
UpdateBranchTreeFilterMode(LocalBranchTrees, true);
UpdateBranchTreeFilterMode(RemoteBranchTrees, false);
UpdateTagFilterMode();
Task.Run(RefreshCommits);
}
private void UpdateBranchTreeFilterMode(List<BranchTreeNode> nodes, bool isLocal) private void UpdateBranchTreeFilterMode(List<BranchTreeNode> nodes, bool isLocal)
{ {
foreach (var node in nodes) foreach (var node in nodes)
@ -2124,24 +2061,6 @@ namespace SourceGit.ViewModels
tag.FilterMode = Models.FilterMode.None; tag.FilterMode = Models.FilterMode.None;
} }
private BranchTreeNode FindBranchNode(List<BranchTreeNode> nodes, string path)
{
foreach (var node in nodes)
{
if (node.Path.Equals(path, StringComparison.Ordinal))
return node;
if (path.StartsWith(node.Path, StringComparison.Ordinal))
{
var founded = FindBranchNode(node.Children, path);
if (founded != null)
return founded;
}
}
return null;
}
private void UpdateCurrentRevisionFilesForSearchSuggestion() private void UpdateCurrentRevisionFilesForSearchSuggestion()
{ {
_revisionFiles.Clear(); _revisionFiles.Clear();
@ -2205,7 +2124,6 @@ namespace SourceGit.ViewModels
private string _fullpath = string.Empty; private string _fullpath = string.Empty;
private string _gitDir = string.Empty; private string _gitDir = string.Empty;
private Models.RepositorySettings _settings = null; private Models.RepositorySettings _settings = null;
private Models.FilterMode _historiesFilterMode = Models.FilterMode.None;
private bool _hasAllowedSignersFile = false; private bool _hasAllowedSignersFile = false;
private Models.Watcher _watcher = null; private Models.Watcher _watcher = null;

View file

@ -130,7 +130,7 @@ namespace SourceGit.Views
if (c != null) if (c != null)
{ {
ToolTip.SetTip(ctl, c); ToolTip.SetTip(ctl, c);
ToolTip.SetIsOpen(ctl, ctl.IsPointerOver); ToolTip.SetIsOpen(ctl, true);
} }
} }
} }

View file

@ -1,3 +1,6 @@
using System;
using System.Collections.Generic;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
@ -79,7 +82,7 @@ namespace SourceGit.Views
unset.Header = App.Text("Repository.FilterCommits.Default"); unset.Header = App.Text("Repository.FilterCommits.Default");
unset.Click += (_, ev) => unset.Click += (_, ev) =>
{ {
repo.SetTagFilterMode(tag, Models.FilterMode.None); UpdateTagFilterMode(repo, tag, Models.FilterMode.None);
ev.Handled = true; ev.Handled = true;
}; };
@ -93,7 +96,7 @@ namespace SourceGit.Views
include.IsEnabled = mode != Models.FilterMode.Included; include.IsEnabled = mode != Models.FilterMode.Included;
include.Click += (_, ev) => include.Click += (_, ev) =>
{ {
repo.SetTagFilterMode(tag, Models.FilterMode.Included); UpdateTagFilterMode(repo, tag, Models.FilterMode.Included);
ev.Handled = true; ev.Handled = true;
}; };
@ -103,7 +106,7 @@ namespace SourceGit.Views
exclude.IsEnabled = mode != Models.FilterMode.Excluded; exclude.IsEnabled = mode != Models.FilterMode.Excluded;
exclude.Click += (_, ev) => exclude.Click += (_, ev) =>
{ {
repo.SetTagFilterMode(tag, Models.FilterMode.Excluded); UpdateTagFilterMode(repo, tag, Models.FilterMode.Excluded);
ev.Handled = true; ev.Handled = true;
}; };
@ -120,7 +123,7 @@ namespace SourceGit.Views
unset.Header = App.Text("Repository.FilterCommits.Default"); unset.Header = App.Text("Repository.FilterCommits.Default");
unset.Click += (_, ev) => unset.Click += (_, ev) =>
{ {
repo.SetBranchFilterMode(node, Models.FilterMode.None); UpdateBranchFilterMode(repo, node, Models.FilterMode.None);
ev.Handled = true; ev.Handled = true;
}; };
@ -134,7 +137,7 @@ namespace SourceGit.Views
include.IsEnabled = mode != Models.FilterMode.Included; include.IsEnabled = mode != Models.FilterMode.Included;
include.Click += (_, ev) => include.Click += (_, ev) =>
{ {
repo.SetBranchFilterMode(node, Models.FilterMode.Included); UpdateBranchFilterMode(repo, node, Models.FilterMode.Included);
ev.Handled = true; ev.Handled = true;
}; };
@ -144,7 +147,7 @@ namespace SourceGit.Views
exclude.IsEnabled = mode != Models.FilterMode.Excluded; exclude.IsEnabled = mode != Models.FilterMode.Excluded;
exclude.Click += (_, ev) => exclude.Click += (_, ev) =>
{ {
repo.SetBranchFilterMode(node, Models.FilterMode.Excluded); UpdateBranchFilterMode(repo, node, Models.FilterMode.Excluded);
ev.Handled = true; ev.Handled = true;
}; };
@ -161,6 +164,113 @@ namespace SourceGit.Views
menu.Open(button); menu.Open(button);
e.Handled = true; e.Handled = true;
} }
private void UpdateTagFilterMode(ViewModels.Repository repo, Models.Tag tag, Models.FilterMode mode)
{
var changed = repo.Settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode);
repo.MarkHistoriesFilterDirty();
}
private void UpdateBranchFilterMode(ViewModels.Repository repo, ViewModels.BranchTreeNode node, Models.FilterMode mode)
{
var isLocal = node.Path.StartsWith("refs/heads/", StringComparison.Ordinal);
var type = isLocal ? Models.FilterType.LocalBranch : Models.FilterType.RemoteBranch;
var tree = isLocal ? repo.LocalBranchTrees : repo.RemoteBranchTrees;
if (node.Backend is Models.Branch branch)
{
var changed = repo.Settings.UpdateHistoriesFilter(node.Path, type, mode);
if (!changed)
return;
// Try to update its upstream.
if (isLocal && !string.IsNullOrEmpty(branch.Upstream) && mode != Models.FilterMode.Excluded)
{
var upstream = branch.Upstream;
var canUpdateUpstream = true;
foreach (var filter in repo.Settings.HistoriesFilters)
{
bool matched = false;
if (filter.Type == Models.FilterType.RemoteBranch)
matched = filter.Pattern.Equals(upstream, StringComparison.Ordinal);
else if (filter.Type == Models.FilterType.RemoteBranchFolder)
matched = upstream.StartsWith(filter.Pattern, StringComparison.Ordinal);
if (matched && filter.Mode == Models.FilterMode.Excluded)
{
canUpdateUpstream = false;
break;
}
}
if (canUpdateUpstream)
repo.Settings.UpdateHistoriesFilter(upstream, Models.FilterType.RemoteBranch, mode);
}
}
else
{
var changed = repo.Settings.UpdateHistoriesFilter(node.Path, isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder, mode);
if (!changed)
return;
ResetChildrenBranchNodeFilterMode(repo, node, isLocal);
}
var parentType = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder;
var cur = node;
do
{
var lastSepIdx = cur.Path.LastIndexOf('/');
if (lastSepIdx <= 0)
break;
var parentPath = cur.Path.Substring(0, lastSepIdx);
var parent = FindBranchNode(tree, parentPath);
if (parent == null)
break;
repo.Settings.UpdateHistoriesFilter(parent.Path, parentType, Models.FilterMode.None);
cur = parent;
} while (true);
repo.MarkHistoriesFilterDirty();
}
private void ResetChildrenBranchNodeFilterMode(ViewModels.Repository repo, ViewModels.BranchTreeNode node, bool isLocal)
{
foreach (var child in node.Children)
{
if (child.IsBranch)
{
var type = isLocal ? Models.FilterType.LocalBranch : Models.FilterType.RemoteBranch;
repo.Settings.UpdateHistoriesFilter(child.Path, type, Models.FilterMode.None);
}
else
{
var type = isLocal ? Models.FilterType.LocalBranchFolder : Models.FilterType.RemoteBranchFolder;
repo.Settings.UpdateHistoriesFilter(child.Path, type, Models.FilterMode.None);
ResetChildrenBranchNodeFilterMode(repo, child, isLocal);
}
}
}
private ViewModels.BranchTreeNode FindBranchNode(List<ViewModels.BranchTreeNode> nodes, string path)
{
foreach (var node in nodes)
{
if (node.Path.Equals(path, StringComparison.Ordinal))
return node;
if (path.StartsWith(node.Path, StringComparison.Ordinal))
{
var founded = FindBranchNode(node.Children, path);
if (founded != null)
return founded;
}
}
return null;
}
} }
} }

View file

@ -730,12 +730,9 @@ namespace SourceGit.Views
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e) private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
{ {
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } }) if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } selected })
{ {
var source = e.Source as Control; histories.DoubleTapped(selected[0] as Models.Commit);
var item = source.FindAncestorOfType<ListBoxItem>();
if (item is { DataContext: Models.Commit commit })
histories.DoubleTapped(commit);
} }
e.Handled = true; e.Handled = true;
} }

View file

@ -575,19 +575,12 @@
<Grid Height="28" ColumnDefinitions="Auto,*,Auto"> <Grid Height="28" ColumnDefinitions="Auto,*,Auto">
<Path Grid.Column="0" <Path Grid.Column="0"
x:Name="HistoriesFilterModeIcon"
Margin="8,0,0,0" Margin="8,0,0,0"
Width="12" Height="12" Width="14" Height="14"
Data="{StaticResource Icons.Filter}" Fill="{DynamicResource Brush.FG2}"/>
Fill="{DynamicResource Brush.FG2}"
IsVisible="{Binding HistoriesFilterMode, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static m:FilterMode.Included}}"/>
<Path Grid.Column="0"
Margin="8,0,0,0"
Width="12" Height="12"
Data="{StaticResource Icons.EyeClose}"
Fill="{DynamicResource Brush.FG2}"
IsVisible="{Binding HistoriesFilterMode, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static m:FilterMode.Excluded}}"/>
<ItemsControl Grid.Column="1" Margin="8,0,0,0" ItemsSource="{Binding Settings.HistoriesFilters}"> <ItemsControl Grid.Column="1" Margin="8,0,0,0" ItemsSource="{Binding Settings.HistoriesFilters}" LayoutUpdated="OnHistoriesFiltersLayoutUpdated">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/> <VirtualizingStackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
@ -611,8 +604,8 @@
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<Button Grid.Column="2" Classes="icon_button" Command="{Binding ClearHistoriesFilter}" ToolTip.Tip="{DynamicResource Text.Repository.ClearAllCommitsFilter}"> <Button Grid.Column="2" Classes="icon_button" Command="{Binding ClearHistoriesFilter}">
<Path Width="14" Height="14" Margin="16,0,8,0" Data="{StaticResource Icons.RemoveAll}"/> <TextBlock Margin="16,0,8,0" Text="{DynamicResource Text.Repository.ClearAllCommitsFilter}" Foreground="{DynamicResource Brush.Accent}"/>
</Button> </Button>
</Grid> </Grid>
</Border> </Border>

View file

@ -395,5 +395,40 @@ namespace SourceGit.Views
} }
e.Handled = true; e.Handled = true;
} }
private void OnHistoriesFiltersLayoutUpdated(object sender, EventArgs e)
{
var repo = DataContext as ViewModels.Repository;
if (repo == null)
return;
var filters = repo.Settings.HistoriesFilters;
if (filters.Count == 0)
return;
var mode = filters[0].Mode;
if (mode == _lastFilterMode)
return;
_lastFilterMode = mode;
var icon = null as StreamGeometry;
switch (mode)
{
case Models.FilterMode.Included:
icon = this.FindResource("Icons.Filter") as StreamGeometry;
break;
case Models.FilterMode.Excluded:
icon = this.FindResource("Icons.EyeClose") as StreamGeometry;
break;
default:
break;
}
if (icon != null)
HistoriesFilterModeIcon.Data = icon;
}
private Models.FilterMode _lastFilterMode = Models.FilterMode.None;
} }
} }