Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ViewModels/LauncherPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ public bool CanCreatePopup()
public void StartPopup(Popup popup)
{
Popup = popup;
ProcessPopup();
ProcessPopup(true);
}

public async void ProcessPopup()
public async void ProcessPopup(bool autoCheck = false)
{
if (_popup != null)
{
if (!_popup.Check())
return;
if (autoCheck && !_popup.AutoCheck())
return;

_popup.InProgress = true;
var task = _popup.Sure();
Expand Down
5 changes: 5 additions & 0 deletions src/ViewModels/Popup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public bool Check()
return !HasErrors;
}

public virtual bool AutoCheck()
{
return true;
}

public virtual Task<bool> Sure()
{
return null;
Expand Down
5 changes: 5 additions & 0 deletions src/ViewModels/Push.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public Push(Repository repo, Models.Branch localBranch)
View = new Views.Push() { DataContext = this };
}

public override bool AutoCheck()
{
return !string.IsNullOrEmpty(_selectedRemoteBranch?.Head);
}

public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
Expand Down
3 changes: 0 additions & 3 deletions src/ViewModels/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,6 @@ public void RefreshBranches()
CurrentBranch = branches.Find(x => x.IsCurrent);
LocalBranchTrees = builder.Locals;
RemoteBranchTrees = builder.Remotes;

if (_workingCopy != null)
_workingCopy.CanCommitWithPush = _currentBranch != null && !string.IsNullOrEmpty(_currentBranch.Upstream);
});
}

Expand Down
7 changes: 0 additions & 7 deletions src/ViewModels/WorkingCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ public bool IncludeUntracked
}
}

public bool CanCommitWithPush
{
get => _canCommitWithPush;
set => SetProperty(ref _canCommitWithPush, value);
}

public bool HasUnsolvedConflicts
{
get => _hasUnsolvedConflicts;
Expand Down Expand Up @@ -1625,7 +1619,6 @@ private bool IsChanged(List<Models.Change> old, List<Models.Change> cur)
private bool _isUnstaging = false;
private bool _isCommitting = false;
private bool _useAmend = false;
private bool _canCommitWithPush = false;
private List<Models.Change> _cached = [];
private List<Models.Change> _unstaged = [];
private List<Models.Change> _staged = [];
Expand Down
1 change: 0 additions & 1 deletion src/Views/WorkingCopy.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="UseAmend" Converter="{x:Static BoolConverters.Not}"/>
<Binding Path="CanCommitWithPush"/>
<Binding Path="InProgressContext" Converter="{x:Static ObjectConverters.IsNull}"/>
</MultiBinding>
</Button.IsVisible>
Expand Down