summaryrefslogtreecommitdiff
path: root/viewTempWindow.go
diff options
context:
space:
mode:
Diffstat (limited to 'viewTempWindow.go')
-rw-r--r--viewTempWindow.go96
1 files changed, 0 insertions, 96 deletions
diff --git a/viewTempWindow.go b/viewTempWindow.go
deleted file mode 100644
index ffb99e5..0000000
--- a/viewTempWindow.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package repolist
-
-import (
- "go.wit.com/gui"
- "go.wit.com/log"
-)
-
-// This creates a view of the repos
-// you can only have one at this point
-func TempWindowView(parent *gui.Node) *RepoList {
- tmp := new(RepoList)
- tmp.viewName = "autotypist"
-
- // me.reposbox = gui.RawBox()
- tmp.reposbox = parent
-
- tmp.reposgroup = tmp.reposbox.NewGroup("git repositories that are not merged")
- tmp.reposgrid = tmp.reposgroup.NewGrid("mergegrid", 0, 0)
-
- tmp.reposgrid.NewLabel("") // path goes here
- tmp.reposgrid.NewLabel("Current Branch")
- tmp.reposgrid.NewLabel("last tag")
- tmp.reposgrid.NewLabel("master")
- tmp.reposgrid.NewLabel("devel")
- tmp.reposgrid.NewLabel("user")
- tmp.reposgrid.NewLabel("?")
-
- tmp.reposgrid.NextRow()
-
- tmp.shownCount = me.blind.NewLabel("showCount")
- tmp.duration = me.blind.NewLabel("duration")
- return tmp
-}
-
-func (r *RepoList) ListRows() {
- for i, row := range r.rows {
- log.Warn("i, row:", i, row.Status.Name(), "curname", row.Status.GetCurrentBranchName())
- row.currentName.SetLabel(row.Status.GetCurrentBranchName())
- }
-}
-
-func (r *RepoList) ShowRepo(repo *RepoRow) error {
- // this is the gui grid. all the widgets get added here
- // at the end we tell the grid go to NextRow()
- grid := r.reposgrid
-
- // make a new row of gui widgets
- newRow := new(RepoRow)
- newRow.Status = repo.Status
-
- newRow.pLabel = grid.NewLabel(repo.Status.Path())
- newRow.currentName = grid.NewLabel(repo.Status.GetCurrentBranchName())
-
- newRow.lastTag = grid.NewLabel(repo.Status.LastTag())
- newRow.masterVersion = grid.NewLabel(repo.Status.GetMasterVersion())
- newRow.develVersion = grid.NewLabel(repo.Status.GetDevelVersion())
- newRow.userVersion = grid.NewLabel(repo.Status.GetUserVersion())
-
- newRow.gitState = grid.NewLabel(repo.Status.GitState())
-
- newRow.endBox = grid.NewHorizontalBox("HBOX")
- newRow.endBox.NewButton("Repo Window", func() {
- newRow.Status.Toggle()
- })
-
- newRow.endBox.NewButton("show diff", func() {
- log.Log(REPOWARN, "show diff currentName =", newRow.currentName.String())
- log.Log(REPOWARN, "show diff masterVersion =", newRow.masterVersion.String())
- // newRow.Status.XtermNohup([]string{"git diff"})
- newRow.Status.Xterm("git diff; bash")
- })
-
- newRow.endBox.NewButton("commit all", func() {
- if !newRow.Status.IsUserBranch() {
- log.Log(REPOWARN, "can not commit on non user branch")
- return
- }
- // restore anything staged so everything can be reviewed
- newRow.Status.Run([]string{"git", "restore", "--staged", "."})
- newRow.Status.XtermWait("git diff")
- newRow.Status.XtermWait("git add --all")
- newRow.Status.XtermWait("git commit -a")
- newRow.Status.XtermWait("git push")
- if newRow.Status.CheckDirty() {
- // commit was not done, restore diff
- newRow.Status.Run([]string{"git", "restore", "--staged", "."})
- } else {
- newRow.NewScan()
- }
- })
-
- newRow.hidden = false
- r.reposgrid.NextRow()
- r.rows = append(r.rows, newRow)
- return nil
-}