Compare commits

..

5 commits

Author SHA1 Message Date
leo
8de37720fa
code_style: remove Rider warnings
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
Localization Check / localization-check (push) Waiting to run
Signed-off-by: leo <longshuang@msn.cn>
2024-11-10 13:19:25 +08:00
leo
daba8e5064
code_review: PR #672
* use formatted string instead of `CommitUrlTitle`

Signed-off-by: leo <longshuang@msn.cn>
2024-11-10 13:19:05 +08:00
Dmitrij D. Czarkoff
bbfc94d624
enhance: several commit links improvements (#672)
* Codeberge (https://codeberg.org/)
* Gitea (https://gitea.org/)
* sourcehut (https://git.sr.ht/)
2024-11-10 12:56:08 +08:00
github-actions[bot]
96c2d0b3ca doc: Update translation status and missing keys 2024-11-10 04:51:30 +00:00
Dmitrij D. Czarkoff
4924e960bf
feature: allow merging tags into branches (#671)
Adds "Merge {tag} into {branch}" menu item to tag menu in histories.
The rest is handled by already existing merge code.
2024-11-10 12:51:15 +08:00
12 changed files with 43 additions and 15 deletions

View file

@ -47,7 +47,7 @@
## Translation Status
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-98.70%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.13%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.58%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-100.00%25-brightgreen)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
## How to Use

View file

@ -31,7 +31,7 @@
</details>
### fr_FR.axaml: 86.56%
### fr_FR.axaml: 86.58%
<details>

View file

@ -627,6 +627,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Tag-Namen kopieren</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Tag-Nachricht kopieren</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Lösche ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Merge ${0}$ in ${1}$ hinein...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Pushe ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Submodule aktualisieren</x:String>

View file

@ -633,6 +633,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copy Tag Name</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Copy Tag Message</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Delete ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Merge ${0}$ into ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Push ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Update Submodules</x:String>

View file

@ -631,6 +631,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copiar Nombre de la Etiqueta</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Copiar Mensaje de la Etiqueta</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Eliminar ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Merge ${0}$ en ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Push ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Actualizar Submódulos</x:String>

View file

@ -551,6 +551,7 @@
<x:String x:Key="Text.Sure" xml:space="preserve">OK</x:String>
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copy Tag Name</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Delete ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Fusionner ${0}$ dans ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Push ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL :</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Actualiser les sous-modules</x:String>

View file

@ -661,6 +661,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Copiar Nome da Tag</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Copiar mensage da Tag</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Excluir ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Mesclar ${0}$ em ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Enviar ${0}$...</x:String>
<x:String x:Key="Text.UpdateSubmodules.All" xml:space="preserve">Todos os submódulos</x:String>
<x:String x:Key="Text.UpdateSubmodules.Init" xml:space="preserve">Inicializar conforme necessário</x:String>

View file

@ -637,6 +637,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">Копировать имя метки</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">Копировать сообщение с метки</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">Удалить ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">Слить ${0}$ в ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">Выложить ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">Сетевой адрес:</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">Обновление подмодулей</x:String>

View file

@ -636,6 +636,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">复制标签名</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">复制标签信息</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">删除 ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">合并 ${0}$ 到 ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">仓库地址 </x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">更新子模块</x:String>

View file

@ -636,6 +636,7 @@
<x:String x:Key="Text.TagCM.Copy" xml:space="preserve">複製標籤名稱</x:String>
<x:String x:Key="Text.TagCM.CopyMessage" xml:space="preserve">複製標籤訊息</x:String>
<x:String x:Key="Text.TagCM.Delete" xml:space="preserve">刪除 ${0}$...</x:String>
<x:String x:Key="Text.TagCM.Merge" xml:space="preserve">合併 ${0}$ 到 ${1}$...</x:String>
<x:String x:Key="Text.TagCM.Push" xml:space="preserve">推送 ${0}$...</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">存放庫網址:</x:String>
<x:String x:Key="Text.UpdateSubmodules" xml:space="preserve">更新子模組</x:String>

View file

@ -115,14 +115,24 @@ namespace SourceGit.ViewModels
{
if (remote.TryGetVisitURL(out var url))
{
var trimmedUrl = url;
if (url.EndsWith(".git"))
trimmedUrl = url.Substring(0, url.Length - 4);
if (url.StartsWith("https://github.com/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = "Github", URLPrefix = $"{url}/commit/" });
else if (url.StartsWith("https://gitlab.com/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = "GitLab", URLPrefix = $"{url}/-/commit/" });
WebLinks.Add(new Models.CommitLink() { Name = $"Github ({trimmedUrl.Substring(19)})", URLPrefix = $"{url}/commit/" });
else if (url.StartsWith("https://gitlab.", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = $"GitLab ({trimmedUrl.Substring(trimmedUrl.Substring(15).IndexOf('/') + 16)})", URLPrefix = $"{url}/-/commit/" });
else if (url.StartsWith("https://gitee.com/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = "Gitee", URLPrefix = $"{url}/commit/" });
WebLinks.Add(new Models.CommitLink() { Name = $"Gitee ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" });
else if (url.StartsWith("https://bitbucket.org/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = "Bitbucket", URLPrefix = $"{url}/commits/" });
WebLinks.Add(new Models.CommitLink() { Name = $"BitBucket ({trimmedUrl.Substring(22)})", URLPrefix = $"{url}/commits/" });
else if (url.StartsWith("https://codeberg.org/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = $"Codeberg ({trimmedUrl.Substring(21)})", URLPrefix = $"{url}/commit/" });
else if (url.StartsWith("https://gitea.org/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = $"Gitea ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" });
else if (url.StartsWith("https://git.sr.ht/", StringComparison.Ordinal))
WebLinks.Add(new Models.CommitLink() { Name = $"sourcehut ({trimmedUrl.Substring(18)})", URLPrefix = $"{url}/commit/" });
}
}
}
@ -186,7 +196,7 @@ namespace SourceGit.ViewModels
var stream = Commands.QueryFileContent.Run(_repo.FullPath, _commit.SHA, file.Path);
var fileSize = stream.Length;
var bitmap = fileSize > 0 ? new Bitmap(stream) : null;
var imageType = Path.GetExtension(file.Path).TrimStart('.').ToUpper(CultureInfo.CurrentCulture);
var imageType = ext!.Substring(1).ToUpper(CultureInfo.CurrentCulture);
var image = new Models.RevisionImageFile() { Image = bitmap, FileSize = fileSize, ImageType = imageType };
Dispatcher.UIThread.Invoke(() => ViewRevisionFileContent = image);
}

View file

@ -153,12 +153,9 @@ namespace SourceGit.ViewModels
}
else if (commits.Count == 1)
{
var commit = commits[0] as Models.Commit;
var commit = (commits[0] as Models.Commit)!;
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
{
_repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA);
}
AutoSelectedCommit = commit;
NavigationId = _navigationId + 1;
@ -224,7 +221,7 @@ namespace SourceGit.ViewModels
public ContextMenu MakeContextMenu(ListBox list)
{
var current = _repo.CurrentBranch;
if (current == null)
if (current == null || list.SelectedItems == null)
return null;
if (list.SelectedItems.Count > 1)
@ -365,7 +362,7 @@ namespace SourceGit.ViewModels
if (tags.Count > 0)
{
foreach (var tag in tags)
FillTagMenu(menu, tag);
FillTagMenu(menu, tag, current, commit.IsMerged);
menu.Items.Add(new MenuItem() { Header = "-" });
}
@ -893,7 +890,7 @@ namespace SourceGit.ViewModels
menu.Items.Add(submenu);
}
private void FillTagMenu(ContextMenu menu, Models.Tag tag)
private void FillTagMenu(ContextMenu menu, Models.Tag tag, Models.Branch current, bool merged)
{
var submenu = new MenuItem();
submenu.Header = tag.Name;
@ -912,6 +909,19 @@ namespace SourceGit.ViewModels
};
submenu.Items.Add(push);
var merge = new MenuItem();
merge.Header = new Views.NameHighlightedTextBlock("TagCM.Merge", tag.Name, current.Name);
merge.Icon = App.CreateMenuIcon("Icons.Merge");
merge.IsEnabled = !merged;
merge.Click += (_, e) =>
{
if (PopupHost.CanCreatePopup())
PopupHost.ShowPopup(new Merge(_repo, tag.Name, current.Name));
e.Handled = true;
};
submenu.Items.Add(merge);
submenu.Items.Add(new MenuItem() { Header = "-" });
var delete = new MenuItem();
delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name);
delete.Icon = App.CreateMenuIcon("Icons.Clear");