mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-21 13:20:30 +08:00
refactor: auto update submodules (only initialized) after checkout/create branch/merge/pull
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -7,14 +7,16 @@ namespace SourceGit.Commands
|
||||
{
|
||||
public partial class QueryUpdatableSubmodules : Command
|
||||
{
|
||||
[GeneratedRegex(@"^([U\-\+ ])([0-9a-f]+)\s(.*?)(\s\(.*\))?$")]
|
||||
[GeneratedRegex(@"^([\-\+])([0-9a-f]+)\s(.*?)(\s\(.*\))?$")]
|
||||
private static partial Regex REG_FORMAT_STATUS();
|
||||
|
||||
public QueryUpdatableSubmodules(string repo)
|
||||
public QueryUpdatableSubmodules(string repo, bool includeUninited)
|
||||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = "submodule status";
|
||||
|
||||
_includeUninited = includeUninited;
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetResultAsync()
|
||||
@@ -30,12 +32,16 @@ namespace SourceGit.Commands
|
||||
{
|
||||
var stat = match.Groups[1].Value;
|
||||
var path = match.Groups[3].Value;
|
||||
if (!stat.StartsWith(' '))
|
||||
submodules.Add(path);
|
||||
if (!_includeUninited && stat.StartsWith('-'))
|
||||
continue;
|
||||
|
||||
submodules.Add(path);
|
||||
}
|
||||
}
|
||||
|
||||
return submodules;
|
||||
}
|
||||
|
||||
private bool _includeUninited = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,12 +107,6 @@ namespace SourceGit.Models
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public bool UpdateSubmodulesOnCheckoutBranch
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public AvaloniaList<CommitTemplate> CommitTemplates
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Lokale Änderungen:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Verwerfen</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Stashen & wieder anwenden</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Alle Submodule updaten</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branch:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">Dein aktueller HEAD enthält Commit(s) ohne Verbindung zu einem Branch/Tag. Möchtest du trotzdem fortfahren?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Auschecken & Fast-Forward</x:String>
|
||||
@@ -645,7 +644,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Lokale Änderungen:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Verwerfen</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stashen & wieder anwenden</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Alle Submodule aktualisieren</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Rebase anstatt Merge verwenden</x:String>
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Local Changes:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Discard</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Reapply</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Update all submodules</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branch:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">Your current HEAD contains commit(s) not connected to any branches/tags! Do you want to continue?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Checkout & Fast-Forward</x:String>
|
||||
@@ -648,7 +647,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Local Changes:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Discard</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Reapply</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Update all submodules</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Use rebase instead of merge</x:String>
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Cambios Locales:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Descartar</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Reaplicar</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Actualizar todos los submódulos</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Rama:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">¡Tu HEAD actual contiene commit(s) que no están conectados a ningunas ramas/etiquetas! ¿Quieres continuar?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Checkout & Fast-Forward</x:String>
|
||||
@@ -643,7 +642,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Cambios Locales:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Descartar</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Reaplicar</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Actualizar todos los submódulos</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remoto:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Usar rebase en lugar de merge</x:String>
|
||||
|
||||
@@ -108,7 +108,6 @@
|
||||
<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.StashAndReapply" xml:space="preserve">Mettre en stash et réappliquer</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Mettre à jour tous les sous-modules</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branche :</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">Votre HEAD actuel contient un ou plusieurs commits non connectés à une branche/tag ! Voulez-vous continuer ?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Récupérer & Fast-Forward</x:String>
|
||||
@@ -637,7 +636,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Changements locaux :</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Rejeter</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Réappliquer</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Mettre à jour tous les sous-modules</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Dépôt distant :</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Utiliser rebase au lieu de merge</x:String>
|
||||
|
||||
@@ -104,7 +104,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Perubahan Lokal:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Buang</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Terapkan Ulang</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Perbarui semua submodule</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branch:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">HEAD saat ini mengandung commit yang tidak terhubung ke branch/tag manapun! Lanjutkan?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Checkout & Fast-Forward</x:String>
|
||||
@@ -612,7 +611,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Perubahan Lokal:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Buang</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stash & Terapkan Ulang</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Perbarui semua submodule</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Gunakan rebase alih-alih merge</x:String>
|
||||
|
||||
@@ -98,7 +98,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Modifiche Locali:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Scarta</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Stasha e Ripristina</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Aggiorna tutti i sottomoduli</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Branch:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">Il tuo HEAD attuale contiene commit non connessi ad alcun branch/tag! Sicuro di voler continuare?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Checkout & Avanzamento Veloce</x:String>
|
||||
@@ -593,7 +592,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Modifiche Locali:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Scarta</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Stasha e Riapplica</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Aggiorna tutti i sottomoduli</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remoto:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Scarica (Recupera e Unisci)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Riallineare anziché unire</x:String>
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">로컬 변경 사항:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">폐기</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">스태시 & 재적용</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">모든 서브모듈 업데이트</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">브랜치:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">현재 HEAD에 브랜치/태그에 연결되지 않은 커밋이 있습니다! 계속하시겠습니까?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">체크아웃 & Fast-Forward</x:String>
|
||||
@@ -613,7 +612,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">로컬 변경 사항:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">폐기</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">스태시 & 재적용</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">모든 서브모듈 업데이트</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">원격:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & 병합)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">병합 대신 리베이스 사용</x:String>
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">Локальные изменения:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">Отклонить</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">Отложить и применить повторно</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">Обновить все подкаталоги</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">Ветка:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">Ваша текущая ГОЛОВА содержит ревизию(и), не связанные ни с к какими ветками или метками! Вы хотите продолжить?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">Переключиться и перемотать</x:String>
|
||||
@@ -652,7 +651,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">Локальные изменения:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Отклонить</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">Отложить и применить повторно</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">Обновить все подмодули</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Внешний репозиторий:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Загрузить (Получить и слить)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Использовать перемещение вместо слияния</x:String>
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">未提交更改 :</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">丢弃更改</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">贮藏并自动恢复</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">同时更新所有子模块</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">目标分支 :</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">您当前游离的HEAD包含未被任何分支及标签引用的提交!是否继续?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">检出分支并快进</x:String>
|
||||
@@ -652,7 +651,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">未提交更改 :</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">丢弃更改</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">贮藏并自动恢复</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">同时更新所有子模块</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">远程 :</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">拉回(拉取并合并)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用变基方式合并分支</x:String>
|
||||
|
||||
@@ -109,7 +109,6 @@
|
||||
<x:String x:Key="Text.Checkout.LocalChanges" xml:space="preserve">未提交變更:</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.Discard" xml:space="preserve">捨棄變更</x:String>
|
||||
<x:String x:Key="Text.Checkout.LocalChanges.StashAndReapply" xml:space="preserve">擱置變更並自動復原</x:String>
|
||||
<x:String x:Key="Text.Checkout.RecurseSubmodules" xml:space="preserve">同時更新所有子模組</x:String>
|
||||
<x:String x:Key="Text.Checkout.Target" xml:space="preserve">目標分支:</x:String>
|
||||
<x:String x:Key="Text.Checkout.WarnLostCommits" xml:space="preserve">您目前的分離的 HEAD 包含與任何分支/標籤無關的提交! 您要繼續嗎?</x:String>
|
||||
<x:String x:Key="Text.Checkout.WithFastForward" xml:space="preserve">簽出分支並快轉</x:String>
|
||||
@@ -652,7 +651,6 @@
|
||||
<x:String x:Key="Text.Pull.LocalChanges" xml:space="preserve">未提交變更:</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">捨棄變更</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReapply" xml:space="preserve">擱置變更並自動復原</x:String>
|
||||
<x:String x:Key="Text.Pull.RecurseSubmodules" xml:space="preserve">同時更新所有子模組</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">遠端:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">拉取 (提取並合併)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用重定基底 (rebase) 合併分支</x:String>
|
||||
|
||||
@@ -15,17 +15,6 @@ namespace SourceGit.ViewModels
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsRecurseSubmoduleVisible
|
||||
{
|
||||
get => _repo.Submodules.Count > 0;
|
||||
}
|
||||
|
||||
public bool RecurseSubmodules
|
||||
{
|
||||
get => _repo.Settings.UpdateSubmodulesOnCheckoutBranch;
|
||||
set => _repo.Settings.UpdateSubmodulesOnCheckoutBranch = value;
|
||||
}
|
||||
|
||||
public Checkout(Repository repo, string branch)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -80,14 +69,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, true, true);
|
||||
}
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -20,17 +20,6 @@ namespace SourceGit.ViewModels
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsRecurseSubmoduleVisible
|
||||
{
|
||||
get => _repo.Submodules.Count > 0;
|
||||
}
|
||||
|
||||
public bool RecurseSubmodules
|
||||
{
|
||||
get => _repo.Settings.UpdateSubmodulesOnCheckoutBranch;
|
||||
set => _repo.Settings.UpdateSubmodulesOnCheckoutBranch = value;
|
||||
}
|
||||
|
||||
public CheckoutAndFastForward(Repository repo, Models.Branch localBranch, Models.Branch remoteBranch)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -85,14 +74,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, true, true);
|
||||
}
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -15,17 +15,6 @@ namespace SourceGit.ViewModels
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsRecurseSubmoduleVisible
|
||||
{
|
||||
get => _repo.Submodules.Count > 0;
|
||||
}
|
||||
|
||||
public bool RecurseSubmodules
|
||||
{
|
||||
get => _repo.Settings.UpdateSubmodulesOnCheckoutBranch;
|
||||
set => _repo.Settings.UpdateSubmodulesOnCheckoutBranch = value;
|
||||
}
|
||||
|
||||
public CheckoutCommit(Repository repo, Models.Commit commit)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -80,14 +69,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, true, true);
|
||||
}
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
|
||||
if (needPop)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (InitAndUpdateSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(path).GetResultAsync();
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(path, true).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(path)
|
||||
.Use(log)
|
||||
|
||||
@@ -54,17 +54,6 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRecurseSubmoduleVisible
|
||||
{
|
||||
get => _repo.Submodules.Count > 0;
|
||||
}
|
||||
|
||||
public bool RecurseSubmodules
|
||||
{
|
||||
get => _repo.Settings.UpdateSubmodulesOnCheckoutBranch;
|
||||
set => _repo.Settings.UpdateSubmodulesOnCheckoutBranch = value;
|
||||
}
|
||||
|
||||
public CreateBranch(Repository repo, Models.Branch branch)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -164,14 +153,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (succ)
|
||||
{
|
||||
if (IsRecurseSubmoduleVisible && RecurseSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, true, true);
|
||||
}
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
.UpdateAsync(submodules, false, true);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath)
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace SourceGit.ViewModels
|
||||
_repo.SetCommitMessage(msg);
|
||||
}
|
||||
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath)
|
||||
.Use(log)
|
||||
|
||||
@@ -50,17 +50,6 @@ namespace SourceGit.ViewModels
|
||||
set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
|
||||
}
|
||||
|
||||
public bool IsRecurseSubmoduleVisible
|
||||
{
|
||||
get => _repo.Submodules.Count > 0;
|
||||
}
|
||||
|
||||
public bool RecurseSubmodules
|
||||
{
|
||||
get => _repo.Settings.UpdateSubmodulesOnCheckoutBranch;
|
||||
set => _repo.Settings.UpdateSubmodulesOnCheckoutBranch = value;
|
||||
}
|
||||
|
||||
public Pull(Repository repo, Models.Branch specifiedRemoteBranch)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -118,7 +107,6 @@ namespace SourceGit.ViewModels
|
||||
var log = _repo.CreateLog("Pull");
|
||||
Use(log);
|
||||
|
||||
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
|
||||
var changes = await new Commands.CountLocalChanges(_repo.FullPath, false).GetResultAsync();
|
||||
var needPopStash = false;
|
||||
if (changes > 0)
|
||||
@@ -147,12 +135,9 @@ namespace SourceGit.ViewModels
|
||||
UseRebase).Use(log).RunAsync();
|
||||
if (rs)
|
||||
{
|
||||
if (updateSubmodules)
|
||||
{
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, false, true);
|
||||
}
|
||||
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath, false).GetResultAsync();
|
||||
if (submodules.Count > 0)
|
||||
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, false, true);
|
||||
|
||||
if (needPopStash)
|
||||
await new Commands.Stash(_repo.FullPath).Use(log).PopAsync("stash@{0}");
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
@@ -46,13 +45,6 @@
|
||||
<RadioButton GroupName="LocalChanges"
|
||||
Content="{DynamicResource Text.Checkout.LocalChanges.Discard}"/>
|
||||
</WrapPanel>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Checkout.RecurseSubmodules}"
|
||||
IsChecked="{Binding RecurseSubmodules, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsRecurseSubmoduleVisible}"
|
||||
ToolTip.Tip="--recurse-submodules"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
@@ -68,13 +67,6 @@
|
||||
<RadioButton GroupName="LocalChanges"
|
||||
Content="{DynamicResource Text.Checkout.LocalChanges.Discard}"/>
|
||||
</WrapPanel>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Checkout.RecurseSubmodules}"
|
||||
IsChecked="{Binding RecurseSubmodules, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsRecurseSubmoduleVisible}"
|
||||
ToolTip.Tip="--recurse-submodules"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
@@ -49,14 +48,7 @@
|
||||
GroupName="LocalChanges"/>
|
||||
</WrapPanel>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Checkout.RecurseSubmodules}"
|
||||
IsChecked="{Binding RecurseSubmodules, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsRecurseSubmoduleVisible}"
|
||||
ToolTip.Tip="--recurse-submodules"/>
|
||||
|
||||
<Grid Grid.Row="3" Grid.Column="1" ColumnDefinitions="Auto,*" Margin="0,6,0,0">
|
||||
<Grid Grid.Row="2" Grid.Column="1" ColumnDefinitions="Auto,*" Margin="0,6,0,0">
|
||||
<Path Grid.Column="0"
|
||||
Width="14" Height="14"
|
||||
Data="{StaticResource Icons.Error}"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
Text="{DynamicResource Text.CreateBranch.Title}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,Auto">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="140"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -93,19 +93,6 @@
|
||||
Content="{DynamicResource Text.CreateBranch.Checkout}"
|
||||
IsChecked="{Binding CheckoutAfterCreated, Mode=TwoWay}"
|
||||
IsVisible="{Binding !IsBareRepository}"/>
|
||||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Checkout.RecurseSubmodules}"
|
||||
IsChecked="{Binding RecurseSubmodules, Mode=TwoWay}"
|
||||
ToolTip.Tip="--recurse-submodules">
|
||||
<CheckBox.IsVisible>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="IsBareRepository" Converter="{x:Static BoolConverters.Not}"/>
|
||||
<Binding Path="CheckoutAfterCreated"/>
|
||||
<Binding Path="IsRecurseSubmoduleVisible"/>
|
||||
</MultiBinding>
|
||||
</CheckBox.IsVisible>
|
||||
</CheckBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto" MinHeight="32"/>
|
||||
<RowDefinition Height="32"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
@@ -96,13 +95,6 @@
|
||||
Content="{DynamicResource Text.Pull.UseRebase}"
|
||||
IsChecked="{Binding UseRebase, Mode=TwoWay}"
|
||||
ToolTip.Tip="--rebase"/>
|
||||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Height="32"
|
||||
Content="{DynamicResource Text.Pull.RecurseSubmodules}"
|
||||
IsChecked="{Binding RecurseSubmodules, Mode=TwoWay}"
|
||||
IsVisible="{Binding IsRecurseSubmoduleVisible}"
|
||||
ToolTip.Tip="--recurse-submodules"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user