mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
enhance: tag push behavior while creating and deleting (#999)
- Remember the state of `Push to all remotes after created` checkbox while creating tag - Remember the state of `Delete from remote repositories` checkbox while deleting tag - Change default state of `Delete from remote repositories` to `false` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
5d2cd8b2fa
commit
59638eb731
5 changed files with 25 additions and 13 deletions
|
@ -104,6 +104,18 @@ namespace SourceGit.Models
|
|||
set;
|
||||
} = false;
|
||||
|
||||
public bool PushToRemoteWhenCreateTag
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public bool PushToRemoteWhenDeleteTag
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public DealWithLocalChanges DealWithLocalChangesOnCreateBranch
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -39,11 +39,11 @@ namespace SourceGit.ViewModels
|
|||
set;
|
||||
} = false;
|
||||
|
||||
public bool PushToAllRemotes
|
||||
public bool PushToRemotes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = true;
|
||||
get => _repo.Settings.PushToRemoteWhenCreateTag;
|
||||
set => _repo.Settings.PushToRemoteWhenCreateTag = value;
|
||||
}
|
||||
|
||||
public CreateTag(Repository repo, Models.Branch branch)
|
||||
{
|
||||
|
@ -82,6 +82,7 @@ namespace SourceGit.ViewModels
|
|||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = "Create tag...";
|
||||
|
||||
var remotes = PushToRemotes ? _repo.Remotes : null;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
bool succ;
|
||||
|
@ -90,9 +91,9 @@ namespace SourceGit.ViewModels
|
|||
else
|
||||
succ = Commands.Tag.Add(_repo.FullPath, _tagName, _basedOn);
|
||||
|
||||
if (succ && PushToAllRemotes)
|
||||
if (succ && remotes != null)
|
||||
{
|
||||
foreach (var remote in _repo.Remotes)
|
||||
foreach (var remote in remotes)
|
||||
{
|
||||
SetProgressDescription($"Pushing tag to remote {remote.Name} ...");
|
||||
new Commands.Push(_repo.FullPath, remote.Name, _tagName, false).Exec();
|
||||
|
|
|
@ -10,17 +10,16 @@ namespace SourceGit.ViewModels
|
|||
private set;
|
||||
}
|
||||
|
||||
public bool ShouldPushToRemote
|
||||
public bool PushToRemotes
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get => _repo.Settings.PushToRemoteWhenDeleteTag;
|
||||
set => _repo.Settings.PushToRemoteWhenDeleteTag = value;
|
||||
}
|
||||
|
||||
public DeleteTag(Repository repo, Models.Tag tag)
|
||||
{
|
||||
_repo = repo;
|
||||
Target = tag;
|
||||
ShouldPushToRemote = true;
|
||||
View = new Views.DeleteTag() { DataContext = this };
|
||||
}
|
||||
|
||||
|
@ -29,9 +28,9 @@ namespace SourceGit.ViewModels
|
|||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = $"Deleting tag '{Target.Name}' ...";
|
||||
|
||||
var remotes = PushToRemotes ? _repo.Remotes : null;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var remotes = ShouldPushToRemote ? _repo.Remotes : null;
|
||||
var succ = Commands.Tag.Delete(_repo.FullPath, Target.Name, remotes);
|
||||
CallUIThread(() =>
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.CreateTag.PushToAllRemotes}"
|
||||
IsChecked="{Binding PushToAllRemotes, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding PushToRemotes, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
<CheckBox Grid.Row="1" Grid.Column="1"
|
||||
Content="{DynamicResource Text.DeleteTag.WithRemote}"
|
||||
IsChecked="{Binding ShouldPushToRemote, Mode=TwoWay}"/>
|
||||
IsChecked="{Binding PushToRemotes, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue