From effd36e014a7dcc729441e3a1b0ae2a135315328 Mon Sep 17 00:00:00 2001 From: Corentin Damman Date: Wed, 8 Oct 2025 07:53:52 +0200 Subject: [PATCH] feature: add fast-forward menu for other local branches --- src/Views/Histories.axaml.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index b0cef55d7..d3c83bff2 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -1032,6 +1032,28 @@ private void FillOtherLocalBranchMenu(ContextMenu menu, ViewModels.Repository re }; submenu.Items.Add(checkout); + if (branch.Upstream.Length > 0) + { + var upstream = branch.Upstream.Substring(13); + + var fastForward = new MenuItem(); + fastForward.Header = App.Text("BranchCM.FastForward", upstream); + fastForward.Icon = App.CreateMenuIcon("Icons.FastForward"); + fastForward.IsEnabled = branch.Ahead.Count == 0 && branch.Behind.Count > 0; + fastForward.Click += async (_, e) => + { + var b = repo.Branches.Find(x => x.FriendlyName == upstream); + if (b == null) + return; + + if (repo.CanCreatePopup()) + await repo.ShowAndStartPopupAsync(new ViewModels.FetchInto(repo, branch, b)); + + e.Handled = true; + }; + submenu.Items.Add(fastForward); + } + var merge = new MenuItem(); merge.Header = App.Text("BranchCM.Merge", branch.Name, current.Name); merge.Icon = App.CreateMenuIcon("Icons.Merge");