summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-02-16 09:09:48 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-02-16 09:57:49 +1100
commitf528e12c8364f55c7cc822e2e245a2b055c1943a (patch)
tree6b3a1872b53faff48a97415502eda92499abe978
parent8ca9f93ccf9faafa776264be06520b8199fe9162 (diff)
allow resetting to tag
-rw-r--r--pkg/gui/keybindings.go8
-rw-r--r--pkg/gui/tags_panel.go9
-rw-r--r--pkg/i18n/english.go3
3 files changed, 20 insertions, 0 deletions
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
@@ -578,6 +578,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
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"),
Modifier: gocui.ModNone,
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",
},
)
}