diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml
index 03355e01..3752841a 100644
--- a/src/Resources/Locales/de_DE.axaml
+++ b/src/Resources/Locales/de_DE.axaml
@@ -109,7 +109,7 @@
Commit rückgängig machen
Umformulieren
Als Patch speichern...
- Squash in den Vorgänger
+ Squash Commits
ÄNDERUNGEN
Änderungen durchsuchen...
DATEIEN
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 223d8955..a271cf8e 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -107,6 +107,7 @@
Reword
Save as Patch...
Squash Into Parent
+ Squash Commits since Here
CHANGES
Search Changes...
FILES
@@ -531,7 +532,7 @@
Skip This Version
Software Update
There are currently no updates available.
- Squash HEAD Into Parent
+ Squash Commits
SSH Private Key:
Private SSH key store path
START
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml
index 6cb21693..ac7265c5 100644
--- a/src/Resources/Locales/fr_FR.axaml
+++ b/src/Resources/Locales/fr_FR.axaml
@@ -534,7 +534,7 @@
Passer cette version
Mise à jour du logiciel
Il n'y a pas de mise à jour pour le moment.
- Squash HEAD Into Parent
+ Squash Commits
SSH Private Key:
Private SSH key store path
START
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml
index 0b42e4e9..7d6f8cee 100644
--- a/src/Resources/Locales/pt_BR.axaml
+++ b/src/Resources/Locales/pt_BR.axaml
@@ -527,7 +527,7 @@
Ignorar esta versão
Atualização de Software
Não há atualizações disponíveis no momento.
- Unir HEAD ao Parent
+ Squash Commits
Chave SSH Privada:
Caminho para a chave SSH privada
INICIAR
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index a521ca2b..41301673 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -110,6 +110,7 @@
编辑提交信息
另存为补丁 ...
合并此提交到上一个提交
+ 合并之后的提交到此处
变更对比
查找变更...
文件列表
@@ -533,7 +534,7 @@
忽略此版本
软件更新
当前已是最新版本。
- 合并HEAD到上一个提交
+ 压缩为单个提交
SSH密钥 :
SSH密钥文件
开 始
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 15512286..f3c2f129 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -110,6 +110,7 @@
編輯提交訊息
另存為修補檔 (patch)...
合併此提交到上一個提交
+ 合併之後的提交到此處
變更對比
搜尋變更...
檔案列表
@@ -534,7 +535,7 @@
忽略此版本
軟體更新
目前已是最新版本。
- 合併 HEAD 至前次提交
+ 壓縮為單個提交
SSH 金鑰:
SSH 金鑰檔案
開 始
diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs
index ad597985..ef3ef953 100644
--- a/src/ViewModels/Histories.cs
+++ b/src/ViewModels/Histories.cs
@@ -1,9 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
+
using Avalonia.Controls;
using Avalonia.Platform.Storage;
using Avalonia.VisualTree;
+
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.ViewModels
@@ -240,6 +242,25 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
menu.Items.Add(reset);
+
+ var squash = new MenuItem();
+ squash.Header = App.Text("CommitCM.SquashCommitsSinceThis");
+ squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent");
+ squash.IsVisible = commit.IsMerged;
+ squash.Click += (_, e) =>
+ {
+ if (_repo.LocalChangesCount > 0)
+ {
+ App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
+ return;
+ }
+
+ if (PopupHost.CanCreatePopup())
+ PopupHost.ShowPopup(new Squash(_repo, commit, commit.SHA));
+
+ e.Handled = true;
+ };
+ menu.Items.Add(squash);
}
else
{
@@ -276,7 +297,7 @@ namespace SourceGit.ViewModels
{
var parent = _commits.Find(x => x.SHA == commit.Parents[0]);
if (parent != null && PopupHost.CanCreatePopup())
- PopupHost.ShowPopup(new Squash(_repo, commit, parent));
+ PopupHost.ShowPopup(new Squash(_repo, parent, commit.SHA));
}
e.Handled = true;
diff --git a/src/ViewModels/Squash.cs b/src/ViewModels/Squash.cs
index f0f4b8bb..d7426135 100644
--- a/src/ViewModels/Squash.cs
+++ b/src/ViewModels/Squash.cs
@@ -5,16 +5,9 @@ namespace SourceGit.ViewModels
{
public class Squash : Popup
{
- public Models.Commit Head
+ public Models.Commit Target
{
- get;
- private set;
- }
-
- public Models.Commit Parent
- {
- get;
- private set;
+ get => _target;
}
[Required(ErrorMessage = "Commit message is required!!!")]
@@ -24,13 +17,12 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _message, value, true);
}
- public Squash(Repository repo, Models.Commit head, Models.Commit parent)
+ public Squash(Repository repo, Models.Commit target, string shaToGetPreferMessage)
{
_repo = repo;
- _message = new Commands.QueryCommitFullMessage(_repo.FullPath, head.SHA).Result();
-
- Head = head;
- Parent = parent;
+ _target = target;
+ _message = new Commands.QueryCommitFullMessage(_repo.FullPath, shaToGetPreferMessage).Result();
+
View = new Views.Squash() { DataContext = this };
}
@@ -41,7 +33,7 @@ namespace SourceGit.ViewModels
return Task.Run(() =>
{
- var succ = new Commands.Reset(_repo.FullPath, Parent.SHA, "--soft").Exec();
+ var succ = new Commands.Reset(_repo.FullPath, Target.SHA, "--soft").Exec();
if (succ)
succ = new Commands.Commit(_repo.FullPath, _message, true).Exec();
CallUIThread(() => _repo.SetWatcherEnabled(true));
@@ -50,6 +42,7 @@ namespace SourceGit.ViewModels
}
private readonly Repository _repo;
+ private Models.Commit _target;
private string _message;
}
}
diff --git a/src/Views/Squash.axaml b/src/Views/Squash.axaml
index ac8a115c..a517e6c0 100644
--- a/src/Views/Squash.axaml
+++ b/src/Views/Squash.axaml
@@ -13,30 +13,17 @@
Classes="bold"
Text="{DynamicResource Text.Squash}"/>
-
-
-
-
-
-
-
-
+
-
-
+