feature: allow to push revision where local branch is ahead of its upstream (#1394) (#1441)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-21 11:51:27 +08:00
parent 64ffbb113f
commit 9bfc315ace
No known key found for this signature in database
7 changed files with 147 additions and 0 deletions

View file

@ -666,6 +666,22 @@ namespace SourceGit.ViewModels
if (current.Head != commit.SHA)
{
if (current.TrackStatus.Ahead.Contains(commit.SHA))
{
var upstream = _repo.Branches.Find(x => x.FullName.Equals(current.Upstream, StringComparison.Ordinal));
var pushRevision = new MenuItem();
pushRevision.Header = App.Text("CommitCM.PushRevision", commit.SHA.Substring(0, 10), upstream.FriendlyName);
pushRevision.Icon = App.CreateMenuIcon("Icons.Push");
pushRevision.Click += (_, e) =>
{
if (_repo.CanCreatePopup())
_repo.ShowPopup(new PushRevision(_repo, commit, upstream));
e.Handled = true;
};
menu.Items.Add(pushRevision);
menu.Items.Add(new MenuItem() { Header = "-" });
}
var compareWithHead = new MenuItem();
compareWithHead.Header = App.Text("CommitCM.CompareWithHead");
compareWithHead.Icon = App.CreateMenuIcon("Icons.Compare");