Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Commands/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum EditorType
public CancellationToken CancellationToken { get; set; } = CancellationToken.None;
public bool RaiseError { get; set; } = true;
public Models.ICommandLog Log { get; set; } = null;
public Dictionary<string, string> Envs { get; } = new();

public async Task<bool> ExecAsync()
{
Expand Down Expand Up @@ -192,6 +193,9 @@ protected ProcessStartInfo CreateGitStartInfo(bool redirect)
start.Environment.Add("LC_ALL", "C");
}

foreach (var kv in Envs)
start.Environment[kv.Key] = kv.Value;

var builder = new StringBuilder();
builder
.Append("--no-pager -c core.quotepath=off -c credential.helper=")
Expand Down
20 changes: 20 additions & 0 deletions src/Commands/DiffAll.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Threading.Tasks;

namespace SourceGit.Commands
{
public class DiffAll : Command
{
public DiffAll(string repo, string range)
{
WorkingDirectory = repo;
Context = repo;
Args = $"diff {range}";
}

public async Task<string> GetResultAsync()
{
var rs = await ReadToEndAsync();
return rs.IsSuccess ? rs.StdOut : string.Empty;
}
}
}
22 changes: 22 additions & 0 deletions src/Commands/DiffStat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Threading.Tasks;

namespace SourceGit.Commands
{
public class DiffStat : Command
{
public DiffStat(string repo, string range)
{
WorkingDirectory = repo;
Context = repo;
Args = $"diff --stat {range}";
}

public async Task<string> GetResultAsync()
{
var rs = await ReadToEndAsync().ConfigureAwait(false);
if (rs.IsSuccess && !string.IsNullOrEmpty(rs.StdOut))
return rs.StdOut.Trim();
return string.Empty;
}
}
}
20 changes: 20 additions & 0 deletions src/Commands/IsAncestor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Threading.Tasks;

namespace SourceGit.Commands
{
public class IsAncestor : Command
{
public IsAncestor(string repo, string ancestor, string descendant)
{
WorkingDirectory = repo;
Context = repo;
Args = $"merge-base --is-ancestor {ancestor} {descendant}";
RaiseError = false;
}

public bool Test()
{
return ReadToEnd().IsSuccess;
}
}
}
14 changes: 14 additions & 0 deletions src/Resources/Locales/de_DE.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">Umformulieren</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Als Patch speichern...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash in den Vorgänger</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">Squash hierher erzwingen...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">ÄNDERUNGEN</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">geänderte Datei(en)</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Änderungen durchsuchen...</x:String>
Expand Down Expand Up @@ -751,6 +752,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Zum Commit wechseln</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">Squash Commits</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">In:</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">Squash über Merges (Historie glätten)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">Operation überschreibt die Historie vom gewählten Commit bis HEAD zu einem Commit
Alle Merge-Commits im Bereich werden entfernt
Signierte Commits oder Merges verlieren Signaturen
Anschließend ist ein Force-Push erforderlich
Schließe oder aktualisiere alle zugehörigen MR/PR</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">Vor dem Überschreiben Sicherungszweig erstellen</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">Lokale Änderungen automatisch stashen</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">Originalautor und -datum des Ziel-Commits beibehalten</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">Nachrichten der gesquashten Commits an den Body anhängen</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">Automatischen Stash anwenden fehlgeschlagen.</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">Historie abgeflacht. Sicherungszweig: {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">Historie abgeflacht.</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">SSH privater Schlüssel:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Pfad zum privaten SSH Schlüssel</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
Expand Down
15 changes: 15 additions & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">Reword</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Save as Patch...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash into Parent</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">Force squash to here...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">CHANGES</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">changed file(s)</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Search Changes...</x:String>
Expand Down Expand Up @@ -552,6 +553,7 @@
<x:String x:Key="Text.Preferences.DiffMerge.Type" xml:space="preserve">Tool</x:String>
<x:String x:Key="Text.Preferences.General" xml:space="preserve">GENERAL</x:String>
<x:String x:Key="Text.Preferences.General.Check4UpdatesOnStartup" xml:space="preserve">Check for updates on startup</x:String>
<x:String x:Key="Text.Preferences.General.EnableDangerousHistoryRewrites" xml:space="preserve">Enable dangerous history rewrites</x:String>
<x:String x:Key="Text.Preferences.General.DateFormat" xml:space="preserve">Date Format</x:String>
<x:String x:Key="Text.Preferences.General.Locale" xml:space="preserve">Language</x:String>
<x:String x:Key="Text.Preferences.General.MaxHistoryCommits" xml:space="preserve">History Commits</x:String>
Expand Down Expand Up @@ -746,6 +748,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Go to</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">Squash Commits</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">Into:</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">Squash across merges (flatten history)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">Operation rewrites history from selected commit to HEAD into one commit
All merge commits in range will be removed
Signed commits or merges lose signatures
Force push is required afterwards
Close or update any related MR/PR</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">Create safety backup branch before rewrite</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">Auto-stash local changes</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">Keep original author/date of target commit</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">Append messages of squashed commits to body</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">Failed to apply auto stash.</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">History flattened. Backup branch: {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">History flattened.</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">SSH Private Key:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Private SSH key store path</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
Expand Down
14 changes: 14 additions & 0 deletions src/Resources/Locales/es_ES.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">Reescribir</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Guardar como Parche...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash en Parent</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">Forzar squash aquí...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">CAMBIOS</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Count" xml:space="preserve">archivo(s) modificado(s)</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Buscar Cambios...</x:String>
Expand Down Expand Up @@ -750,6 +751,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Ir a</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">Squash Commits</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">En:</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">Squash a través de merges (aplanar historial)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">La operación reescribe el historial desde el commit seleccionado hasta HEAD en un solo commit
Todos los commits de merge en el rango serán eliminados
Los commits o merges firmados pierden sus firmas
Se requiere un force push después
Cierra o actualiza cualquier MR/PR relacionado</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">Crear rama de respaldo antes de sobrescribir</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">Guardar automáticamente los cambios locales</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">Conservar autor/fecha originales del commit destino</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">Añadir mensajes de los commits aplastados al cuerpo</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">No se pudo aplicar el auto-stash.</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">Historial aplanado. Rama de respaldo: {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">Historial aplanado.</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">Clave Privada SSH:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Ruta de almacenamiento de la clave privada SSH</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">INICIAR</x:String>
Expand Down
14 changes: 14 additions & 0 deletions src/Resources/Locales/fr_FR.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">Reformuler</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Enregistrer en tant que patch...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Squash dans le parent</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">Forcer le squash ici...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">CHANGEMENTS</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Rechercher les changements...</x:String>
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">FICHIERS</x:String>
Expand Down Expand Up @@ -611,6 +612,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Aller à</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">Squash les commits</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">Dans :</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">Squasher à travers les fusions (aplatir l'historique)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">L'opération réécrit l'historique du commit sélectionné jusqu'à HEAD en un seul commit
Tous les commits de fusion dans l'intervalle seront supprimés
Les commits ou fusions signés perdent leurs signatures
Un push forcé est nécessaire ensuite
Fermez ou mettez à jour toute MR/PR liée</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">Créer une branche de sauvegarde avant la réécriture</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">Stasher automatiquement les modifications locales</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">Conserver l'auteur/la date originaux du commit cible</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">Ajouter les messages des commits squashés au corps</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">Échec de l'application de l'auto-stash.</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">Historique aplati. Branche de sauvegarde : {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">Historique aplati.</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">Clé privée SSH :</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Chemin du magasin de clés privées SSH</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
Expand Down
14 changes: 14 additions & 0 deletions src/Resources/Locales/it_IT.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">Modifica</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">Salva come Patch...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">Compatta nel Genitore</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">Forza squash qui...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">MODIFICHE</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">Cerca Modifiche...</x:String>
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">FILE</x:String>
Expand Down Expand Up @@ -639,6 +640,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Vai a</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">Compatta Commit</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">In:</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">Squash attraverso i merge (appiattisci la cronologia)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">L'operazione riscrive la cronologia dal commit selezionato a HEAD in un solo commit
Tutti i commit di merge nell'intervallo saranno rimossi
I commit o i merge firmati perdono le firme
È richiesto un force push dopo
Chiudi o aggiorna qualsiasi MR/PR correlato</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">Crea un ramo di backup prima della riscrittura</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">Esegui auto-stash delle modifiche locali</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">Mantieni autore/data originali del commit di destinazione</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">Aggiungi i messaggi dei commit squasciati al corpo</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">Applicazione dell'auto-stash non riuscita.</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">Cronologia appiattita. Ramo di backup: {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">Cronologia appiattita.</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">Chiave Privata SSH:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Percorso per la chiave SSH privata</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">AVVIA</x:String>
Expand Down
14 changes: 14 additions & 0 deletions src/Resources/Locales/ja_JP.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<x:String x:Key="Text.CommitCM.Reword" xml:space="preserve">書き直す</x:String>
<x:String x:Key="Text.CommitCM.SaveAsPatch" xml:space="preserve">パッチとして保存...</x:String>
<x:String x:Key="Text.CommitCM.Squash" xml:space="preserve">親にスカッシュ</x:String>
<x:String x:Key="Text.CommitCM.ForceSquash" xml:space="preserve">ここに強制スクワッシュ...</x:String>
<x:String x:Key="Text.CommitDetail.Changes" xml:space="preserve">変更</x:String>
<x:String x:Key="Text.CommitDetail.Changes.Search" xml:space="preserve">変更を検索...</x:String>
<x:String x:Key="Text.CommitDetail.Files" xml:space="preserve">ファイル</x:String>
Expand Down Expand Up @@ -609,6 +610,19 @@
<x:String x:Key="Text.SHALinkCM.NavigateTo" xml:space="preserve">Go to</x:String>
<x:String x:Key="Text.Squash" xml:space="preserve">スカッシュコミット</x:String>
<x:String x:Key="Text.Squash.Into" xml:space="preserve">宛先:</x:String>
<x:String x:Key="Text.ForceSquash.Title" xml:space="preserve">マージをまたいでスクワッシュ(履歴を平坦化)</x:String>
<x:String x:Key="Text.ForceSquash.Warn" xml:space="preserve">選択したコミットからHEADまでの履歴を1つのコミットに書き換えます
範囲内のすべてのマージコミットは削除されます
署名付きのコミットやマージは署名を失います
その後は強制プッシュが必要です
関連するMR/PRを閉じるか更新してください</x:String>
<x:String x:Key="Text.ForceSquash.CreateBackup" xml:space="preserve">書き換え前に安全なバックアップブランチを作成</x:String>
<x:String x:Key="Text.ForceSquash.AutoStash" xml:space="preserve">ローカル変更を自動でスタッシュ</x:String>
<x:String x:Key="Text.ForceSquash.KeepAuthorDate" xml:space="preserve">対象コミットの元の作者/日付を保持</x:String>
<x:String x:Key="Text.ForceSquash.AppendMessages" xml:space="preserve">スクワッシュされたコミットのメッセージを本文に追加</x:String>
<x:String x:Key="Text.ForceSquash.StashPopFailed" xml:space="preserve">自動スタッシュの適用に失敗しました。</x:String>
<x:String x:Key="Text.ForceSquash.Success" xml:space="preserve">履歴を平坦化しました。バックアップブランチ: {0}</x:String>
<x:String x:Key="Text.ForceSquash.SuccessNoBackup" xml:space="preserve">履歴を平坦化しました。</x:String>
<x:String x:Key="Text.SSHKey" xml:space="preserve">SSH プライベートキー:</x:String>
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">プライベートSSHキーストアのパス</x:String>
<x:String x:Key="Text.Start" xml:space="preserve">スタート</x:String>
Expand Down
Loading