From 0f38b157e2ed13daccd1b9d4359a463eb7b9cf02 Mon Sep 17 00:00:00 2001 From: Rwing Date: Thu, 13 May 2021 15:31:10 +0800 Subject: [PATCH] feature: add an option to keep branch after finish --- src/Commands/GitFlow.cs | 9 +++++---- src/Resources/Locales/en_US.xaml | 1 + src/Resources/Locales/zh_CN.xaml | 1 + src/Views/Popups/GitFlowFinish.xaml | 13 +++++++++++++ src/Views/Popups/GitFlowFinish.xaml.cs | 4 +++- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Commands/GitFlow.cs b/src/Commands/GitFlow.cs index b33b623c..708bb900 100644 --- a/src/Commands/GitFlow.cs +++ b/src/Commands/GitFlow.cs @@ -50,16 +50,17 @@ namespace SourceGit.Commands { Exec(); } - public void Finish(Models.GitFlowBranchType type, string name) { + public void Finish(Models.GitFlowBranchType type, string name, bool keepBranch) { + var option = keepBranch ? "-k" : string.Empty; switch (type) { case Models.GitFlowBranchType.Feature: - Args = $"flow feature finish {name}"; + Args = $"flow feature finish {option} {name}"; break; case Models.GitFlowBranchType.Release: - Args = $"flow release finish {name}"; + Args = $"flow release finish {option} {name}"; break; case Models.GitFlowBranchType.Hotfix: - Args = $"flow hotfix finish {name}"; + Args = $"flow hotfix finish {option} {name}"; break; default: return; diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 5f0cc5cd..9c3b4aa2 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -151,6 +151,7 @@ {0} prefix is required. {0} contains invalid characters. Development branch is same with production! + Keep branch Refresh Bookmark diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 641ce5ec..f2453658 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -151,6 +151,7 @@ {0}前缀未填写! {0}前缀包含非法字符! 开发分支与发布分支不可相同! + 保留分支 刷新 书签 diff --git a/src/Views/Popups/GitFlowFinish.xaml b/src/Views/Popups/GitFlowFinish.xaml index 385712c0..46139990 100644 --- a/src/Views/Popups/GitFlowFinish.xaml +++ b/src/Views/Popups/GitFlowFinish.xaml @@ -10,6 +10,7 @@ + @@ -31,5 +32,17 @@ Grid.Row="0" Grid.Column="2" Margin="4,0,0,0" x:Name="txtName"/> + + diff --git a/src/Views/Popups/GitFlowFinish.xaml.cs b/src/Views/Popups/GitFlowFinish.xaml.cs index 80df294c..da67160f 100644 --- a/src/Views/Popups/GitFlowFinish.xaml.cs +++ b/src/Views/Popups/GitFlowFinish.xaml.cs @@ -46,9 +46,11 @@ namespace SourceGit.Views.Popups { } public override Task Start() { + var keepBranch = chkKeep.IsChecked == true; + return Task.Run(() => { Models.Watcher.SetEnabled(repo, false); - new Commands.GitFlow(repo).Finish(type, name); + new Commands.GitFlow(repo).Finish(type, name, keepBranch); Models.Watcher.SetEnabled(repo, true); return true; });