diff --git a/doRelease.go b/doRelease.go index 4c19b98..71ca2aa 100644 --- a/doRelease.go +++ b/doRelease.go @@ -16,7 +16,7 @@ import ( ) func doRelease() bool { - log.Info("doRelease() on", me.current.Name()) + log.Info("doRelease() on", me.current.GetGoPath()) if !findOk { log.Info("doRelease() immediately end something went wrong last time. findOk == false") return false @@ -41,8 +41,8 @@ func doRelease() bool { return false } - curName := me.current.Status.GetCurrentBranchName() - mName := me.current.Status.GetMasterBranchName() + curName := me.current.GetCurrentBranchName() + mName := me.current.GetMasterBranchName() if curName != mName { log.Info("\trepo is not working from main branch", curName, "!=", mName) return false @@ -122,7 +122,7 @@ func doRelease() bool { badExit(errors.New(msg)) } - if !me.current.Status.DoAll(all) { + if !me.current.RunAll(all) { log.Info("failed to make new release", me.release.version.String()) findOk = false return false @@ -159,7 +159,7 @@ func doRelease() bool { // unwind and re-tag. Now that the go.mod and go.sum are published, revert // to the development branch - if !me.current.Status.RevertMasterToDevel() { + if !me.current.RevertMasterToDevel() { log.Info("Revert Failed") findOk = false return false @@ -179,12 +179,12 @@ func doRelease() bool { check.Run(cmd) } - if !me.current.Status.DoAll(retag) { + if !me.current.RunAll(retag) { log.Info("retag failed") findOk = false return false } - log.Info("EVERYTHING OK. RERELEASED", me.current.Name()) + log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath()) // save autogen files under the tag version (for example: "v0.2.3") newtag := me.release.version.String() @@ -200,7 +200,9 @@ func doRelease() bool { me.forge = forgepb.Init() // update the values in the GUI - me.current.NewScan() + if repov := me.repos.View.FindByPath(check.GetGoPath()); repov != nil { + repov.NewScan2(check) + } // attempt to find another repo to release if !doReleaseFindNext() { @@ -211,7 +213,7 @@ func doRelease() bool { os.Setenv("FindNextDone", "true") return false } - log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.Name()) + log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.GetGoPath()) return true } @@ -252,7 +254,7 @@ func doPublishVersion() bool { docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()} log.Info("SHOULD RUN cmd HERE:", docmd) - if me.current.Status.IsPrivate() { + if me.forge.Config.IsPrivate(me.current.GetGoPath()) { // do not self update private repos log.Info("This is a private repo and can not be self checked") return true diff --git a/findNext.go b/findNext.go index c3ca8b5..1e04bc9 100644 --- a/findNext.go +++ b/findNext.go @@ -6,7 +6,6 @@ import ( "go.wit.com/log" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/protobuf/gitpb" ) @@ -19,14 +18,13 @@ var findOk bool = true // rename this findNext() func findNext() bool { findCounter = 0 - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + check := all.Next() - check := me.forge.FindByGoPath(repo.GetGoPath()) - if check == nil { - log.Info("boo, you didn't git clone", repo.GetGoPath()) - return false + if check.GetTargetVersion() == "" { + // not set to upgrade + continue } if check.GetLastTag() == check.GetTargetVersion() { // log.Info("findNext() no update needed", check.GetGoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion()) @@ -73,7 +71,7 @@ func findNext() bool { log.Info("go.mod is gone here") } if me.forge.FinalGoDepsCheckOk(check) { - setCurrentRepo(repo, "should be good to release", "pretty sure") + setCurrentRepo(check, "should be good to release", "pretty sure") if check.Exists("go.mod") { log.Info("go.mod exists here") } else { @@ -86,7 +84,7 @@ func findNext() bool { } else { log.Info("go.mod is gone here") } - log.Info("findNext() got to the end. repo", repo.GetGoPath(), "did not work. trying to find a new one now") + log.Info("findNext() got to the end. repo", check.GetGoPath(), "did not work. trying to find a new one now") } if findCounter == 0 { log.Info("NOTHING TO UPDATE. findCounter =", findCounter) @@ -166,17 +164,11 @@ func fixGodeps(check *gitpb.Repo) bool { return good } -func setCurrentRepo(repo *repolist.RepoRow, s string, note string) bool { - check := me.forge.FindByGoPath(repo.GetGoPath()) - if check == nil { - log.Info("boo, you didn't git clone", repo.GetGoPath()) - return false - } - +func setCurrentRepo(check *gitpb.Repo, s string, note string) bool { me.release.repo.SetText(check.GetGoPath()) me.release.status.SetText(s) me.release.notes.SetText(note) - me.current = repo + me.current = check me.release.version.SetText(check.GetTargetVersion()) me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion()) me.release.openrepo.Enable() diff --git a/http.go b/http.go index 77023a0..7665c7f 100644 --- a/http.go +++ b/http.go @@ -75,8 +75,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - log.Info(me.current.StandardHeader()) - log.Info(me.current.StandardReleaseHeader()) + // log.Info(me.current.StandardHeader()) + log.Info(me.forge.StandardReleaseHeader(me.current, "todoing")) case "/rescanAll": me.repos.View.ScanRepositories() case "/setCurrentRepo": @@ -85,7 +85,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { log.Info("version: " + version) log.Info("comment: " + comment) - repo := me.repos.View.FindByName(repoName) + repo := me.forge.FindByGoPath(repoName) if repo == nil { log.Info("FindRepoByName() returned nil") return @@ -95,12 +95,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) { case "/IncrementRevisonVersion": log.Info("repo: " + repoName) log.Info("version: " + version) - me.current.Status.IncrementRevisionVersion(comment) + me.current.IncrementTargetRevision() case "/IncrementMinorVersion": log.Info("repo: " + repoName) log.Info("version: " + version) - me.current.Status.IncrementMinorVersion("trying minor") + me.current.IncrementTargetMinor() case "/setAllBranchesToMaster": log.Info("set all branches to master") me.Disable() @@ -128,7 +128,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { log.Info("me.current == nil") return } - me.current.Status.SetTargetVersion(version) + me.current.SetTargetVersion(version) return case "/setAllTargetVersions": log.Info("version: " + version) @@ -263,7 +263,10 @@ func showNext() { return } - if me.current.Status.IsReleased() { + if me.current.GetTargetVersion() == "" { + log.Info("TargetVersion == blank") + } + if me.current.GetTargetVersion() == me.current.GetCurrentVersion() { log.Info("IsReleased() == true. do not release this a second time") } else { log.Info("IsReleased() == false") @@ -298,18 +301,11 @@ func showNext() { log.Info(log.Sprint("IsProtobuf() == err", err)) } } - if me.current.Status.Whitelist { - log.Info("Whitelist == true SHOULD NOT RELEASE THIS") - } else { - log.Info("Whitelist == false") - } - log.Info("") testNext() log.Info(repolist.ReportHeader()) - log.Info(me.current.StandardHeader()) log.Info("") log.Info(repolist.ReleaseReportHeader()) - log.Info(me.current.StandardReleaseHeader()) + log.Info(me.forge.StandardReleaseHeader(me.current, "notsure")) } diff --git a/releaseBox.go b/releaseBox.go index b73f7e4..67ac284 100644 --- a/releaseBox.go +++ b/releaseBox.go @@ -4,7 +4,6 @@ package main import ( "fmt" "os" - "strings" "time" "go.wit.com/gui" @@ -71,7 +70,9 @@ func createReleaseBox(box *gui.Node) { me.release.repo = gadgets.NewOneLiner(me.release.grid, "repo") me.release.openrepo = me.release.grid.NewButton("Configure", func() { - me.current.Status.Toggle() + if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil { + repov.Status.Toggle() + } }) me.release.openrepo.Disable() me.release.grid.NextRow() @@ -104,8 +105,10 @@ func createReleaseBox(box *gui.Node) { grid.NewButton("whitelist", func() { // tmp := me.current.GoState() - log.Info("trying to whitelist repo", me.current.GetGoPath()) - me.current.Status.Whitelist = true + if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil { + log.Info("trying to whitelist repo", me.current.GetGoPath()) + repov.Status.Whitelist = true + } findNext() }) @@ -191,51 +194,6 @@ func createReleaseBox(box *gui.Node) { } }) grid.NextRow() - - grid.NewButton("git ls-files |grep go.mod", func() { - loop := me.repos.View.ReposSortByName() - for loop.Scan() { - repo := loop.Repo() - log.Info("repo:", repo.Name()) - if repo.Status.ReadOnly() { - continue - } - if repo.Status.Whitelist { - log.Warn("skipping whitelist", repo.GetGoPath()) - continue - } - good, files := repo.Status.GitLsFiles() - if !good { - log.Warn("Something went wrong", repo.GetGoPath()) - continue - } - for _, filename := range strings.Split(files, "\n") { - log.Info("\tfile", filename) - if filename == "go.mod" { - log.Info("Found go.mod. does version match release version?") - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() { - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - log.Info("Found go.sum. version mismatch") - setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit") - return - } - } - if filename == "go.sum" { - log.Info("Found go.sum. does version match release version?") - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() { - log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion()) - log.Info("Found go.sum. version mismatch") - setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit") - return - } - } - } - } - log.Info("All repos seem okay") - }) - grid.NextRow() } func doReleaseAll() (bool, time.Duration) { diff --git a/structs.go b/structs.go index 54ae116..567a715 100644 --- a/structs.go +++ b/structs.go @@ -4,7 +4,6 @@ package main import ( "go.wit.com/gui" "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" ) @@ -19,7 +18,7 @@ type autoType struct { reposbox *gui.Node reposgrid *gui.Node reposgroup *gui.Node - current *repolist.RepoRow + current *gitpb.Repo // this is the repo we are starting in // make sure it never changes so go.mod and go.sum are always there