summaryrefslogtreecommitdiff
path: root/pkg/gui/stashview.go
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-12-08 18:50:45 +0300
committerIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2018-12-08 18:50:45 +0300
commitd95367a707ffd121e78a07f6a0d1d030fc4ac6b9 (patch)
tree7869fcdffa7d781c2c90cae249c07935b9d62aa9 /pkg/gui/stashview.go
parentMerge remote-tracking branch 'origin/master' into develop (diff)
downloadgitbatch-d95367a707ffd121e78a07f6a0d1d030fc4ac6b9.tar.gz
git add, git reset and git stash implementation added.
Diffstat (limited to 'pkg/gui/stashview.go')
-rw-r--r--pkg/gui/stashview.go45
1 files changed, 44 insertions, 1 deletions
diff --git a/pkg/gui/stashview.go b/pkg/gui/stashview.go
index 8cdc46c..7322328 100644
--- a/pkg/gui/stashview.go
+++ b/pkg/gui/stashview.go
@@ -26,6 +26,49 @@ func (gui *Gui) openStashView(g *gocui.Gui) error {
return nil
}
+//
+func (gui *Gui) stashChanges(g *gocui.Gui, v *gocui.View) error {
+ entity := gui.getSelectedRepository()
+ output, err := entity.Stash()
+ if err != nil {
+ if err = gui.openErrorView(g, output,
+ "You should manually resolve this issue",
+ stashViewFeature.Name); err != nil {
+ return err
+ }
+ }
+ if err := refreshAllStatusView(g, entity); err != nil {
+ return err
+ }
+ return nil
+}
+
+//
+func (gui *Gui) popStash(g *gocui.Gui, v *gocui.View) error {
+ entity := gui.getSelectedRepository()
+ _, oy := v.Origin()
+ _, cy := v.Cursor()
+ if len(entity.Stasheds) <= 0 {
+ return nil
+ }
+ stashedItem := entity.Stasheds[oy+cy]
+ output, err := stashedItem.Pop()
+ if err != nil {
+ if err = gui.openErrorView(g, output,
+ "You should manually resolve this issue",
+ stashViewFeature.Name); err != nil {
+ return err
+ }
+ }
+ if err := entity.Refresh(); err != nil {
+ return err
+ }
+ if err := refreshAllStatusView(g, entity); err != nil {
+ return err
+ }
+ return nil
+}
+
// refresh the main view and re-render the repository representations
func refreshStashView(g *gocui.Gui, entity *git.RepoEntity) error {
stashView, err := g.View(stashViewFeature.Name)
@@ -41,7 +84,7 @@ func refreshStashView(g *gocui.Gui, entity *git.RepoEntity) error {
if i == cy+oy {
prefix = prefix + selectionIndicator
}
- fmt.Fprintf(stashView, "%s%d %s: %s (%s)\n", prefix, stashedItem.StashID, cyan.Sprint(stashedItem.BranchName), stashedItem.Description, stashedItem.Hash)
+ fmt.Fprintf(stashView, "%s%d %s: %s (%s)\n", prefix, stashedItem.StashID, cyan.Sprint(stashedItem.BranchName), stashedItem.Description, cyan.Sprint(stashedItem.Hash))
}
return nil
} \ No newline at end of file