now fix the tags

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-31 06:53:20 -06:00
parent 4d38d78b0d
commit eea6a138cb
2 changed files with 51 additions and 26 deletions

View File

@ -2,6 +2,8 @@
package main package main
import ( import (
"path/filepath"
"go.wit.com/log" "go.wit.com/log"
) )
@ -11,7 +13,6 @@ func (r *repo) lookToUnwind() bool {
currentS := r.status.GetCurrentBranchVersion() currentS := r.status.GetCurrentBranchVersion()
log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS) log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS)
curName := r.status.GetCurrentBranchName() curName := r.status.GetCurrentBranchName()
mName := r.status.GetMasterBranchName() mName := r.status.GetMasterBranchName()
@ -29,12 +30,28 @@ func (r *repo) lookToUnwind() bool {
return false return false
} }
if "v" + release.versionS != r.lastTag.String() { if "v"+release.versionS != r.lastTag.String() {
log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS) log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS)
r.setGoSumStatus("CAN NOT UNWIND") r.setGoSumStatus("CAN NOT UNWIND")
return false return false
} }
r.setGoSumStatus("UNWIND") fullpath := filepath.Join(me.goSrcPwd.String(), r.String())
return true testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
log.Info("\trepo is ready. go.mod exists")
r.setGoSumStatus("UNWIND")
return true
}
fullpath = filepath.Join(me.goSrcPwd.String(), r.String())
testf = filepath.Join(fullpath, "go.sum")
if Exists(testf) {
log.Info("\trepo is ready. go.sum exists")
r.setGoSumStatus("UNWIND")
return true
}
r.setGoSumStatus("NO UNWIND?")
return false
} }

View File

@ -17,7 +17,7 @@ func createUnreleaseBox(box *gui.Node) {
log.Info("skipping whitelist", repo.String()) log.Info("skipping whitelist", repo.String())
continue continue
} }
if repo.lookToUnwind() { if repo.lookToUnwind() {
log.Info("found something to unwind:", repo.String()) log.Info("found something to unwind:", repo.String())
if setCurrentRepo(repo, "rewind this", "very sure") { if setCurrentRepo(repo, "rewind this", "very sure") {
@ -28,7 +28,6 @@ func createUnreleaseBox(box *gui.Node) {
}) })
group.NewButton("re-release"+release.versionS, func() { group.NewButton("re-release"+release.versionS, func() {
me.Disable() me.Disable()
defer me.Enable()
if release.current.status.CheckDirty() { if release.current.status.CheckDirty() {
log.Info("sorry, it's still dirty") log.Info("sorry, it's still dirty")
@ -44,28 +43,37 @@ func createUnreleaseBox(box *gui.Node) {
log.Info("\treset to devel", curName, release.versionS, release.reasonS) log.Info("\treset to devel", curName, release.versionS, release.reasonS)
release.current.status.RunCmd([]string{"git", "checkout", "devel"})
release.current.status.RunCmd([]string{"git", "branch", "-D", mName})
release.current.status.RunCmd([]string{"git", "branch", mName})
release.current.status.RunCmd([]string{"git", "checkout", mName})
release.current.status.RunCmd([]string{"git", "push", "--set-upstream", "--force", "origin", mName})
release.current.status.RunCmd([]string{"git", "tag", "--delete", "v" + release.versionS}) var all [][]string
release.current.status.RunCmd([]string{"git", "push", "--delete", "origin", "v" + release.versionS}) all = append(all, []string{"git", "checkout", "devel"})
release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS}) all = append(all, []string{"git", "branch", "-D", mName})
release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS}) all = append(all, []string{"git", "branch", mName})
// git tag --delete v0.3 all = append(all, []string{"git", "checkout", mName})
// git push --delete origin v0.3 all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
// git push --set-upstream --force origin guimaster all = append(all, []string{"git", "tag", "--delete", "v" + release.versionS})
all = append(all, []string{"git", "push", "--delete", "origin", "v" + release.versionS})
all = append(all, []string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
all = append(all, []string{"git", "push", "origin", "v" + release.versionS})
// release.current.status.RunCmd([]string{"git", "branch", "--unset-upstream", mName}) if doAll(release.current, all) {
/* log.Info("EVERYTHING OK")
release.current.status.RunCmd([]string{"git", "add", "-f", "go.sum"}) me.Enable()
release.current.status.RunCmd([]string{"git", "commit", "-m", release.reasonS}) } else {
release.current.status.RunCmd([]string{"git", "push"}) log.Info("SOMETHING FAILED")
release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS}) }
release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
*/
}) })
} }
func doAll(r *repo, all [][]string) bool {
for _, cmd := range all {
log.Info("doAll() RUNNING: cmd =", cmd)
err, out := r.status.RunCmd(cmd)
log.Info("doAll() err =", err)
log.Info("doAll() out =", out)
if err != nil {
return false
}
}
return true
}