From bf965e8fb1f28d91457678c04624c45765045d36 Mon Sep 17 00:00:00 2001 From: "East.Shang" Date: Fri, 4 Oct 2024 14:35:55 +0800 Subject: [PATCH] new feature: push new branch to remote ,just click new branch checkbox --- src/Resources/Locales/de_DE.axaml | 2 ++ src/Resources/Locales/en_US.axaml | 2 ++ src/Resources/Locales/fr_FR.axaml | 2 ++ src/Resources/Locales/pt_BR.axaml | 2 ++ src/Resources/Locales/ru_RU.axaml | 2 ++ src/Resources/Locales/zh_CN.axaml | 2 ++ src/Resources/Locales/zh_TW.axaml | 2 ++ src/ViewModels/Push.cs | 17 +++++++++++++++++ src/Views/Push.axaml | 31 +++++++++++++++++++++++-------- 9 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 8ec97547..58d6ce29 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -454,6 +454,8 @@ Push Remote-Branch: Remote-Branch verfolgen + Neuer Zweig: + Neuer Zweig Alle Tags pushen Tag zum Remote pushen Zu allen Remotes pushen diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index e9717845..d15100c7 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -456,6 +456,8 @@ Remote: Push Changes To Remote Remote Branch: + NewBranch: + NewBranch Set as tracking branch Push all tags Push Tag To Remote diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 40df6d99..7735a8d7 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -441,6 +441,8 @@ Push Changes To Remote Remote Branch: Set as tracking branch + Nouvelle branche: + Nouvelle branche Push all tags Push Tag To Remote Push to all remotes diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 96cdda3e..22cc8a00 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -434,6 +434,8 @@ Empurrar Alterações para o Remoto Branch Remoto: Definir como branch de rastreamento + Novo ramo: + Novo ramo Empurrar todas as tags Empurrar Tag para o Remoto Empurrar para todos os remotos diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 56b01b0b..adbcb6dc 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -457,6 +457,8 @@ Выложить изменения на внешнее хранилище Ветка внешнего хранилища: Установить в качестве ветки отслеживания + Новая ветвь: + Новая ветвь Выложить все теги Выложить тег на внешнее хранилище Выложить на все внешние хранилища diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 6d3474b6..59df8d48 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -456,6 +456,8 @@ 推送到远程仓库 远程分支 : 跟踪远程分支 + 新分支: + 新分支 同时推送标签 推送标签到远程仓库 推送到所有远程仓库 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 7d31e33e..f55030c9 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -460,6 +460,8 @@ 推送到遠端存放庫 遠端分支: 追蹤遠端分支 + 新分支: + 新分支 同時推送標籤 推送標籤到遠端存放庫 推送到所有遠端存放庫 diff --git a/src/ViewModels/Push.cs b/src/ViewModels/Push.cs index b3ef694b..0f6e835e 100644 --- a/src/ViewModels/Push.cs +++ b/src/ViewModels/Push.cs @@ -74,6 +74,17 @@ namespace SourceGit.ViewModels set; } = true; + public bool IsNewBranch + { + get=> _isNewBranch; + set=> SetProperty(ref _isNewBranch, value); + } + public Models.Branch NewBranch + { + get => _newBranch; + private set => SetProperty(ref _newBranch, value); + } + public bool IsCheckSubmodulesVisible { get => _repo.Submodules.Count > 0; @@ -152,6 +163,10 @@ namespace SourceGit.ViewModels _repo.SetWatcherEnabled(false); var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", ""); + if (_isNewBranch&&!string.IsNullOrEmpty(_newBranch.Name)) + { + remoteBranchName = _newBranch.Name; + } ProgressDescription = $"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ..."; return Task.Run(() => @@ -223,5 +238,7 @@ namespace SourceGit.ViewModels private List _remoteBranches = new List(); private Models.Branch _selectedRemoteBranch = null; private bool _isSetTrackOptionVisible = false; + private bool _isNewBranch = false; + private Models.Branch _newBranch = new Models.Branch(); } } diff --git a/src/Views/Push.axaml b/src/Views/Push.axaml index 2d1e9232..ea427785 100644 --- a/src/Views/Push.axaml +++ b/src/Views/Push.axaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="using:SourceGit.Models" xmlns:vm="using:SourceGit.ViewModels" - mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450" + mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="500" x:Class="SourceGit.Views.Push" x:DataType="vm:Push"> @@ -12,7 +12,7 @@ Classes="bold" Text="{DynamicResource Text.Push.Title}"/> - + + SelectedItem="{Binding SelectedRemoteBranch, Mode=TwoWay}" + IsEnabled="{Binding !IsNewBranch}" + > @@ -70,24 +72,37 @@ + - + - + IsVisible="{Binding IsCheckSubmodulesVisible}"/> - -