summaryrefslogtreecommitdiff
path: root/pkg/gui/branchview.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/branchview.go')
-rw-r--r--pkg/gui/branchview.go33
1 files changed, 30 insertions, 3 deletions
diff --git a/pkg/gui/branchview.go b/pkg/gui/branchview.go
index a64c3c3..b6a2b43 100644
--- a/pkg/gui/branchview.go
+++ b/pkg/gui/branchview.go
@@ -10,7 +10,7 @@ import (
// updates the branchview for given entity
func (gui *Gui) updateBranch(g *gocui.Gui, entity *git.RepoEntity) error {
var err error
- out, err := g.View("branch")
+ out, err := g.View(branchViewFeature.Name)
if err != nil {
return err
}
@@ -38,11 +38,38 @@ func (gui *Gui) nextBranch(g *gocui.Gui, v *gocui.View) error {
entity := gui.getSelectedRepository()
if err = entity.Checkout(entity.NextBranch()); err != nil {
if err = gui.openErrorView(g, err.Error(),
- "You should manually resolve this issue"); err != nil {
+ "You should manually resolve this issue",
+ branchViewFeature.Name); err != nil {
return err
}
return nil
}
+ if err = gui.checkoutFollowUp(g, entity); err != nil {
+ return err
+ }
+ return nil
+}
+
+// iteration handler for the branchview
+func (gui *Gui) previousBranch(g *gocui.Gui, v *gocui.View) error {
+ var err error
+ entity := gui.getSelectedRepository()
+ if err = entity.Checkout(entity.PreviousBranch()); err != nil {
+ if err = gui.openErrorView(g, err.Error(),
+ "You should manually resolve this issue",
+ branchViewFeature.Name); err != nil {
+ return err
+ }
+ return nil
+ }
+ if err = gui.checkoutFollowUp(g, entity); err != nil {
+ return err
+ }
+ return nil
+}
+
+// after checkout a branch some refreshments needed
+func (gui *Gui) checkoutFollowUp(g *gocui.Gui, entity *git.RepoEntity) (err error) {
if err = gui.updateBranch(g, entity); err != nil {
return err
}
@@ -56,4 +83,4 @@ func (gui *Gui) nextBranch(g *gocui.Gui, v *gocui.View) error {
return err
}
return nil
-}
+} \ No newline at end of file