summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
authorGlenn Vriesman <glenn.vriesman@gmail.com>2018-11-29 17:57:38 +0100
committerJesse Duffield <jessedduffield@gmail.com>2018-12-11 09:39:54 +1100
commit27994f7de83bdf14982544e7dce390bc1b157b66 (patch)
treed5a56e23b8447164c91f66e2057fefa4f185622d /pkg/gui/branches_panel.go
parent670f0e37c744d6cd9e4641a066b36f087d9ce2fa (diff)
Added rebase handler
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index a0e3448f6..631c80608 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -94,6 +94,27 @@ func (gui *Gui) handleBranchesPrevLine(g *gocui.Gui, v *gocui.View) error {
// specific functions
+func (gui *Gui) handleRebase(g *gocui.Gui, v *gocui.View) error {
+
+ selectedBranch := gui.getSelectedBranch(v).Name
+ checkedOutBranch := gui.State.Branches[0].Name
+ title := "Rebasing"
+ prompt := fmt.Sprintf("Are you sure you want to rebase %s onto %s?", checkedOutBranch, selectedBranch)
+
+ return gui.createConfirmationPanel(g, v, title, prompt,
+ func(g *gocui.Gui, v *gocui.View) error {
+ if selectedBranch == checkedOutBranch {
+ return gui.createErrorPanel(g, gui.Tr.SLocalize("CantRebaseOntoSelf"))
+ }
+ if err := gui.GitCommand.RebaseBranch(selectedBranch); err != nil {
+ gui.createErrorPanel(g, "Failed to rebase")
+ return gui.GitCommand.AbortRebaseBranch()
+ }
+
+ return gui.refreshSidePanels(g)
+ }, nil)
+}
+
func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error {
if gui.State.Panels.Branches.SelectedLine == -1 {
return nil