diff --git a/checkout.go b/checkout.go index 9e28ca8..951458a 100644 --- a/checkout.go +++ b/checkout.go @@ -13,10 +13,10 @@ import ( "github.com/destel/rill/mockapi" "go.wit.com/lib/gui/repolist" - "go.wit.com/log" ) // okay +/* func checkoutDevel() bool { log.Info("running git checkout devel everwhere") var failed int = 0 @@ -39,6 +39,7 @@ func checkoutDevel() bool { log.Info("Ran git checkout in", count, "repos. failure count =", failed) return true } +*/ // https://news.ycombinator.com/item?id=42237166 // https://github.com/destel/rill diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 7ebdb19..d22859c 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -2,10 +2,6 @@ package main import ( "os" - "os/user" - "path/filepath" - - "go.wit.com/log" "go.wit.com/gui" "go.wit.com/lib/gadgets" @@ -21,17 +17,6 @@ func globalBuildOptions(vbox *gui.Node) { me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home") grid.NextRow() - usr, _ := user.Current() - homeDir, err := os.UserHomeDir() - if err != nil { - log.Warn("Error getting home directory:", err) - homeDir = "/home/autotypist" - } - me.userHomePwd.SetText(homeDir) - srcDir := filepath.Join(homeDir, "go/src") - me.goSrcPwd.SetText(srcDir) - grid.NextRow() - me.stopOnErrors = grid.NewCheckbox("Stop on errors").SetChecked(true) grid.NextRow() @@ -46,153 +31,4 @@ func globalBuildOptions(vbox *gui.Node) { me.autoDryRun.SetChecked(true) grid.NextRow() - - grid.NewGroup("git checkout") - // checking this will automatically make the branches off of devel - grid.NextRow() - me.autoCreateBranches = grid.NewCheckbox("auto-create {devel,user} branches").SetChecked(true) - me.autoCreateBranches.Custom = func() { - if me.autoCreateBranches.Checked() { - os.Setenv("AUTOTYPIST_CREATE_BRANCHES", "on") - } else { - os.Unsetenv("AUTOTYPIST_CREATE_BRANCHES") - } - } - grid.NextRow() - - grid.NewButton("git checkout master branch", func() { - me.forge.CheckoutMaster() - }) - grid.NewLabel("") // set the order of these in the config file - grid.NextRow() - - grid.NewButton("git checkout devel branch", func() { - me.forge.CheckoutDevel() - }) - grid.NewLabel("") // set the order of these in the config file - grid.NextRow() - - grid.NewButton("git checkout "+usr.Username+" branch", func() { - me.forge.CheckoutUser() - }) - grid.NewLabel("") - grid.NextRow() - - // select the branches you want to test, build and develop against - // let's call this the 'mode' ? - // this lets you select your user branch, but, when you are happy - // you can merge everything into the devel branch and make sure it actually - // works. Then, when that is good, merge and version everything in master - /* - if repo.Status.BranchExists(targetName) { - ok := repo.Status.CheckoutBranch(targetName) - if ok { - // checkout went fine - continue - } - log.Info("couldn't set", repo.Status.Path(), "branch to", targetName) - log.Info("but branch exists so something went wrong") - continue - } - if !me.autoCreateBranches.Checked() { - log.Info("not auto creating branch", targetName) - continue - } - // branch doesn't exist. make it - // todo: make this branch from 'devel' branch if it exists - log.Info("should make the", targetName, "branch here!") - if me.autoCreateBranches.Checked() { - log.Info("going to make the branch!") - repo.Status.RunCmd([]string{"git", "branch", targetName}) - repo.Status.RunCmd([]string{"git", "checkout", targetName}) - } else { - log.Info("not auto creating branch", targetName) - } - repo.Scan() - count += 1 - */ - - grid.NextRow() - - grid.NewGroup("update all repos from upstream") - grid.NextRow() - grid.NewButton("git pull", func() { - me.Disable() - defer me.Enable() - rillGitPull() - /* - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - repo.Run([]string{"git", "pull"}) - } - */ - }) - grid.NextRow() - - // TODO: fix this - grid.NewButton("git fetch", func() { - me.Disable() - defer me.Enable() - log.Warn("updating all master branches") - var count, failed int - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - var err error - var out string - count += 1 - if err, out = repo.Status.FetchMaster(); err != nil { - log.Warn(repo.Name(), "fetch failed", err, out) - failed += 1 - } else { - log.Warn(repo.Name(), "fetch sent:", out) - } - if err, out = repo.Status.FetchDevel(); err != nil { - log.Warn(repo.Name(), "fetch failed", err, out) - failed += 1 - } else { - log.Warn(repo.Name(), "fetch sent:", out) - } - } - log.Warn("updated all master branches", count, "failed =", failed) - }) - grid.NextRow() - - grid.NewGroup("build") - grid.NextRow() - me.autoRebuildButton = grid.NewButton("rebuild autotypist", func() { - me.autoRebuildButton.Disable() - me.autoRebuildButton.SetLabel("running....") - attemptAutoRebuild() - me.autoRebuildButton.Enable() - me.autoRebuildButton.SetLabel("rebuild autotypist") - }) - grid.NextRow() - - grid.NewButton("go build", func() { - me.Disable() - defer me.Enable() - // r.showApps() - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - if repo.Hidden() { - // log.Info("skip hidden", repo.String()) - } else { - log.Info("try to build", repo.Name()) - if repo.Status.Build() { - log.Info("build worked", repo.Name()) - } else { - log.Info("build failed", repo.Name()) - go repo.Status.Xterm("bash") - return - } - } - } - log.Info("") - log.Info("every build worked !!!") - log.Info("") - }) - grid.NextRow() } diff --git a/globalResetOptions.go b/globalResetOptions.go index 17a5c68..3f7e2d8 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -1,7 +1,6 @@ package main import ( - "os" "path/filepath" "strconv" "strings" @@ -20,69 +19,6 @@ func globalResetOptions(box *gui.Node) { }) grid.NextRow() - grid.NewButton("delete user branches", func() { - os.Setenv("REPO_FORCE", "off") - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - repo.Status.DeleteUserBranch(false) - } - }) - grid.NextRow() - - grid.NewButton("delete user branches --force", func() { - os.Setenv("REPO_FORCE", "on") - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - repo.Status.DeleteUserBranch(true) - } - }) - grid.NextRow() - - grid.NewButton("git reset all branches", func() { - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - repo.Status.ResetBranches() - } - }) - grid.NextRow() - - grid.NewButton("rm -f go.mod go.sum", func() { - me.Disable() - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - if repo.Status.Whitelist { - continue - } - if repo.Status.ReadOnly() { - continue - } - repo.Status.Run([]string{"rm", "-f", "go.mod", "go.sum"}) - } - me.Enable() - }) - grid.NextRow() - - grid.NewButton("git reset --hard", func() { - me.Disable() - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - if repo.Status.Whitelist { - continue - } - if repo.Status.ReadOnly() { - continue - } - repo.Status.Run([]string{"git", "reset", "--hard"}) - } - me.Enable() - }) - grid.NextRow() - // this dumps everything grid.NewLabel("clean start over") me.deleteGoSrcPkgB = grid.NewButton("rm ~/go/src & ~/go/pkg & ~/.cache/go-build", func() { diff --git a/hideFunction.go b/hideFunction.go index 569988c..24a6de6 100644 --- a/hideFunction.go +++ b/hideFunction.go @@ -1,11 +1,6 @@ package main -import ( - "os" - - "go.wit.com/lib/gui/repolist" -) - +/* // like tcl/tk, use ENV variables to set display preferences func hideFunction(r *repolist.RepoRow) { // always show dirty repos @@ -48,3 +43,4 @@ func hideFunction(r *repolist.RepoRow) { // as read-only=true r.Show() } +*/ diff --git a/main.go b/main.go index e6c599b..e97364e 100644 --- a/main.go +++ b/main.go @@ -76,7 +76,7 @@ func main() { // handleCmdLine() // setup the autoscan functions - me.repos.View.RegisterHideFunction(hideFunction) + // me.repos.View.RegisterHideFunction(hideFunction) // processing is done. update the repo summary box // me.summary.Update() diff --git a/repoview.go b/repoview.go index d1f9dde..db8ce53 100644 --- a/repoview.go +++ b/repoview.go @@ -113,22 +113,24 @@ func (r *repoWindow) repoMenu() *gui.Node { }) box2.NewButton("show apps", func() { - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - rtype := repo.Status.RepoType() - switch rtype { - case "'binary'": - // log.Info(repo.Status.Path(), "compile here. Show()") - repo.Show() - case "'library'": - // log.Info(repo.Status.Path(), "library here. Hide()") - repo.Hide() - default: - log.Info(repo.Status.Path(), "unknown type", rtype) - // repo.Hide() + /* + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + rtype := repo.Status.RepoType() + switch rtype { + case "'binary'": + // log.Info(repo.Status.Path(), "compile here. Show()") + repo.Show() + case "'library'": + // log.Info(repo.Status.Path(), "library here. Hide()") + repo.Hide() + default: + log.Info(repo.Status.Path(), "unknown type", rtype) + // repo.Hide() + } } - } + */ }) box2.NewButton("scan now", func() { log.Info("re-scanning now")