From 97d7a8ad0c241192a8909b6c7bea5444dc9206d1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 30 Mar 2020 08:49:20 +1100 Subject: [PATCH] add reverse patch option --- pkg/gui/patch_options_panel.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index 046f89b68..b69d12d92 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -22,7 +22,11 @@ func (gui *Gui) handleCreatePatchOptionsMenu(g *gocui.Gui, v *gocui.View) error }, { displayString: "apply patch", - onPress: gui.handleApplyPatch, + onPress: func() error { return gui.handleApplyPatch(false) }, + }, + { + displayString: "apply patch in reverse", + onPress: func() error { return gui.handleApplyPatch(true) }, }, { displayString: "reset patch", @@ -133,12 +137,12 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error { } } -func (gui *Gui) handleApplyPatch() error { +func (gui *Gui) handleApplyPatch(reverse bool) error { if err := gui.returnFocusFromLineByLinePanelIfNecessary(); err != nil { return err } - if err := gui.GitCommand.PatchManager.ApplyPatches(false); err != nil { + if err := gui.GitCommand.PatchManager.ApplyPatches(reverse); err != nil { return gui.surfaceError(err) } return gui.refreshSidePanels(refreshOptions{mode: ASYNC})