mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
This commit is contained in:
parent
d1f3469250
commit
2105fd450d
6 changed files with 14 additions and 13 deletions
|
@ -59,15 +59,17 @@ namespace SourceGit.ViewModels
|
|||
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();
|
||||
|
|
|
@ -37,6 +37,11 @@ namespace SourceGit.ViewModels
|
|||
return !HasErrors;
|
||||
}
|
||||
|
||||
public virtual bool AutoCheck()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual Task<bool> Sure()
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -152,6 +152,11 @@ namespace SourceGit.ViewModels
|
|||
View = new Views.Push() { DataContext = this };
|
||||
}
|
||||
|
||||
public override bool AutoCheck()
|
||||
{
|
||||
return !string.IsNullOrEmpty(_selectedRemoteBranch?.Head);
|
||||
}
|
||||
|
||||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
|
|
|
@ -937,9 +937,6 @@ namespace SourceGit.ViewModels
|
|||
CurrentBranch = branches.Find(x => x.IsCurrent);
|
||||
LocalBranchTrees = builder.Locals;
|
||||
RemoteBranchTrees = builder.Remotes;
|
||||
|
||||
if (_workingCopy != null)
|
||||
_workingCopy.CanCommitWithPush = _currentBranch != null && !string.IsNullOrEmpty(_currentBranch.Upstream);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public bool CanCommitWithPush
|
||||
{
|
||||
get => _canCommitWithPush;
|
||||
set => SetProperty(ref _canCommitWithPush, value);
|
||||
}
|
||||
|
||||
public bool HasUnsolvedConflicts
|
||||
{
|
||||
get => _hasUnsolvedConflicts;
|
||||
|
@ -1625,7 +1619,6 @@ namespace SourceGit.ViewModels
|
|||
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 = [];
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue