summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lookForUnwind.go25
-rw-r--r--unreleaseWindow.go52
2 files changed, 51 insertions, 26 deletions
diff --git a/lookForUnwind.go b/lookForUnwind.go
index b3be1ad..5c101bb 100644
--- a/lookForUnwind.go
+++ b/lookForUnwind.go
@@ -2,6 +2,8 @@
package main
import (
+ "path/filepath"
+
"go.wit.com/log"
)
@@ -11,7 +13,6 @@ func (r *repo) lookToUnwind() bool {
currentS := r.status.GetCurrentBranchVersion()
log.Info("repo:", r.String(), goSumS, dirtyS, r.lastTag.String(), currentS)
-
curName := r.status.GetCurrentBranchName()
mName := r.status.GetMasterBranchName()
@@ -29,12 +30,28 @@ func (r *repo) lookToUnwind() bool {
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)
r.setGoSumStatus("CAN NOT UNWIND")
return false
}
- r.setGoSumStatus("UNWIND")
- return true
+ fullpath := filepath.Join(me.goSrcPwd.String(), r.String())
+ 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
}
diff --git a/unreleaseWindow.go b/unreleaseWindow.go
index e3a3625..a21062a 100644
--- a/unreleaseWindow.go
+++ b/unreleaseWindow.go
@@ -17,7 +17,7 @@ func createUnreleaseBox(box *gui.Node) {
log.Info("skipping whitelist", repo.String())
continue
}
-
+
if repo.lookToUnwind() {
log.Info("found something to unwind:", repo.String())
if setCurrentRepo(repo, "rewind this", "very sure") {
@@ -28,7 +28,6 @@ func createUnreleaseBox(box *gui.Node) {
})
group.NewButton("re-release"+release.versionS, func() {
me.Disable()
- defer me.Enable()
if release.current.status.CheckDirty() {
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)
- 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})
- release.current.status.RunCmd([]string{"git", "push", "--delete", "origin", "v" + release.versionS})
- release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
- release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
- // git tag --delete v0.3
- // git push --delete origin v0.3
+ var all [][]string
+ all = append(all, []string{"git", "checkout", "devel"})
+ all = append(all, []string{"git", "branch", "-D", mName})
+ all = append(all, []string{"git", "branch", mName})
+ all = append(all, []string{"git", "checkout", mName})
+ 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})
- /*
- release.current.status.RunCmd([]string{"git", "add", "-f", "go.sum"})
- release.current.status.RunCmd([]string{"git", "commit", "-m", release.reasonS})
- release.current.status.RunCmd([]string{"git", "push"})
- release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
- release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
- */
+ if doAll(release.current, all) {
+ log.Info("EVERYTHING OK")
+ me.Enable()
+ } else {
+ log.Info("SOMETHING FAILED")
+ }
})
}
+
+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
+}