mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
ux: only show Set as tracking branch
option if selected remote branch is not upstream of selected local branch
This commit is contained in:
parent
6dface0b62
commit
08567a7420
2 changed files with 17 additions and 22 deletions
|
@ -19,25 +19,7 @@ namespace SourceGit.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _selectedLocalBranch, value))
|
if (SetProperty(ref _selectedLocalBranch, value))
|
||||||
{
|
|
||||||
// If selected local branch has upstream branch. Try to find it's remote.
|
|
||||||
if (!string.IsNullOrEmpty(value.Upstream))
|
|
||||||
{
|
|
||||||
var branch = _repo.Branches.Find(x => x.FullName == value.Upstream);
|
|
||||||
if (branch != null)
|
|
||||||
{
|
|
||||||
var remote = _repo.Remotes.Find(x => x.Name == branch.Remote);
|
|
||||||
if (remote != null && remote != _selectedRemote)
|
|
||||||
{
|
|
||||||
SelectedRemote = remote;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-generate remote branches and auto-select remote branches.
|
|
||||||
AutoSelectBranchByRemote();
|
AutoSelectBranchByRemote();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +55,11 @@ namespace SourceGit.ViewModels
|
||||||
public Models.Branch SelectedRemoteBranch
|
public Models.Branch SelectedRemoteBranch
|
||||||
{
|
{
|
||||||
get => _selectedRemoteBranch;
|
get => _selectedRemoteBranch;
|
||||||
set => SetProperty(ref _selectedRemoteBranch, value);
|
set
|
||||||
|
{
|
||||||
|
if (SetProperty(ref _selectedRemoteBranch, value))
|
||||||
|
IsSetTrackOptionVisible = value != null && _selectedLocalBranch.Upstream != value.FullName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PushAllTags
|
public bool PushAllTags
|
||||||
|
@ -82,6 +68,12 @@ namespace SourceGit.ViewModels
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSetTrackOptionVisible
|
||||||
|
{
|
||||||
|
get => _isSetTrackOptionVisible;
|
||||||
|
private set => SetProperty(ref _isSetTrackOptionVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool Tracking
|
public bool Tracking
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -160,7 +152,7 @@ namespace SourceGit.ViewModels
|
||||||
remoteBranchName,
|
remoteBranchName,
|
||||||
PushAllTags,
|
PushAllTags,
|
||||||
ForcePush,
|
ForcePush,
|
||||||
Tracking,
|
_isSetTrackOptionVisible && Tracking,
|
||||||
SetProgressDescription).Exec();
|
SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
@ -218,5 +210,6 @@ namespace SourceGit.ViewModels
|
||||||
private Models.Remote _selectedRemote = null;
|
private Models.Remote _selectedRemote = null;
|
||||||
private List<Models.Branch> _remoteBranches = new List<Models.Branch>();
|
private List<Models.Branch> _remoteBranches = new List<Models.Branch>();
|
||||||
private Models.Branch _selectedRemoteBranch = null;
|
private Models.Branch _selectedRemoteBranch = null;
|
||||||
|
private bool _isSetTrackOptionVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,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,32,32,32" ColumnDefinitions="150,*">
|
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,32,32" ColumnDefinitions="150,*">
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||||
Margin="0,0,8,0"
|
Margin="0,0,8,0"
|
||||||
|
@ -73,8 +73,10 @@
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||||
|
Height="32"
|
||||||
Content="{DynamicResource Text.Push.Tracking}"
|
Content="{DynamicResource Text.Push.Tracking}"
|
||||||
IsChecked="{Binding Tracking, Mode=TwoWay}"/>
|
IsChecked="{Binding Tracking, Mode=TwoWay}"
|
||||||
|
IsVisible="{Binding IsSetTrackOptionVisible}"/>
|
||||||
|
|
||||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||||
Content="{DynamicResource Text.Push.WithAllTags}"
|
Content="{DynamicResource Text.Push.WithAllTags}"
|
||||||
|
|
Loading…
Reference in a new issue