remove deprecated code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2996241102
commit
89583a2db4
|
@ -1,161 +0,0 @@
|
|||
// This is a simple example
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func findUnreleased() bool {
|
||||
for _, repo := range me.allrepos {
|
||||
if repo.status.ReadOnly() {
|
||||
log.Info("skipping readonly", repo.String())
|
||||
continue
|
||||
}
|
||||
if whitelist(repo.String()) {
|
||||
log.Info("skipping whitelist", repo.String())
|
||||
continue
|
||||
}
|
||||
setCurrentRepo(repo, "rewind this?", "not sure")
|
||||
|
||||
if repo.lookToUnwind() {
|
||||
log.Info("found something to unwind:", repo.String())
|
||||
if setCurrentRepo(repo, "rewind this", "very sure") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
log.Info("nothing left to unwind")
|
||||
release.status.SetValue("ALL DONE?")
|
||||
return false
|
||||
}
|
||||
|
||||
func unwindWhitelist() {
|
||||
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) {
|
||||
group := release.box.NewGroup("undo and redo things")
|
||||
|
||||
group.NewButton("whitelist go.wit.com/dev", func() {
|
||||
me.Disable()
|
||||
defer me.Enable()
|
||||
unwindWhitelist()
|
||||
})
|
||||
group.NewButton("find the unreleased", func() {
|
||||
me.Disable()
|
||||
defer me.Enable()
|
||||
unwindWhitelist()
|
||||
findUnreleased()
|
||||
})
|
||||
release.unreleaseB = group.NewButton("re-release", func() {
|
||||
// var count int = 0
|
||||
me.Disable()
|
||||
unwindWhitelist()
|
||||
if rerelease() {
|
||||
log.Info("good to re-release another one")
|
||||
} else {
|
||||
log.Info("re-release failed")
|
||||
return
|
||||
}
|
||||
me.Enable()
|
||||
})
|
||||
group.NewButton("loop(25)", func() {
|
||||
me.Disable()
|
||||
unwindWhitelist()
|
||||
for n := 0; n <= 25; n++ {
|
||||
if rerelease() {
|
||||
log.Info("good to re-release another one")
|
||||
} else {
|
||||
if release.status.String() == "ALL DONE?" {
|
||||
log.Info("maybe ALL DONE?")
|
||||
me.Enable()
|
||||
return
|
||||
}
|
||||
log.Info("loop() failed", n)
|
||||
return
|
||||
}
|
||||
}
|
||||
log.Info("loop(25) worked")
|
||||
me.Enable()
|
||||
})
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
func rerelease() bool {
|
||||
if release.unreleaseB.String() != "un-release version "+release.version.String() {
|
||||
log.Warn("something went wrong with the release.version:", release.version.String())
|
||||
return false
|
||||
}
|
||||
|
||||
if strings.HasPrefix(release.version.String(), "v") {
|
||||
log.Warn("everything is ok. version starts with v.", release.version.String())
|
||||
} else {
|
||||
log.Warn("version does not start with v.", release.version.String())
|
||||
return false
|
||||
}
|
||||
|
||||
if release.current.status.CheckDirty() {
|
||||
log.Info("sorry, it's still dirty")
|
||||
return false
|
||||
}
|
||||
|
||||
curName := release.current.status.GetCurrentBranchName()
|
||||
mName := release.current.status.GetMasterBranchName()
|
||||
if curName != mName {
|
||||
log.Info("\trepo is not working from main branch", curName, "!=", mName)
|
||||
return false
|
||||
}
|
||||
|
||||
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})
|
||||
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})
|
||||
|
||||
all = append(all, []string{"git", "tag", "--delete", release.version.String()})
|
||||
all = append(all, []string{"git", "push", "--delete", "origin", release.version.String()})
|
||||
all = append(all, []string{"git", "tag", "-m", me.releaseReasonS, release.version.String()})
|
||||
all = append(all, []string{"git", "push", "origin", release.version.String()})
|
||||
|
||||
if doAll(release.current, all) {
|
||||
log.Info("EVERYTHING OK. RERELEASED", release.current.String())
|
||||
if findUnreleased() {
|
||||
log.Info("GOOD TO RUN ANOTHER DAY ON:", release.current.String())
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
log.Info("SOMETHING FAILED")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
Loading…
Reference in New Issue