From f528e12c8364f55c7cc822e2e245a2b055c1943a Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 16 Feb 2020 09:09:48 +1100 Subject: [PATCH] allow resetting to tag --- pkg/gui/keybindings.go | 8 ++++++++ pkg/gui/tags_panel.go | 9 +++++++++ pkg/i18n/english.go | 3 +++ 3 files changed, 20 insertions(+) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 0afd63a26..9f8263ba7 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -577,6 +577,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Handler: gui.handleCreateTag, Description: gui.Tr.SLocalize("createTag"), }, + { + ViewName: "branches", + Contexts: []string{"tags"}, + Key: gui.getKey("commits.viewResetOptions"), + Modifier: gocui.ModNone, + Handler: gui.handleCreateResetToTagMenu, + Description: gui.Tr.SLocalize("resetToThisTag"), + }, { ViewName: "branches", Key: gui.getKey("universal.nextTab"), diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go index 8b74a3527..0cd6d2859 100644 --- a/pkg/gui/tags_panel.go +++ b/pkg/gui/tags_panel.go @@ -140,3 +140,12 @@ func (gui *Gui) handleCreateTag(g *gocui.Gui, v *gocui.View) error { return gui.refreshTags() }) } + +func (gui *Gui) handleCreateResetToTagMenu(g *gocui.Gui, v *gocui.View) error { + tag := gui.getSelectedTag() + if tag == nil { + return nil + } + + return gui.createResetMenu(tag.Name) +} diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index c010e2068..2ca467be1 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -945,6 +945,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "resetToThisBranch", Other: "reset to the HEAD of this branch", + }, &i18n.Message{ + ID: "resetToThisTag", + Other: "reset to this tag", }, ) }