mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
enhance: only create squash
menu item if it is needed
Some checks failed
Some checks failed
This commit is contained in:
parent
24b6153226
commit
0a0e2bc044
1 changed files with 16 additions and 14 deletions
|
@ -407,24 +407,26 @@ namespace SourceGit.ViewModels
|
||||||
};
|
};
|
||||||
menu.Items.Add(reset);
|
menu.Items.Add(reset);
|
||||||
|
|
||||||
var squash = new MenuItem();
|
if (commit.IsMerged)
|
||||||
squash.Header = App.Text("CommitCM.SquashCommitsSinceThis");
|
|
||||||
squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent");
|
|
||||||
squash.IsVisible = commit.IsMerged;
|
|
||||||
squash.Click += (_, e) =>
|
|
||||||
{
|
{
|
||||||
if (_repo.LocalChangesCount > 0)
|
var squash = new MenuItem();
|
||||||
|
squash.Header = App.Text("CommitCM.SquashCommitsSinceThis");
|
||||||
|
squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent");
|
||||||
|
squash.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
|
if (_repo.LocalChangesCount > 0)
|
||||||
return;
|
{
|
||||||
}
|
App.RaiseException(_repo.FullPath, "You have local changes. Please run stash or discard first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (PopupHost.CanCreatePopup())
|
if (PopupHost.CanCreatePopup())
|
||||||
PopupHost.ShowPopup(new Squash(_repo, commit, commit.SHA));
|
PopupHost.ShowPopup(new Squash(_repo, commit, commit.SHA));
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(squash);
|
menu.Items.Add(squash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue