diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 412aa4d69..ebc38d78f 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -123,17 +123,17 @@ SHA Subject Custom Action - Interactively Rebase ${0}$ on Here + Interactively Rebase ${0}$ on ${1}$ Merge to ${0}$ Merge ... Push ${0}$ to ${1}$ - Rebase ${0}$ on Here - Reset ${0}$ to Here + Rebase ${0}$ on ${1}$ + Reset ${0}$ to ${1}$ Revert Commit Reword Save as Patch... Squash into Parent - Squash Children into Here + Squash Children into ${0}$ CHANGES changed file(s) Search Changes... diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 73983eb09..4d119f98c 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -483,10 +483,12 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec if (!_repo.IsBare) { + var target = GetFriendlyNameOfCommit(commit); + if (current.Head != commit.SHA) { var reset = new MenuItem(); - reset.Header = App.Text("CommitCM.Reset", current.Name); + reset.Header = App.Text("CommitCM.Reset", current.Name, target); reset.Icon = App.CreateMenuIcon("Icons.Reset"); reset.Click += (_, e) => { @@ -499,7 +501,7 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec if (commit.IsMerged) { var squash = new MenuItem(); - squash.Header = App.Text("CommitCM.SquashCommitsSinceThis"); + squash.Header = App.Text("CommitCM.SquashCommitsSinceThis", target); squash.Icon = App.CreateMenuIcon("Icons.SquashIntoParent"); squash.Click += (_, e) => { @@ -545,7 +547,7 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec if (!commit.IsMerged) { var rebase = new MenuItem(); - rebase.Header = App.Text("CommitCM.Rebase", current.Name); + rebase.Header = App.Text("CommitCM.Rebase", current.Name, target); rebase.Icon = App.CreateMenuIcon("Icons.Rebase"); rebase.Click += (_, e) => { @@ -630,7 +632,7 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec }; var interactiveRebase = new MenuItem(); - interactiveRebase.Header = App.Text("CommitCM.InteractiveRebase", current.Name); + interactiveRebase.Header = App.Text("CommitCM.InteractiveRebase", current.Name, target); interactiveRebase.Icon = App.CreateMenuIcon("Icons.InteractiveRebase"); interactiveRebase.Click += async (_, e) => { @@ -871,6 +873,19 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec return menu; } + private static string GetFriendlyNameOfCommit(Models.Commit commit) + { + var branchDecorator = commit.Decorators.Find(x => x.Type is Models.DecoratorType.LocalBranchHead or Models.DecoratorType.RemoteBranchHead); + if (branchDecorator != null) + return branchDecorator.Name; + + var tagDecorator = commit.Decorators.Find(x => x.Type is Models.DecoratorType.Tag); + if (tagDecorator != null) + return tagDecorator.Name; + + return commit.SHA[..10]; + } + private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current) { var submenu = new MenuItem();