mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 02:15:00 +00:00
refactor: rewrite stash local changes
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
10569022d7
commit
957fbbf54f
16 changed files with 92 additions and 77 deletions
22
src/Models/DealWithChangesAfterStashing.cs
Normal file
22
src/Models/DealWithChangesAfterStashing.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SourceGit.Models
|
||||||
|
{
|
||||||
|
public class DealWithChangesAfterStashing
|
||||||
|
{
|
||||||
|
public string Label { get; set; }
|
||||||
|
public string Desc { get; set; }
|
||||||
|
|
||||||
|
public static readonly List<DealWithChangesAfterStashing> Supported = [
|
||||||
|
new ("Discard", "All (or selected) changes will be discarded"),
|
||||||
|
new ("Keep Index", "Staged changes are left intact"),
|
||||||
|
new ("Keep All", "All (or selected) changes are left intact"),
|
||||||
|
];
|
||||||
|
|
||||||
|
public DealWithChangesAfterStashing(string label, string desc)
|
||||||
|
{
|
||||||
|
Label = label;
|
||||||
|
Desc = desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -176,17 +176,11 @@ namespace SourceGit.Models
|
||||||
set;
|
set;
|
||||||
} = false;
|
} = false;
|
||||||
|
|
||||||
public bool KeepIndexWhenStash
|
public int ChangesAfterStashing
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
} = false;
|
} = 0;
|
||||||
|
|
||||||
public bool AutoRestoreAfterStash
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = false;
|
|
||||||
|
|
||||||
public string PreferredOpenAIService
|
public string PreferredOpenAIService
|
||||||
{
|
{
|
||||||
|
|
|
@ -669,10 +669,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Pfad zum privaten SSH 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Automatisch wiederherstellen nach dem Stashen</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Die Arbeitsdateien bleiben unverändert, aber ein Stash wird gespeichert.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Inklusive nicht-verfolgter Dateien</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Inklusive nicht-verfolgter Dateien</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Behalte gestagte Dateien</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Name:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Name:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optional. Name dieses Stashes</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optional. Name dieses Stashes</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Nur gestagte Änderungen</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Nur gestagte Änderungen</x:String>
|
||||||
|
|
|
@ -689,10 +689,8 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Private SSH key store path</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>
|
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Auto-restore after stashing</x:String>
|
<x:String x:Key="Text.Stash.Changes" xml:space="preserve">Selected Changes:</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Your working files remain unchanged, but a stash is saved.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Include untracked files</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Include untracked files</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Keep staged files</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Message:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Message:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optional. Name of this stash</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optional. Name of this stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Only staged changes</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Only staged changes</x:String>
|
||||||
|
|
|
@ -692,10 +692,7 @@
|
||||||
<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.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>
|
<x:String x:Key="Text.Start" xml:space="preserve">INICIAR</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Restaurar automáticamente después del stashing</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Tus archivos de trabajo permanecen sin cambios, pero se guarda un stash.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Incluir archivos no rastreados</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Incluir archivos no rastreados</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Mantener archivos staged</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Mensaje:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Mensaje:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opcional. Nombre de este stash</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opcional. Nombre de este stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Solo cambios staged</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Solo cambios staged</x:String>
|
||||||
|
|
|
@ -645,10 +645,7 @@
|
||||||
<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.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>
|
<x:String x:Key="Text.Start" xml:space="preserve">START</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Auto-restauration après le stash</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Vos fichiers de travail restent inchangés, mais une sauvegarde est enregistrée.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Inclure les fichiers non-suivis</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Inclure les fichiers non-suivis</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Garder les fichiers indexés</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Message :</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Message :</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optionnel. Nom de ce stash</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Optionnel. Nom de ce stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Seulement les changements indexés</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Seulement les changements indexés</x:String>
|
||||||
|
|
|
@ -673,10 +673,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">Percorso per la chiave SSH privata</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>
|
<x:String x:Key="Text.Start" xml:space="preserve">AVVIA</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stasha</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stasha</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Auto-ripristino dopo lo stash</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">I tuoi file di lavoro rimangono inalterati, ma viene salvato uno stash.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Includi file non tracciati</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Includi file non tracciati</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Mantieni file in stage</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Messaggio:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Messaggio:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opzionale. Nome di questo stash</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opzionale. Nome di questo stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Solo modifiche in stage</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Solo modifiche in stage</x:String>
|
||||||
|
|
|
@ -643,10 +643,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">スタート</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">スタッシュ</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">スタッシュ</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">スタッシュ後に自動で復元</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">作業ファイルは変更されず、スタッシュが保存されます。</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">追跡されていないファイルを含める</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">追跡されていないファイルを含める</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">ステージされたファイルを保持</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">メッセージ:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">メッセージ:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">オプション. このスタッシュの名前を入力</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">オプション. このスタッシュの名前を入力</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">ステージされた変更のみ</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">ステージされた変更のみ</x:String>
|
||||||
|
|
|
@ -585,7 +585,6 @@
|
||||||
<x:String x:Key="Text.Start" xml:space="preserve">INICIAR</x:String>
|
<x:String x:Key="Text.Start" xml:space="preserve">INICIAR</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Incluir arquivos não rastreados</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Incluir arquivos não rastreados</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Manter arquivos em stage</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Mensagem:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Mensagem:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opcional. Nome deste stash</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Opcional. Nome deste stash</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Apenas mudanças em stage</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Apenas mudanças em stage</x:String>
|
||||||
|
|
|
@ -690,10 +690,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">ЗАПУСК</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Отложить</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Отложить</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Автоматически восстанавливать после откладывания</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Ваши рабочие файлы остаются неизменными, но отложенные сохранятся.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Включить неотслеживаемые файлы</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Включить неотслеживаемые файлы</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Хранить отложенные файлы</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Сообщение:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Сообщение:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Имя тайника (необязательно)</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Имя тайника (необязательно)</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Только сформированные изменения</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Только сформированные изменения</x:String>
|
||||||
|
|
|
@ -644,10 +644,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">தனியார் பாஓடு திறவுகோல் கடை பாதை</x:String>
|
<x:String x:Key="Text.SSHKey.Placeholder" xml:space="preserve">தனியார் பாஓடு திறவுகோல் கடை பாதை</x:String>
|
||||||
<x:String x:Key="Text.Start" xml:space="preserve">தொடங்கு</x:String>
|
<x:String x:Key="Text.Start" xml:space="preserve">தொடங்கு</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">பதுக்கிவை</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">பதுக்கிவை</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">பதுக்கிவைத்த பிறகு தானியங்கி மீட்டமை</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">உங்கள் செயல்படும் கோப்புகள் மாறாமல் இருக்கும், ஆனால் ஒரு பதுக்கிவைக்கப்படும்.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">கண்காணிக்கப்படாத கோப்புகளைச் சேர்</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">கண்காணிக்கப்படாத கோப்புகளைச் சேர்</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">நிலைப்படுத்தப்பட்ட கோப்புகளை வைத்திரு</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">செய்தி:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">செய்தி:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">விருப்பத்தேர்வு. இந்த பதுக்கலின் பெயர்</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">விருப்பத்தேர்வு. இந்த பதுக்கலின் பெயர்</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">நிலைப்படுத்தப்பட்ட மாற்றங்கள் மட்டும்</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">நிலைப்படுத்தப்பட்ட மாற்றங்கள் மட்டும்</x:String>
|
||||||
|
|
|
@ -649,10 +649,7 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">ПОЧАТИ</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">Stash (Сховати)</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">Stash (Сховати)</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">Автоматично відновити після схову</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">Ваші робочі файли залишаться без змін, але буде збережено схованку.</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Включити невідстежувані файли</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">Включити невідстежувані файли</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">Зберегти проіндексовані файли</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Повідомлення:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">Повідомлення:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Необов'язково. Назва цієї схованки</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">Необов'язково. Назва цієї схованки</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Лише проіндексовані зміни</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">Лише проіндексовані зміни</x:String>
|
||||||
|
|
|
@ -693,10 +693,8 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">开 始</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">贮藏(stash)</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">贮藏(stash)</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">贮藏后自动恢复工作区</x:String>
|
<x:String x:Key="Text.Stash.Changes" xml:space="preserve">已选择变更 :</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">工作区文件保持未修改状态,但贮藏内容已保存。</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未跟踪的文件</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未跟踪的文件</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">保留暂存区文件</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">信息 :</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">信息 :</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">选填,用于命名此贮藏</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">选填,用于命名此贮藏</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">仅贮藏暂存区的变更</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">仅贮藏暂存区的变更</x:String>
|
||||||
|
|
|
@ -693,10 +693,8 @@
|
||||||
<x:String x:Key="Text.SSHKey.Placeholder" 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>
|
<x:String x:Key="Text.Start" xml:space="preserve">開 始</x:String>
|
||||||
<x:String x:Key="Text.Stash" xml:space="preserve">擱置變更 (stash)</x:String>
|
<x:String x:Key="Text.Stash" xml:space="preserve">擱置變更 (stash)</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore" xml:space="preserve">擱置變更後自動復原工作區</x:String>
|
<x:String x:Key="Text.Stash.Changes" xml:space="preserve">選定變更:</x:String>
|
||||||
<x:String x:Key="Text.Stash.AutoRestore.Tip" xml:space="preserve">工作區檔案保持未修改,但擱置內容已儲存。</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未追蹤的檔案</x:String>
|
<x:String x:Key="Text.Stash.IncludeUntracked" xml:space="preserve">包含未追蹤的檔案</x:String>
|
||||||
<x:String x:Key="Text.Stash.KeepIndex" xml:space="preserve">保留已暫存的變更</x:String>
|
|
||||||
<x:String x:Key="Text.Stash.Message" xml:space="preserve">擱置變更訊息:</x:String>
|
<x:String x:Key="Text.Stash.Message" xml:space="preserve">擱置變更訊息:</x:String>
|
||||||
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">選填,用於命名此擱置變更</x:String>
|
<x:String x:Key="Text.Stash.Message.Placeholder" xml:space="preserve">選填,用於命名此擱置變更</x:String>
|
||||||
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">僅擱置已暫存的變更</x:String>
|
<x:String x:Key="Text.Stash.OnlyStagedChanges" xml:space="preserve">僅擱置已暫存的變更</x:String>
|
||||||
|
|
|
@ -27,19 +27,20 @@ namespace SourceGit.ViewModels
|
||||||
public bool OnlyStaged
|
public bool OnlyStaged
|
||||||
{
|
{
|
||||||
get => _repo.Settings.OnlyStagedWhenStash;
|
get => _repo.Settings.OnlyStagedWhenStash;
|
||||||
set => _repo.Settings.OnlyStagedWhenStash = value;
|
set
|
||||||
|
{
|
||||||
|
if (_repo.Settings.OnlyStagedWhenStash != value)
|
||||||
|
{
|
||||||
|
_repo.Settings.OnlyStagedWhenStash = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepIndex
|
public int ChangesAfterStashing
|
||||||
{
|
{
|
||||||
get => _repo.Settings.KeepIndexWhenStash;
|
get => _repo.Settings.ChangesAfterStashing;
|
||||||
set => _repo.Settings.KeepIndexWhenStash = value;
|
set => _repo.Settings.ChangesAfterStashing = value;
|
||||||
}
|
|
||||||
|
|
||||||
public bool AutoRestore
|
|
||||||
{
|
|
||||||
get => _repo.Settings.AutoRestoreAfterStash;
|
|
||||||
set => _repo.Settings.AutoRestoreAfterStash = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StashChanges(Repository repo, List<Models.Change> changes, bool hasSelectedFiles)
|
public StashChanges(Repository repo, List<Models.Change> changes, bool hasSelectedFiles)
|
||||||
|
@ -59,6 +60,8 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
var mode = (DealWithChangesAfterStashing)ChangesAfterStashing;
|
||||||
|
var keepIndex = mode == DealWithChangesAfterStashing.KeepIndex;
|
||||||
var succ = false;
|
var succ = false;
|
||||||
|
|
||||||
if (!HasSelectedFiles)
|
if (!HasSelectedFiles)
|
||||||
|
@ -67,7 +70,7 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (Native.OS.GitVersion >= Models.GitVersions.STASH_PUSH_ONLY_STAGED)
|
if (Native.OS.GitVersion >= Models.GitVersions.STASH_PUSH_ONLY_STAGED)
|
||||||
{
|
{
|
||||||
succ = new Commands.Stash(_repo.FullPath).Use(log).PushOnlyStaged(Message, KeepIndex);
|
succ = new Commands.Stash(_repo.FullPath).Use(log).PushOnlyStaged(Message, keepIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -78,20 +81,20 @@ namespace SourceGit.ViewModels
|
||||||
staged.Add(c);
|
staged.Add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
succ = StashWithChanges(staged, log);
|
succ = StashWithChanges(staged, keepIndex, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, IncludeUntracked, KeepIndex);
|
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, IncludeUntracked, keepIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
succ = StashWithChanges(_changes, log);
|
succ = StashWithChanges(_changes, keepIndex, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoRestore && succ)
|
if (mode == DealWithChangesAfterStashing.KeepAll && succ)
|
||||||
succ = new Commands.Stash(_repo.FullPath).Use(log).Apply("stash@{0}", true);
|
succ = new Commands.Stash(_repo.FullPath).Use(log).Apply("stash@{0}", true);
|
||||||
|
|
||||||
log.Complete();
|
log.Complete();
|
||||||
|
@ -105,7 +108,7 @@ namespace SourceGit.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool StashWithChanges(List<Models.Change> changes, CommandLog log)
|
private bool StashWithChanges(List<Models.Change> changes, bool keepIndex, CommandLog log)
|
||||||
{
|
{
|
||||||
if (changes.Count == 0)
|
if (changes.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -119,7 +122,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
var pathSpecFile = Path.GetTempFileName();
|
var pathSpecFile = Path.GetTempFileName();
|
||||||
File.WriteAllLines(pathSpecFile, paths);
|
File.WriteAllLines(pathSpecFile, paths);
|
||||||
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, pathSpecFile, KeepIndex);
|
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, pathSpecFile, keepIndex);
|
||||||
File.Delete(pathSpecFile);
|
File.Delete(pathSpecFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -128,7 +131,7 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
var count = Math.Min(32, changes.Count - i);
|
var count = Math.Min(32, changes.Count - i);
|
||||||
var step = changes.GetRange(i, count);
|
var step = changes.GetRange(i, count);
|
||||||
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, step, KeepIndex);
|
succ = new Commands.Stash(_repo.FullPath).Use(log).Push(Message, step, keepIndex);
|
||||||
if (!succ)
|
if (!succ)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +140,13 @@ namespace SourceGit.ViewModels
|
||||||
return succ;
|
return succ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum DealWithChangesAfterStashing
|
||||||
|
{
|
||||||
|
Discard = 0,
|
||||||
|
KeepIndex,
|
||||||
|
KeepAll,
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Repository _repo = null;
|
private readonly Repository _repo = null;
|
||||||
private readonly List<Models.Change> _changes = null;
|
private readonly List<Models.Change> _changes = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:m="using:SourceGit.Models"
|
||||||
xmlns:vm="using:SourceGit.ViewModels"
|
xmlns:vm="using:SourceGit.ViewModels"
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
<TextBlock FontSize="18"
|
<TextBlock FontSize="18"
|
||||||
Classes="bold"
|
Classes="bold"
|
||||||
Text="{DynamicResource Text.Stash.Title}"/>
|
Text="{DynamicResource Text.Stash.Title}"/>
|
||||||
<Grid Margin="8,16,0,0" RowDefinitions="32,Auto,Auto,32,Auto,Auto" ColumnDefinitions="120,*">
|
<Grid Margin="8,16,0,0" RowDefinitions="32,32,Auto,Auto,Auto" ColumnDefinitions="120,*">
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
|
@ -23,12 +24,30 @@
|
||||||
Watermark="{DynamicResource Text.Stash.Message.Placeholder}"
|
Watermark="{DynamicResource Text.Stash.Message.Placeholder}"
|
||||||
v:AutoFocusBehaviour.IsEnabled="True"/>
|
v:AutoFocusBehaviour.IsEnabled="True"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="1" Grid.Column="1"
|
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||||
Height="32"
|
HorizontalAlignment="Right"
|
||||||
Content="{DynamicResource Text.Stash.IncludeUntracked}"
|
Margin="8,0"
|
||||||
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
|
Text="{DynamicResource Text.Stash.Changes}"/>
|
||||||
IsVisible="{Binding !HasSelectedFiles}"
|
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||||
ToolTip.Tip="--include-untracked"/>
|
MinHeight="28"
|
||||||
|
Padding="8,0"
|
||||||
|
ItemsSource="{Binding Source={x:Static m:DealWithChangesAfterStashing.Supported}}"
|
||||||
|
SelectedIndex="{Binding ChangesAfterStashing, Mode=TwoWay}"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="m:DealWithChangesAfterStashing">
|
||||||
|
<Grid Height="20">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding Label}"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Desc}" Margin="8,0" FontSize="11" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||||
Height="32"
|
Height="32"
|
||||||
|
@ -39,17 +58,18 @@
|
||||||
|
|
||||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||||
Height="32"
|
Height="32"
|
||||||
Content="{DynamicResource Text.Stash.KeepIndex}"
|
Content="{DynamicResource Text.Stash.IncludeUntracked}"
|
||||||
IsChecked="{Binding KeepIndex, Mode=TwoWay}"
|
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"
|
||||||
ToolTip.Tip="--keep-index"/>
|
ToolTip.Tip="--include-untracked">
|
||||||
|
<CheckBox.IsVisible>
|
||||||
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
|
<Binding Path="HasSelectedFiles" Converter="{x:Static BoolConverters.Not}"/>
|
||||||
|
<Binding Path="OnlyStaged" Converter="{x:Static BoolConverters.Not}"/>
|
||||||
|
</MultiBinding>
|
||||||
|
</CheckBox.IsVisible>
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
<TextBlock Grid.Row="4" Grid.Column="1"
|
||||||
Height="32"
|
|
||||||
Content="{DynamicResource Text.Stash.AutoRestore}"
|
|
||||||
IsChecked="{Binding AutoRestore, Mode=TwoWay}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Stash.AutoRestore.Tip}"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Row="5" Grid.Column="1"
|
|
||||||
Margin="0,4,0,0"
|
Margin="0,4,0,0"
|
||||||
Text="{DynamicResource Text.Stash.TipForSelectedFiles}"
|
Text="{DynamicResource Text.Stash.TipForSelectedFiles}"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue