mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature: add an option to enable --recurse-submodules=check
on push (#345)
This commit is contained in:
parent
d66053a42d
commit
d4a9343eaf
7 changed files with 39 additions and 10 deletions
|
@ -4,7 +4,7 @@ namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
public class Push : Command
|
public class Push : Command
|
||||||
{
|
{
|
||||||
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool force, bool track, Action<string> onProgress)
|
public Push(string repo, string local, string remote, string remoteBranch, bool withTags, bool checkSubmodules, bool track, bool force, Action<string> onProgress)
|
||||||
{
|
{
|
||||||
_outputHandler = onProgress;
|
_outputHandler = onProgress;
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ namespace SourceGit.Commands
|
||||||
|
|
||||||
if (withTags)
|
if (withTags)
|
||||||
Args += "--tags ";
|
Args += "--tags ";
|
||||||
|
if (checkSubmodules)
|
||||||
|
Args += "--recurse-submodules=check ";
|
||||||
if (track)
|
if (track)
|
||||||
Args += "-u ";
|
Args += "-u ";
|
||||||
if (force)
|
if (force)
|
||||||
|
|
|
@ -40,6 +40,12 @@ namespace SourceGit.Models
|
||||||
set;
|
set;
|
||||||
} = true;
|
} = true;
|
||||||
|
|
||||||
|
public bool CheckSubmodulesOnPush
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = true;
|
||||||
|
|
||||||
public bool PushAllTags
|
public bool PushAllTags
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|
|
@ -430,6 +430,7 @@
|
||||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</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>
|
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Use rebase instead of merge</x:String>
|
||||||
<x:String x:Key="Text.Push" xml:space="preserve">Push</x:String>
|
<x:String x:Key="Text.Push" xml:space="preserve">Push</x:String>
|
||||||
|
<x:String x:Key="Text.Push.CheckSubmodules" xml:space="preserve">Make sure submodules have been pushed</x:String>
|
||||||
<x:String x:Key="Text.Push.Force" xml:space="preserve">Force push</x:String>
|
<x:String x:Key="Text.Push.Force" xml:space="preserve">Force push</x:String>
|
||||||
<x:String x:Key="Text.Push.Local" xml:space="preserve">Local Branch:</x:String>
|
<x:String x:Key="Text.Push.Local" xml:space="preserve">Local Branch:</x:String>
|
||||||
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote:</x:String>
|
<x:String x:Key="Text.Push.Remote" xml:space="preserve">Remote:</x:String>
|
||||||
|
|
|
@ -433,6 +433,7 @@
|
||||||
<x:String x:Key="Text.Pull.Title" 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>
|
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用变基方式合并分支</x:String>
|
||||||
<x:String x:Key="Text.Push" xml:space="preserve">推送(push)</x:String>
|
<x:String x:Key="Text.Push" xml:space="preserve">推送(push)</x:String>
|
||||||
|
<x:String x:Key="Text.Push.CheckSubmodules" xml:space="preserve">确保子模块变更已推送</x:String>
|
||||||
<x:String x:Key="Text.Push.Force" xml:space="preserve">启用强制推送</x:String>
|
<x:String x:Key="Text.Push.Force" xml:space="preserve">启用强制推送</x:String>
|
||||||
<x:String x:Key="Text.Push.Local" xml:space="preserve">本地分支 :</x:String>
|
<x:String x:Key="Text.Push.Local" xml:space="preserve">本地分支 :</x:String>
|
||||||
<x:String x:Key="Text.Push.Remote" xml:space="preserve">远程仓库 :</x:String>
|
<x:String x:Key="Text.Push.Remote" xml:space="preserve">远程仓库 :</x:String>
|
||||||
|
|
|
@ -433,6 +433,7 @@
|
||||||
<x:String x:Key="Text.Pull.Title" 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>
|
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用變基方式合併分支</x:String>
|
||||||
<x:String x:Key="Text.Push" xml:space="preserve">推送(push)</x:String>
|
<x:String x:Key="Text.Push" xml:space="preserve">推送(push)</x:String>
|
||||||
|
<x:String x:Key="Text.Push.CheckSubmodules" xml:space="preserve">確保子模組變更已推送</x:String>
|
||||||
<x:String x:Key="Text.Push.Force" xml:space="preserve">啟用強制推送</x:String>
|
<x:String x:Key="Text.Push.Force" xml:space="preserve">啟用強制推送</x:String>
|
||||||
<x:String x:Key="Text.Push.Local" xml:space="preserve">本地分支 :</x:String>
|
<x:String x:Key="Text.Push.Local" xml:space="preserve">本地分支 :</x:String>
|
||||||
<x:String x:Key="Text.Push.Remote" xml:space="preserve">遠端倉庫 :</x:String>
|
<x:String x:Key="Text.Push.Remote" xml:space="preserve">遠端倉庫 :</x:String>
|
||||||
|
|
|
@ -62,12 +62,6 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PushAllTags
|
|
||||||
{
|
|
||||||
get => _repo.Settings.PushAllTags;
|
|
||||||
set => _repo.Settings.PushAllTags = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSetTrackOptionVisible
|
public bool IsSetTrackOptionVisible
|
||||||
{
|
{
|
||||||
get => _isSetTrackOptionVisible;
|
get => _isSetTrackOptionVisible;
|
||||||
|
@ -80,6 +74,23 @@ namespace SourceGit.ViewModels
|
||||||
set;
|
set;
|
||||||
} = true;
|
} = true;
|
||||||
|
|
||||||
|
public bool IsCheckSubmodulesVisible
|
||||||
|
{
|
||||||
|
get => _repo.Submodules.Count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckSubmodules
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = true;
|
||||||
|
|
||||||
|
public bool PushAllTags
|
||||||
|
{
|
||||||
|
get => _repo.Settings.PushAllTags;
|
||||||
|
set => _repo.Settings.PushAllTags = value;
|
||||||
|
}
|
||||||
|
|
||||||
public bool ForcePush
|
public bool ForcePush
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -151,8 +162,9 @@ namespace SourceGit.ViewModels
|
||||||
_selectedRemote.Name,
|
_selectedRemote.Name,
|
||||||
remoteBranchName,
|
remoteBranchName,
|
||||||
PushAllTags,
|
PushAllTags,
|
||||||
ForcePush,
|
_repo.Submodules.Count > 0 && CheckSubmodules,
|
||||||
_isSetTrackOptionVisible && Tracking,
|
_isSetTrackOptionVisible && Tracking,
|
||||||
|
ForcePush,
|
||||||
SetProgressDescription).Exec();
|
SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
Classes="bold"
|
Classes="bold"
|
||||||
Text="{DynamicResource Text.Push.Title}"/>
|
Text="{DynamicResource Text.Push.Title}"/>
|
||||||
|
|
||||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,32,32" ColumnDefinitions="150,*">
|
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,Auto,32,32" ColumnDefinitions="130,*">
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
|
@ -78,10 +78,16 @@
|
||||||
IsVisible="{Binding IsSetTrackOptionVisible}"/>
|
IsVisible="{Binding IsSetTrackOptionVisible}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||||
|
Height="32"
|
||||||
|
Content="{DynamicResource Text.Push.CheckSubmodules}"
|
||||||
|
IsChecked="{Binding CheckSubmodules, Mode=TwoWay}"
|
||||||
|
IsVisible="{Binding IsCheckSubmodulesVisible}"/>
|
||||||
|
|
||||||
|
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Push.WithAllTags}"
|
Content="{DynamicResource Text.Push.WithAllTags}"
|
||||||
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
|
IsChecked="{Binding PushAllTags, Mode=TwoWay}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
<CheckBox Grid.Row="6" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Push.Force}"
|
Content="{DynamicResource Text.Push.Force}"
|
||||||
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
|
IsChecked="{Binding ForcePush, Mode=TwoWay}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue