diff options
author | glendsoza <gledsouza23@gmail.com> | 2022-01-23 13:16:21 +0530 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-26 09:04:12 +1100 |
commit | 0c6bdac2f789bb595825dd958a48147e41332e7e (patch) | |
tree | c2981013420a2d39c343d52d2429184c65538106 | |
parent | 257e222f8d28e8b678ae996f779dc4a4bb76a434 (diff) |
Changes as per review
-rw-r--r-- | pkg/gui/commits_panel.go | 32 | ||||
-rw-r--r-- | pkg/i18n/english.go | 2 |
2 files changed, 24 insertions, 10 deletions
diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 8ba537d6e..4e3e7b0ad 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -462,6 +462,9 @@ func (gui *Gui) handleCommitPick() error { } func (gui *Gui) handleCommitRevert() error { + if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { + return err + } commit := gui.getSelectedLocalCommit() return gui.ask(askOpts{ title: gui.Tr.Actions.RevertCommit, @@ -471,9 +474,6 @@ func (gui *Gui) handleCommitRevert() error { "selectedCommit": commit.ShortSha(), }), handleConfirm: func() error { - if ok, err := gui.validateNotInFilterMode(); err != nil || !ok { - return err - } if commit.IsMerge() { return gui.createRevertMergeCommitMenu(commit) @@ -496,16 +496,30 @@ func (gui *Gui) createRevertMergeCommitMenu(commit *models.Commit) error { if err != nil { return gui.surfaceError(err) } - + parentShortSha := utils.SafeTruncate(parentSha, 8) menuItems[i] = &menuItem{ - displayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message), + displayString: fmt.Sprintf("%s: %s", parentShortSha, message), onPress: func() error { parentNumber := i + 1 gui.logAction(gui.Tr.Actions.RevertCommit) - if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil { - return gui.surfaceError(err) - } - return gui.afterRevertCommit() + gui.ask(askOpts{ + title: gui.Tr.SelectParentCommitForMerge, + prompt: utils.ResolvePlaceholderString( + "Are you sure you want use {{.selectedParentCommit}} as parent commit?", + map[string]string{ + "selectedParentCommit": parentShortSha, + }), + handleConfirm: func() error { + if err := gui.Git.Commit.RevertMerge(commit.Sha, parentNumber); err != nil { + return gui.surfaceError(err) + } + return gui.afterRevertCommit() + }, + handleClose: func() error { + return gui.pushContext(gui.State.Contexts.Menu) + }, + }) + return nil }, } } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 8b421de08..5f03881a6 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1028,7 +1028,7 @@ func EnglishTranslationSet() TranslationSet { CantChangeContextSizeError: "Cannot change context while in patch building mode because we were too lazy to support it when releasing the feature. If you really want it, please let us know!", LcOpenCommitInBrowser: "open commit in browser", LcViewBisectOptions: "view bisect options", - ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}? ", + ConfirmRevertCommit: "Are you sure you want to revert {{.selectedCommit}}?", Actions: Actions{ // TODO: combine this with the original keybinding descriptions (those are all in lowercase atm) CheckoutCommit: "Checkout commit", |