diff --git a/Makefile b/Makefile index 5369d9d..6dd782e 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,9 @@ curl-help: curl-tempWin: curl --silent http://localhost:9419/tempWin +curl-whitelist-gogit2: + curl --silent http://localhost:9419/whitelist?repo=go.wit.com/dev/test/gogit2 + curl-setBranchesToMasterB: curl --silent http://localhost:9419/setBranchesToMasterB @@ -71,16 +74,19 @@ curl-setTargetVersion-virtigo-v0.1.1: curl-incrementAllTargetVersions: curl --silent http://localhost:9419/setAllTargetVersions -curl-IncrementMinorVersion: - curl --silent http://localhost:9419/IncrementMinorVersion?repo=go.wit.com/toolkit/debian +#curl-IncrementMinorVersion: +# curl --silent http://localhost:9419/IncrementMinorVersion?repo=go.wit.com/toolkit/debian -curl-IncrementRevisonVersion: - curl --silent http://localhost:9419/IncrementRevisonVersion?repo=go.wit.com/toolkit/debian +#curl-IncrementRevisonVersion: +# curl --silent http://localhost:9419/IncrementRevisonVersion?repo=go.wit.com/toolkit/debian # report on the release curl-release-list: curl --silent http://localhost:9419/releaseList?readonly=true +curl-release-list-real: + curl --silent http://localhost:9419/releaseList?readonly=true?perfect=false + #curl-doSingleRepo: # curl --silent 'http://localhost:9419/doSingleRepo?repo=go.wit.com/gui&dryrun=false' diff --git a/http.go b/http.go index 9428e7c..a99e6a2 100644 --- a/http.go +++ b/http.go @@ -25,6 +25,15 @@ func okHandler(w http.ResponseWriter, r *http.Request) { var route string route = cleanURL(r.URL.Path) + // common http args that can be set + repoName := r.URL.Query().Get("repo") + version := r.URL.Query().Get("version") + comment := r.URL.Query().Get("comment") + readonly := r.URL.Query().Get("readonly") + onlydirty := r.URL.Query().Get("onlydirty") + perfect := r.URL.Query().Get("perfect") + whitelist := r.URL.Query().Get("whitelist") + switch route { case "/help": msg(w, "list/ list modified repos") @@ -48,7 +57,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { for loop.Scan() { repo := loop.Repo() tempWin.View.ShowRepo(repo) - msg(w, "UnmergedRepo: " + repo.Name()) + msg(w, "UnmergedRepo: "+repo.Name()) } case "/doRelease": buttonDisable() @@ -74,9 +83,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { msg(w, me.current.StandardHeader()) msg(w, me.current.StandardReleaseHeader()) case "/setCurrentRepo": - repoName := r.URL.Query().Get("repo") - version := r.URL.Query().Get("version") - comment := r.URL.Query().Get("comment") msg(w, "repo: "+repoName) msg(w, "version: "+version) @@ -90,19 +96,11 @@ func okHandler(w http.ResponseWriter, r *http.Request) { setCurrentRepo(repo, "HTTP", "doRelease() ?") case "/IncrementRevisonVersion": - repo := r.URL.Query().Get("repo") - version := r.URL.Query().Get("version") - comment := r.URL.Query().Get("comment") - - msg(w, "repo: "+repo) + msg(w, "repo: "+repoName) msg(w, "version: "+version) - me.current.Status.IncrementRevisionVersion(comment) case "/IncrementMinorVersion": - repo := r.URL.Query().Get("repo") - version := r.URL.Query().Get("version") - - msg(w, "repo: "+repo) + msg(w, "repo: "+repoName) msg(w, "version: "+version) me.current.Status.IncrementMinorVersion("trying minor") @@ -116,10 +114,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } return case "/setTargetVersion": - version := r.URL.Query().Get("version") - repo := r.URL.Query().Get("repo") - - msg(w, "repo: "+repo) + msg(w, "repo: "+repoName) msg(w, "version: "+version) if me.current == nil { msg(w, "me.current == nil") @@ -127,7 +122,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } me.current.Status.SetTargetVersion(version) case "/setAllTargetVersions": - version := r.URL.Query().Get("version") msg(w, "version: "+version) loop := me.repos.View.ReposSortByName() @@ -135,13 +129,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) { repo := loop.Repo() master := repo.Status.GetMasterVersion() - cur := repo.Status.GetCurrentVersion() - if master == cur { - repo.Status.SetTargetVersion(cur) + lastTag := repo.Status.LastTag() + if master == lastTag { + repo.Status.SetTargetVersion(master) } else { repo.Status.IncrementRevisionVersion("Nov 2024 test") } } + case "/whitelist": + repo := me.repos.View.FindRepoByName(repoName) + if repo == nil { + msg(w, "FindRepoByName() returned nil") + return + } + msg(w, "whitelisted "+repo.Name()) + if whitelist == "false" { + repo.Status.Whitelist = false + } else { + repo.Status.Whitelist = true + } case "/showNext": msg(w, "gui repo: "+me.release.repo.String()) msg(w, "gui name: "+me.release.version.String()) @@ -164,15 +170,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) { msg(w, me.current.StandardHeader()) msg(w, me.current.StandardReleaseHeader()) case "/list": - readonly := r.URL.Query().Get("readonly") - onlydirty := r.URL.Query().Get("onlydirty") - perfect := r.URL.Query().Get("perfect") - me.repos.View.PrintReport(w, readonly, onlydirty, perfect) case "/releaseList": - readonly := r.URL.Query().Get("readonly") - perfect := r.URL.Query().Get("perfect") - me.repos.View.PrintReleaseReport(w, readonly, perfect) case "/quit": msg(w, "Got URL /quit") diff --git a/mergeAll.go b/mergeAll.go new file mode 100644 index 0000000..7a606be --- /dev/null +++ b/mergeAll.go @@ -0,0 +1,71 @@ +package main + +import ( + "go.wit.com/log" +) + +func mergeAllDevelToMain() bool { + log.Info("merge all here") + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + + if repo.ReadOnly() { + log.Info("skipping readonly", repo.Name(), repo.State()) + continue + } + 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.Name(), repo.State()) + continue + } + log.Info("found", repo.Name(), repo.State()) + repo.NewScan() + if repo.Status.MergeDevelToMaster() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("last repo:", repo.Name()) + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.NewScan() + } + log.Warn("EVERYTHING WORKED") + return true +} + +func mergeAllUserToDevel() bool { + log.Info("merge all here") + loop := me.repos.View.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() + + if repo.ReadOnly() { + log.Info("skipping readonly", repo.Name(), repo.State()) + continue + } + 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.Name(), repo.State()) + continue + } + log.Info("found", repo.Name(), repo.State()) + repo.NewScan() + if repo.Status.MergeUserToDevel() { + log.Warn("THINGS SEEM OK fullAutomation() returned true.") + } else { + log.Warn("last repo:", repo.Status.Path()) + log.Warn("THINGS FAILED fullAutomation() returned false") + return false + } + repo.NewScan() + } + log.Warn("EVERYTHING WORKED") + return true +} diff --git a/tempView.go b/tempView.go index f264432..ee357bd 100644 --- a/tempView.go +++ b/tempView.go @@ -26,8 +26,20 @@ func makeTempView() *repoWindow { hbox.Vertical() box2 := hbox.Box().Vertical() - box2.NewButton("reload values", func() { - // gowit.DumpVersions(me.repos.View) + box2.NewButton("merge user to devel", func() { + mergeAllUserToDevel() + }) + box2.NewButton("merge devel to master", func() { + mergeAllDevelToMain() + }) + box2.NewButton("rescan values", func() { + log.Warn("figure this out") + r.View.ListRows() + /* + for _, repo := range r.View.AllRepos() { + log.Warn("repo:", repo.Name()) + } + */ }) r.View = repolist.TempWindowView(r.box)