From a0f5c25e2fe6fbdda1ca9c20fcbb6eb525e466f1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 5 Feb 2024 19:27:19 -0600 Subject: [PATCH] added way to unwind missed repos Signed-off-by: Jeff Carr --- globalDisplayOptions.go | 50 +++++++++++++++++++++++++++++++++++++++++ releaseWindow.go | 20 ++++++++--------- unreleaseWindow.go | 16 ++++++++----- unwind1.sh | 20 +++++++++++++++++ 4 files changed, 91 insertions(+), 15 deletions(-) create mode 100755 unwind1.sh diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 88d1217..f2f7002 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -3,6 +3,7 @@ package main import ( "os" + "strings" "go.wit.com/gui" "go.wit.com/lib/debugger" @@ -109,6 +110,9 @@ func globalDisplayOptions(box *gui.Node) { if whitelist(repo.String()) { continue } + if repo.status.ReadOnly() { + continue + } if repo.status.MakeRedomod() { log.Info("redo go.sum failed on", repo.String()) // me.Enable() @@ -128,6 +132,9 @@ func globalDisplayOptions(box *gui.Node) { if whitelist(repo.String()) { continue } + if repo.status.ReadOnly() { + continue + } repo.status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"}) } me.Enable() @@ -146,6 +153,49 @@ func globalDisplayOptions(box *gui.Node) { me.Enable() }) + group1.NewButton("git ls-files |grep go.mod", func() { + // var all []string + for _, repo := range me.allrepos { + log.Info("repo:", repo.String()) + if repo.status.ReadOnly() { + continue + } + if whitelist(repo.String()) { + log.Warn("skipping whitelist", repo.String()) + continue + } + good, files := repo.status.GitLsFiles() + if !good { + log.Warn("Something went wrong", repo.String()) + 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.lastTag.String(), "vs", repo.targetVersion.String()) + if repo.lastTag.String() != repo.targetVersion.String() { + log.Info(repo.lastTag.String(), "vs", repo.targetVersion.String()) + 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.lastTag.String(), "vs", repo.targetVersion.String()) + if repo.lastTag.String() != repo.targetVersion.String() { + log.Info(repo.lastTag.String(), "vs", repo.targetVersion.String()) + log.Info("Found go.sum. version mismatch") + setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit") + return + } + } + } + } + log.Info("All repos seem okay") + }) + group2 := vbox.NewGroup("Debugger") group2.NewButton("logging Window", func() { logsettings.LogWindow() diff --git a/releaseWindow.go b/releaseWindow.go index f18aa51..b42af2a 100644 --- a/releaseWindow.go +++ b/releaseWindow.go @@ -138,7 +138,7 @@ func createReleaseBox(box *gui.Node) { var all [][]string all = append(all, []string{"git", "add", "-f", "go.mod"}) - if release.status.String() == "PRIMATIVE" { + if release.current.status.CheckPrimativeGoMod() { // don't add go.sum here. TODO: check for go.sum file and fail } else { all = append(all, []string{"git", "add", "-f", "go.sum"}) @@ -306,16 +306,16 @@ func createReleaseBox(box *gui.Node) { }) /* - release.grid.NewButton("CheckPrimativeGoMod()", func() { - tmp := release.current.String() - log.Info("Run CheckGoSum on repo:", tmp) - if release.current.status.CheckPrimativeGoMod() { - log.Info("repo has PRIMATIVE go.mod") - } else { - log.Info("repo go.mod requies checking for a go.sum") - } + release.grid.NewButton("CheckPrimativeGoMod()", func() { + tmp := release.current.String() + log.Info("Run CheckGoSum on repo:", tmp) + if release.current.status.CheckPrimativeGoMod() { + log.Info("repo has PRIMATIVE go.mod") + } else { + log.Info("repo go.mod requies checking for a go.sum") + } - }) + }) */ release.makeRedomodB = release.grid.NewButton("make redomod", func() { diff --git a/unreleaseWindow.go b/unreleaseWindow.go index fba1b85..e5727f7 100644 --- a/unreleaseWindow.go +++ b/unreleaseWindow.go @@ -28,12 +28,12 @@ func findUnreleased() bool { } func unwindWhitelist() { - for _, repo := range me.allrepos { - if strings.HasPrefix(repo.String(), "go.wit.com/dev") { - release.whitelist[repo.String()] = repo - repo.setGoSumStatus("WHITELIST") - } + for _, repo := range me.allrepos { + if strings.HasPrefix(repo.String(), "go.wit.com/dev") { + release.whitelist[repo.String()] = repo + repo.setGoSumStatus("WHITELIST") } + } } func createUnreleaseBox(box *gui.Node) { @@ -117,6 +117,12 @@ func rerelease() bool { log.Info("\treset to devel", curName, release.version.String(), me.releaseReasonS) + // git checkout devel + // git branch -D master + // git branch master + // git checkout master + // git push --set-upstream --force origin master + var all [][]string all = append(all, []string{"git", "checkout", "devel"}) all = append(all, []string{"git", "branch", "-D", mName}) diff --git a/unwind1.sh b/unwind1.sh new file mode 100755 index 0000000..28e0304 --- /dev/null +++ b/unwind1.sh @@ -0,0 +1,20 @@ +#!/bin/bash -x + +if [ "$1" == "guimaster" ]; then + git checkout devel + git branch -D guimaster + git branch guimaster + git checkout guimaster + git push --set-upstream --force origin guimaster + exit +fi + +if [ "$1" == "master" ]; then + git checkout devel + git branch -D master + git branch master + git checkout master + git push --set-upstream --force origin master + exit +fi +