diff --git a/docs.go b/docs.go index f740db3..b5baca2 100644 --- a/docs.go +++ b/docs.go @@ -30,10 +30,10 @@ func docsBox(vbox *gui.Node) { fmt.Fprintln(f, "use (") for _, repo := range repolist.AllRepos() { if repo.Exists("go.mod") { - fmt.Fprintln(f, "\t"+repo.String()) + fmt.Fprintln(f, "\t"+repo.Status.GoPath()) } else { - log.Info("missing go.mod for", repo.String()) - repo.MakeRedomod() + log.Info("missing go.mod for", repo.Status.Path()) + repo.Status.MakeRedomod() } } fmt.Fprintln(f, ")") diff --git a/globalBuildOptions.go b/globalBuildOptions.go index ddb38f8..d721293 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -83,7 +83,7 @@ func globalBuildOptions(vbox *gui.Node) { targetName := me.newBranch.String() log.Warn("setting all branches to", targetName) for _, repo := range repolist.AllRepos() { - repo.CheckoutBranch(targetName) + repo.Status.CheckoutBranch(targetName) repo.Scan() } }) diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 52c9ee3..b403677 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -11,12 +11,12 @@ import ( func globalDisplaySetRepoState() { for _, repo := range repolist.AllRepos() { - if repo.IsDirty() { + if repo.Status.IsDirty() { repo.Show() continue } if me.autoHideReadOnly.Checked() { - if repo.ReadOnly() { + if repo.Status.ReadOnly() { repo.Hide() continue } @@ -34,7 +34,7 @@ func globalDisplaySetRepoState() { func globalDisplayShow() { for _, repo := range repolist.AllRepos() { if me.autoHideReadOnly.Checked() { - if repo.ReadOnly() { + if repo.Status.ReadOnly() { continue } } diff --git a/globalResetOptions.go b/globalResetOptions.go index ac719ed..4622f3a 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -31,8 +31,8 @@ func globalResetOptions(box *gui.Node) { buildOptions.NewLabel("start over") me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() { for _, repo := range repolist.AllRepos() { - if repo.CheckDirty() { - log.Warn("repo is dirty. commit your changes first", repo.String()) + if repo.Status.CheckDirty() { + log.Warn("repo is dirty. commit your changes first", repo.Status.Path()) me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)") return } @@ -41,6 +41,14 @@ func globalResetOptions(box *gui.Node) { log.Warn("no repos have uncommited changes") log.Warn("TODO: check things are pushed and check every dir in go/src/") me.deleteGoSrcPkgB.SetLabel("ARE YOU SURE?") + if me.deleteGoSrcPkgB.String() == "ARE YOU SURE?" { + me.deleteGoSrcPkgB.SetLabel("WE ARE NOT KIDDING?") + return + } + if me.deleteGoSrcPkgB.String() == "WE ARE NOT KIDDING" { + me.deleteGoSrcPkgB.SetLabel("ALL 90 REPOS?") + return + } if me.deleteGoSrcPkgB.String() == "ARE YOU SURE?" { homeDir := me.userHomePwd.String() fullpath := filepath.Join(homeDir, "go") diff --git a/handleCmdLine.go b/handleCmdLine.go index 49c5ef7..fdafcbe 100644 --- a/handleCmdLine.go +++ b/handleCmdLine.go @@ -20,7 +20,7 @@ func argGitPull() bool { cmd := []string{"git", "pull"} var failed int = 0 for _, repo := range repolist.AllRepos() { - log.Info("Running:", repo.String(), cmd) + log.Info("Running:", repo.Status.Path(), cmd) err, output := repo.RunCmd(cmd) if err == nil { log.Info(output) @@ -41,12 +41,12 @@ func argCheckoutDevel() bool { var failed int = 0 for _, repo := range repolist.AllRepos() { if repo.CheckDirty() { - log.Info("skipping dirty repo", repo.String()) + log.Info("skipping dirty repo", repo.Name()) continue } - branch := repo.GetDevelBranchName() + branch := repo.Status.GetDevelBranchName() cmd := []string{"git", "checkout", branch} - log.Info("Running:", cmd, "in", repo.String()) + log.Info("Running:", cmd, "in", repo.Name()) err, output := repo.RunCmd(cmd) if err == nil { log.Info("git checkout worked", output) @@ -67,13 +67,13 @@ func argCheckoutUser() bool { me.autotypistWindow.Hide() var failed int = 0 for _, repo := range repolist.AllRepos() { - if repo.CheckDirty() { - log.Info("skipping dirty repo", repo.String()) + if repo.Status.CheckDirty() { + log.Info("skipping dirty repo", repo.Name()) continue } - branch := repo.GetUserBranchName() + branch := repo.Status.GetUserBranchName() cmd := []string{"git", "checkout", branch} - log.Info("Running:", cmd, "in", repo.String()) + log.Info("Running:", cmd, "in", repo.Name()) err, output := repo.RunCmd(cmd) if err == nil { log.Info("git checkout worked", output) diff --git a/repoview.go b/repoview.go index a69cbca..80c4b4b 100644 --- a/repoview.go +++ b/repoview.go @@ -59,7 +59,7 @@ func makeRepoView() *repoWindow { func (r *repoWindow) showApps() { for _, repo := range r.View.AllRepos() { - switch repo.RepoType() { + switch repo.Status.RepoType() { case "binary": //log.Info("compile here. Show()") repo.Show() @@ -118,12 +118,12 @@ func (r *repoWindow) repoAllButtons() { if repo.Hidden() { // log.Info("skip hidden", repo.String()) } else { - log.Info("try to build", repo.String()) - if repo.Build() { - log.Info("build worked", repo.String()) + log.Info("try to build", repo.Name()) + if repo.Status.Build() { + log.Info("build worked", repo.Name()) } else { - log.Info("build failed", repo.String()) - go repo.Xterm("bash") + log.Info("build failed", repo.Name()) + go repo.Status.Xterm("bash") return } } @@ -138,23 +138,23 @@ func (r *repoWindow) mergeAllDevelToMain() bool { log.Info("merge all here") for _, repo := range r.View.AllRepos() { if repo.ReadOnly() { - log.Info("skipping readonly", repo.String(), repo.Status()) + log.Info("skipping readonly", repo.Name(), repo.State()) continue } - if repo.Status() != "merge to main" { - log.Info("skipping. not merge to main", repo.String(), repo.Status()) + if repo.State() != "merge to main" { + log.Info("skipping. not merge to main", repo.Name(), repo.State()) continue } if repo.CheckDirty() { - log.Info("skipping dirty", repo.String(), repo.Status()) + log.Info("skipping dirty", repo.Name(), repo.State()) continue } - log.Info("found", repo.String(), repo.Status()) + log.Info("found", repo.Name(), repo.State()) repo.NewScan() - if repo.MergeDevelToMaster() { + if repo.Status.MergeDevelToMaster() { log.Warn("THINGS SEEM OK fullAutomation() returned true.") } else { - log.Warn("last repo:", repo.Path()) + log.Warn("last repo:", repo.Name()) log.Warn("THINGS FAILED fullAutomation() returned false") return false } @@ -168,23 +168,23 @@ func (r *repoWindow) mergeAllUserToDevel() bool { log.Info("merge all here") for _, repo := range r.View.AllRepos() { if repo.ReadOnly() { - log.Info("skipping readonly", repo.String(), repo.Status()) + log.Info("skipping readonly", repo.Name(), repo.State()) continue } - if repo.Status() != "merge to devel" { - log.Info("skipping. not merge to devel", repo.String(), repo.Status()) + if repo.State() != "merge to devel" { + log.Info("skipping. not merge to devel", repo.Name(), repo.State()) continue } if repo.CheckDirty() { - log.Info("skipping dirty", repo.String(), repo.Status()) + log.Info("skipping dirty", repo.Name(), repo.State()) continue } - log.Info("found", repo.String(), repo.Status()) + log.Info("found", repo.Name(), repo.State()) repo.NewScan() - if repo.MergeUserToDevel() { + if repo.Status.MergeUserToDevel() { log.Warn("THINGS SEEM OK fullAutomation() returned true.") } else { - log.Warn("last repo:", repo.Path()) + log.Warn("last repo:", repo.Status.Path()) log.Warn("THINGS FAILED fullAutomation() returned false") return false } diff --git a/submitPatches.go b/submitPatches.go index b835b6f..dfdb402 100644 --- a/submitPatches.go +++ b/submitPatches.go @@ -28,6 +28,7 @@ type patchSummary struct { checkB *gui.Node totalOL *gadgets.OneLiner + totalGoOL *gadgets.OneLiner dirtyOL *gadgets.OneLiner readonlyOL *gadgets.OneLiner totalPatchesOL *gadgets.OneLiner @@ -63,9 +64,9 @@ func submitPatchesBox(box *gui.Node) *patchSummary { err, output := repo.RunCmd(gitcmd) log.Info("output =", output) if err == nil { - log.Info("git fetch worked", repo.String()) + log.Info("git fetch worked", repo.Name()) } else { - log.Info("git fetch failed", repo.String()) + log.Info("git fetch failed", repo.Name()) return } } @@ -82,9 +83,9 @@ func submitPatchesBox(box *gui.Node) *patchSummary { err, output := repo.RunCmd(gitcmd) log.Info("output =", output) if err == nil { - log.Info("git push worked", repo.String()) + log.Info("git push worked", repo.Name()) } else { - log.Info("git push failed", repo.String()) + log.Info("git push failed", repo.Name()) return } } @@ -158,6 +159,9 @@ func submitPatchesBox(box *gui.Node) *patchSummary { s.totalOL = gadgets.NewOneLiner(s.grid, "Total") s.grid.NextRow() + s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") + s.grid.NextRow() + s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") s.grid.NextRow() @@ -198,22 +202,26 @@ func submitPatchesBox(box *gui.Node) *patchSummary { } func (s *patchSummary) Update() { - var total, dirty, readonly int + var total, totalgo, dirty, readonly int for _, repo := range repolist.AllRepos() { total += 1 - if repo.IsDirty() { - if repo.String() == "go.wit.com/apps/autotypist" { + if repo.Status.IsDirty() { + if repo.Status.GoPath() == "go.wit.com/apps/autotypist" { // log.Info("ignoring dirty autotypist for now") dirty += 1 } else { dirty += 1 } } - if repo.ReadOnly() { + if repo.Status.ReadOnly() { readonly += 1 } + if repo.Status.IsGoLang() { + totalgo += 1 + } } s.totalOL.SetText(strconv.Itoa(total) + " repos") + s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") diff --git a/tagWindow.go b/tagWindow.go index df89062..f34be05 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -50,7 +50,7 @@ func makeTagWindow() *tagWindow { for _, repo := range repolist.AllRepos() { allTags := repo.AllTags() for _, t := range allTags { - log.Info("found tag:", t.TagString(), "from", repo.String()) + log.Info("found tag:", t.TagString(), "from", repo.Name()) } } }).SetProgName("TAGSLISTALL") @@ -59,7 +59,7 @@ func makeTagWindow() *tagWindow { me.autotypistWindow.Disable() defer me.autotypistWindow.Enable() for _, repo := range repolist.AllRepos() { - if repo.String() == "go.wit.com/lib/gadgets" { + if repo.GoPath() == "go.wit.com/lib/gadgets" { // only do log for now } else { // continue @@ -69,15 +69,15 @@ func makeTagWindow() *tagWindow { deleteTags := tagsW.List() for _, t := range deleteTags { tagW.grid.NewLabel(t.TagString()) - tagW.grid.NewLabel(repo.String()) + tagW.grid.NewLabel(repo.Name()) tagW.grid.NewButton("delete", func() { repo.DeleteTag(t) }) tagW.grid.NextRow() if me.autoDryRun.Checked() { - log.Info("delete tag --dry-run:", t.TagString(), "from", repo.String()) + log.Info("delete tag --dry-run:", t.TagString(), "from", repo.Name()) } else { - log.Info("Deleting tag:", t.TagString(), "from", repo.String()) + log.Info("Deleting tag:", t.TagString(), "from", repo.Name()) go repo.DeleteTag(t) log.Sleep(1) }