reorg interface. it's almost working again
This commit is contained in:
parent
d84420e443
commit
e927975dc8
|
@ -86,7 +86,7 @@ func doRelease() bool {
|
||||||
log.Info("EVERYTHING OK. RERELEASED", release.current.Name())
|
log.Info("EVERYTHING OK. RERELEASED", release.current.Name())
|
||||||
|
|
||||||
// update the values in the GUI
|
// update the values in the GUI
|
||||||
release.current.Status.UpdateNew()
|
release.current.NewScan()
|
||||||
|
|
||||||
// attempt to find another repo to release
|
// attempt to find another repo to release
|
||||||
if !doReleaseFindNext() {
|
if !doReleaseFindNext() {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/debugger"
|
"go.wit.com/lib/debugger"
|
||||||
"go.wit.com/lib/gui/logsettings"
|
"go.wit.com/lib/gui/logsettings"
|
||||||
|
@ -11,12 +9,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func showHideRepos(repo *repolist.Repo) {
|
func showHideRepos(repo *repolist.Repo) {
|
||||||
|
if repo.GoPath() == "go.wit.com/dev/alexflint/arg" {
|
||||||
|
log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
|
||||||
|
log.Info("found alexflint/arg IsReleased() =", repo.Status.IsReleased())
|
||||||
|
}
|
||||||
// always show dirty repos
|
// always show dirty repos
|
||||||
if repo.IsDirty() {
|
if repo.IsDirty() {
|
||||||
repo.Show()
|
repo.Show()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// always show repos that have not been merged to main
|
// always show repos that have not been merged ?
|
||||||
if repo.GoState() == "merge to devel" {
|
if repo.GoState() == "merge to devel" {
|
||||||
repo.Show()
|
repo.Show()
|
||||||
return
|
return
|
||||||
|
@ -30,30 +32,8 @@ func showHideRepos(repo *repolist.Repo) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if me.autoHidePerfect.Checked() {
|
if me.autoHideReleased.Checked() {
|
||||||
if repo.State() == "PERFECT" {
|
if repo.Status.IsReleased() {
|
||||||
repo.Hide()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if me.autoReleased.Checked() {
|
|
||||||
if repo.GoState() == "RELEASED" {
|
|
||||||
repo.Hide()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repo.Show()
|
|
||||||
}
|
|
||||||
|
|
||||||
func globalDisplayShow(repo *repolist.Repo) {
|
|
||||||
if me.autoHideReadOnly.Checked() {
|
|
||||||
if repo.Status.ReadOnly() {
|
|
||||||
repo.Hide()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if me.autoHidePerfect.Checked() {
|
|
||||||
if repo.State() == "PERFECT" {
|
|
||||||
repo.Hide()
|
repo.Hide()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -79,191 +59,72 @@ func globalDisplayOptions(box *gui.Node) {
|
||||||
hidegrid.NextRow()
|
hidegrid.NextRow()
|
||||||
|
|
||||||
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
|
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
|
||||||
me.autoHideReadOnly.Custom = func() {
|
// me.autoHideReadOnly.Custom = func() {
|
||||||
log.Info("registered hide function to globalDisplayShow()")
|
// log.Info("registered hide function to globalDisplayShow()")
|
||||||
me.repos.View.RegisterHideFunction(globalDisplayShow)
|
// me.repos.View.RegisterHideFunction(globalDisplayShow)
|
||||||
}
|
// }
|
||||||
hidegrid.NextRow()
|
hidegrid.NextRow()
|
||||||
|
|
||||||
me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
me.autoHideReleased = hidegrid.NewCheckbox("Hide Released repos").SetChecked(true)
|
||||||
me.autoHidePerfect.Custom = func() {
|
|
||||||
log.Info("registered hide function to showHideRepos()")
|
|
||||||
me.repos.View.RegisterHideFunction(showHideRepos)
|
|
||||||
}
|
|
||||||
hidegrid.NextRow()
|
|
||||||
|
|
||||||
me.autoReleased = hidegrid.NewCheckbox("Hide RELEASED repos").SetChecked(false)
|
|
||||||
me.autoReleased.Custom = func() {
|
|
||||||
if me.autoReleased.Checked() {
|
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
|
||||||
if repo.GoState() == "RELEASED" {
|
|
||||||
repo.Hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
|
||||||
repo.Show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hidegrid.NextRow()
|
hidegrid.NextRow()
|
||||||
|
|
||||||
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
|
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
|
||||||
hidegrid.NextRow()
|
hidegrid.NextRow()
|
||||||
|
|
||||||
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
|
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
|
||||||
|
me.scanEveryMinute.Custom = func() {
|
||||||
|
me.repos.View.SetAutoScan(me.scanEveryMinute.Checked())
|
||||||
|
}
|
||||||
hidegrid.NewButton("scan now", func() {
|
hidegrid.NewButton("scan now", func() {
|
||||||
log.Info("re-scanning repos now")
|
log.Info("re-scanning repos now")
|
||||||
i, s := me.repos.View.ScanRepositories()
|
i, s := me.repos.View.ScanRepositories()
|
||||||
log.Info("re-scanning repos done", i, s)
|
log.Info("re-scanning repos done", i, s)
|
||||||
me.duration.SetText(s)
|
// me.duration.SetText(s)
|
||||||
})
|
})
|
||||||
me.duration = hidegrid.NewLabel("")
|
me.duration = me.repos.View.MirrorScanDuration()
|
||||||
|
hidegrid.Append(me.duration)
|
||||||
|
|
||||||
hidegrid.NextRow()
|
hidegrid.NextRow()
|
||||||
|
|
||||||
|
group1 = vbox.NewGroup("prep for release")
|
||||||
grid := group1.NewGrid("test", 0, 0)
|
grid := group1.NewGrid("test", 0, 0)
|
||||||
|
|
||||||
grid.NewButton("git checkout master", func() {
|
|
||||||
setBranchToMaster()
|
|
||||||
})
|
|
||||||
|
|
||||||
grid.NewButton("find first repo", func() {
|
|
||||||
// set the target versions
|
|
||||||
setTargetVersion()
|
|
||||||
|
|
||||||
// have to run this twice for now. not sure why
|
|
||||||
scanForReady()
|
|
||||||
scanForReady()
|
|
||||||
|
|
||||||
findNextDirty("")
|
|
||||||
})
|
|
||||||
|
|
||||||
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
|
|
||||||
me.Disable()
|
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
|
||||||
if repo.Status.ReadOnly() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if whitelist(repo.GoPath()) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if repo.Status.CheckoutMaster() {
|
|
||||||
log.Warn("set master branch worked", repo.Name())
|
|
||||||
repo.Status.UpdateNew()
|
|
||||||
} else {
|
|
||||||
repo.Status.UpdateNew()
|
|
||||||
log.Warn("set master branch failed", repo.Name())
|
|
||||||
log.Warn("set master branch failed", repo.Name())
|
|
||||||
log.Warn("set master branch failed", repo.Name())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
me.Enable()
|
|
||||||
me.setBranchesToMasterB.Disable()
|
|
||||||
})
|
|
||||||
|
|
||||||
var longB *gui.Node
|
|
||||||
longB = grid.NewButton("redo all go.sum", func() {
|
|
||||||
longB.Disable()
|
|
||||||
me.Disable()
|
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
|
||||||
if whitelist(repo.GoPath()) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
ok, err := repo.Status.MakeRedomod()
|
|
||||||
if !ok {
|
|
||||||
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
|
||||||
me.Enable()
|
|
||||||
longB.Enable()
|
|
||||||
longB.SetLabel("FAILED")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("redo go.sum finished ok!")
|
|
||||||
longB.Disable()
|
|
||||||
me.Enable()
|
|
||||||
longB.Enable()
|
|
||||||
})
|
|
||||||
|
|
||||||
grid.NewButton("set target version", func() {
|
grid.NewButton("set target version", func() {
|
||||||
setTargetVersion()
|
setTargetVersion()
|
||||||
})
|
})
|
||||||
grid.NextRow()
|
var longB *gui.Node
|
||||||
|
longB = grid.NewButton("redo all go.sum", func() {
|
||||||
grid.NewButton("rm -f go.mod go.sum", func() {
|
|
||||||
me.Disable()
|
me.Disable()
|
||||||
|
var worked bool = true
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
if whitelist(repo.GoPath()) {
|
if whitelist(repo.GoPath()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if repo.Status.ReadOnly() {
|
ok, err := me.repos.View.CheckValidGoSum(repo)
|
||||||
continue
|
if !ok {
|
||||||
|
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
||||||
|
worked = false
|
||||||
}
|
}
|
||||||
repo.Status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"})
|
|
||||||
}
|
}
|
||||||
|
log.Info("redo go.sum finished with", worked)
|
||||||
me.Enable()
|
me.Enable()
|
||||||
|
longB.SetLabel("go.sum files created")
|
||||||
|
if worked {
|
||||||
|
longB.Disable()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.NewButton("git reset --hard", func() {
|
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
|
||||||
me.Disable()
|
me.Disable()
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
defer me.Enable()
|
||||||
if whitelist(repo.GoPath()) {
|
if setAllBranchesToMaster() {
|
||||||
log.Warn("skipping whitelist", repo.Name())
|
// if it succeeds, disable this button
|
||||||
continue
|
me.setBranchesToMasterB.Disable()
|
||||||
}
|
|
||||||
log.Warn("running git reset --hard", repo.Name())
|
|
||||||
repo.Status.RunCmd([]string{"git", "reset", "--hard"})
|
|
||||||
}
|
}
|
||||||
me.Enable()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.NewButton("git ls-files |grep go.mod", func() {
|
|
||||||
// var all []string
|
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
|
||||||
log.Info("repo:", repo.Name())
|
|
||||||
if repo.Status.ReadOnly() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if whitelist(repo.GoPath()) {
|
|
||||||
log.Warn("skipping whitelist", repo.GoPath())
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
good, files := repo.Status.GitLsFiles()
|
|
||||||
if !good {
|
|
||||||
log.Warn("Something went wrong", repo.GoPath())
|
|
||||||
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.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
|
||||||
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
|
||||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
|
||||||
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.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
|
||||||
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
|
||||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
|
||||||
log.Info("Found go.sum. version mismatch")
|
|
||||||
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("All repos seem okay")
|
|
||||||
})
|
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
grid.NewButton("scanForReady()", func() {
|
|
||||||
scanForReady()
|
|
||||||
})
|
|
||||||
|
|
||||||
group2 := vbox.NewGroup("Debugger")
|
group2 := vbox.NewGroup("Debugger")
|
||||||
dbggrid := group2.NewGrid("gdb", 0, 0)
|
dbggrid := group2.NewGrid("gdb", 0, 0)
|
||||||
dbggrid.NewButton("logging Window", func() {
|
dbggrid.NewButton("logging Window", func() {
|
||||||
|
|
23
main.go
23
main.go
|
@ -45,9 +45,6 @@ func main() {
|
||||||
me.mainWindow = me.myGui.NewWindow("GUI release manager")
|
me.mainWindow = me.myGui.NewWindow("GUI release manager")
|
||||||
me.mainBox = me.mainWindow.NewBox("bw hbox", true)
|
me.mainBox = me.mainWindow.NewBox("bw hbox", true)
|
||||||
|
|
||||||
// the left side of the window options
|
|
||||||
globalDisplayOptions(me.mainBox)
|
|
||||||
|
|
||||||
// sanity check of things that might be around that mess
|
// sanity check of things that might be around that mess
|
||||||
// up things later
|
// up things later
|
||||||
// if you have a go.work file, you must delete it
|
// if you have a go.work file, you must delete it
|
||||||
|
@ -73,13 +70,16 @@ func main() {
|
||||||
|
|
||||||
log.Info("Creating the Release Window")
|
log.Info("Creating the Release Window")
|
||||||
|
|
||||||
// scan in the repo map first
|
// initialize the repo list window
|
||||||
// hopefully this is the list of all the golang packages and only the GUI golang packages
|
// which should be all the git repositories in ~/go/src & the .config file
|
||||||
me.repos = makeRepoView()
|
me.repos = makeRepoView()
|
||||||
|
|
||||||
// register a Show/Hide function for the repo list table
|
// register a Show/Hide function for the repo list table
|
||||||
me.repos.View.RegisterHideFunction(showHideRepos)
|
me.repos.View.RegisterHideFunction(showHideRepos)
|
||||||
|
|
||||||
|
// the left side of the window options
|
||||||
|
globalDisplayOptions(me.mainBox)
|
||||||
|
|
||||||
// create the right side of the main window
|
// create the right side of the main window
|
||||||
createReleaseBox(me.mainBox)
|
createReleaseBox(me.mainBox)
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ func main() {
|
||||||
// so I can't trust even what I see. It's complicated right now still.
|
// so I can't trust even what I see. It's complicated right now still.
|
||||||
release.openrepo.Disable()
|
release.openrepo.Disable()
|
||||||
|
|
||||||
|
log.Sleep(5)
|
||||||
|
|
||||||
// parse config file and scan for .git repos
|
// parse config file and scan for .git repos
|
||||||
me.repos.initRepoList()
|
me.repos.initRepoList()
|
||||||
|
|
||||||
|
@ -110,8 +112,15 @@ func main() {
|
||||||
|
|
||||||
// start the initail scan and make sure each repo is set
|
// start the initail scan and make sure each repo is set
|
||||||
// to the master branch
|
// to the master branch
|
||||||
func setBranchToMaster() {
|
func setAllBranchesToMaster() bool {
|
||||||
|
var worked bool = true
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
|
if repo.ReadOnly() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if repo.IsDirty() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if whitelist(repo.GoPath()) {
|
if whitelist(repo.GoPath()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -119,9 +128,11 @@ func setBranchToMaster() {
|
||||||
log.Warn("git checkout master branch worked", repo.Name())
|
log.Warn("git checkout master branch worked", repo.Name())
|
||||||
} else {
|
} else {
|
||||||
log.Warn("git checkout master branch failed", repo.Name())
|
log.Warn("git checkout master branch failed", repo.Name())
|
||||||
|
worked = false
|
||||||
}
|
}
|
||||||
// repo.NewScan()
|
// repo.NewScan()
|
||||||
}
|
}
|
||||||
|
return worked
|
||||||
}
|
}
|
||||||
|
|
||||||
func setTargetVersion() {
|
func setTargetVersion() {
|
||||||
|
|
179
releaseBox.go
179
releaseBox.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -49,44 +50,20 @@ type releaseStruct struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *autoType) Disable() {
|
func (w *autoType) Disable() {
|
||||||
// w.mainWindow.Disable()
|
me.mainBox.Disable()
|
||||||
release.box.Disable()
|
|
||||||
// buttonDisable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *autoType) Enable() {
|
func (w *autoType) Enable() {
|
||||||
// w.mainWindow.Enable()
|
me.mainBox.Enable()
|
||||||
release.box.Enable()
|
|
||||||
// buttonEnable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createReleaseBox(box *gui.Node) {
|
func createReleaseBox(box *gui.Node) {
|
||||||
initWhitelist()
|
initWhitelist()
|
||||||
|
|
||||||
release.box = box
|
// release.box = box
|
||||||
|
release.box = box.NewVerticalBox("vbox")
|
||||||
release.group = release.box.NewGroup("Current Repo")
|
release.group = release.box.NewGroup("Current Repo")
|
||||||
release.grid = release.group.NewGrid("buildOptions", 0, 0)
|
release.grid = release.group.NewGrid("buildOptions", 0, 0)
|
||||||
|
|
||||||
// do an initial scan of all the repos
|
|
||||||
scanGoSum()
|
|
||||||
|
|
||||||
release.grid.NewButton("scan for Ready", func() {
|
|
||||||
me.Disable()
|
|
||||||
scanForReady()
|
|
||||||
me.Enable()
|
|
||||||
})
|
|
||||||
release.grid.NewButton("findNextDirty()", func() {
|
|
||||||
me.Disable()
|
|
||||||
defer me.Enable()
|
|
||||||
if findNextDirty("PRIMATIVE") {
|
|
||||||
log.Info("findNextDirty() found a repo")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if findNextDirty("") {
|
|
||||||
log.Info("findNextDirty() found a repo")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
release.grid.NextRow()
|
release.grid.NextRow()
|
||||||
|
|
||||||
release.releaseVersionB = release.grid.NewButton("release version", func() {
|
release.releaseVersionB = release.grid.NewButton("release version", func() {
|
||||||
|
@ -142,35 +119,26 @@ func createReleaseBox(box *gui.Node) {
|
||||||
panic("redo go.sum")
|
panic("redo go.sum")
|
||||||
}
|
}
|
||||||
|
|
||||||
release.grid.NewButton("Check Ready", func() {
|
group := release.box.NewGroup("Run on Current Repo")
|
||||||
buttonDisable()
|
grid := group.NewGrid("buildOptions", 0, 0)
|
||||||
defer buttonEnable()
|
|
||||||
goSumS := release.current.GoState()
|
|
||||||
dirtyS := release.current.State()
|
|
||||||
lastS := release.current.LastTag()
|
|
||||||
if CheckReady() {
|
|
||||||
log.Info("repo is ready", release.current.Name(), goSumS, dirtyS, lastS)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
log.Info("\trepo is not ready", release.current.Name(), goSumS, dirtyS, lastS)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
release.grid.NewButton("set ignore", func() {
|
grid.NewButton("set to IGNORE", func() {
|
||||||
tmp := release.current.GoState()
|
tmp := release.current.GoState()
|
||||||
log.Info("trying to set repo IGNORE is now =", tmp)
|
log.Info("trying to set repo IGNORE is now =", tmp)
|
||||||
release.current.SetGoState("IGNORE")
|
release.current.SetGoState("IGNORE")
|
||||||
release.whitelist[release.current.GoPath()] = release.current
|
release.whitelist[release.current.GoPath()] = release.current
|
||||||
})
|
})
|
||||||
|
|
||||||
release.checkGoSumB = release.grid.NewButton("checkValidGoSum()", func() {
|
release.checkGoSumB = grid.NewButton("checkValidGoSum()", func() {
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
checkValidGoSum(release.current)
|
checkValidGoSum(release.current)
|
||||||
buttonEnable()
|
buttonEnable()
|
||||||
})
|
})
|
||||||
release.grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
release.grid.NewButton("release all", func() {
|
group = release.box.NewGroup("Process against all repos")
|
||||||
|
grid = group.NewGrid("buildOptions", 0, 0)
|
||||||
|
grid.NewButton("release all", func() {
|
||||||
var worked bool = true
|
var worked bool = true
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
// rather than loop forever, at least limit this to the number of repos
|
// rather than loop forever, at least limit this to the number of repos
|
||||||
|
@ -196,7 +164,124 @@ func createReleaseBox(box *gui.Node) {
|
||||||
log.Info("release returned", worked, "and ran for", s)
|
log.Info("release returned", worked, "and ran for", s)
|
||||||
buttonEnable()
|
buttonEnable()
|
||||||
})
|
})
|
||||||
release.grid.NextRow()
|
|
||||||
|
grid.NewButton("find first repo", func() {
|
||||||
|
// set the target versions
|
||||||
|
setTargetVersion()
|
||||||
|
|
||||||
|
// have to run this twice for now. not sure why
|
||||||
|
// this is old
|
||||||
|
scanForReady()
|
||||||
|
scanForReady()
|
||||||
|
|
||||||
|
findNextDirty("")
|
||||||
|
})
|
||||||
|
|
||||||
|
grid.NewButton("Check Ready", func() {
|
||||||
|
buttonDisable()
|
||||||
|
defer buttonEnable()
|
||||||
|
goSumS := release.current.GoState()
|
||||||
|
dirtyS := release.current.State()
|
||||||
|
lastS := release.current.LastTag()
|
||||||
|
if CheckReady() {
|
||||||
|
log.Info("repo is ready", release.current.Name(), goSumS, dirtyS, lastS)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
log.Info("\trepo is not ready", release.current.Name(), goSumS, dirtyS, lastS)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
grid.NewButton("scan for Ready", func() {
|
||||||
|
me.Disable()
|
||||||
|
scanForReady()
|
||||||
|
me.Enable()
|
||||||
|
})
|
||||||
|
grid.NewButton("findNextDirty()", func() {
|
||||||
|
me.Disable()
|
||||||
|
defer me.Enable()
|
||||||
|
if findNextDirty("PRIMATIVE") {
|
||||||
|
log.Info("findNextDirty() found a repo")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if findNextDirty("") {
|
||||||
|
log.Info("findNextDirty() found a repo")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
|
group = release.box.NewGroup("experimental and dangerous stuff")
|
||||||
|
grid = group.NewGrid("buildOptions", 0, 0)
|
||||||
|
grid.NewButton("rm -f go.mod go.sum", func() {
|
||||||
|
me.Disable()
|
||||||
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
|
if whitelist(repo.GoPath()) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if repo.Status.ReadOnly() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repo.Status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"})
|
||||||
|
}
|
||||||
|
me.Enable()
|
||||||
|
})
|
||||||
|
|
||||||
|
grid.NewButton("git reset --hard", func() {
|
||||||
|
me.Disable()
|
||||||
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
|
if whitelist(repo.GoPath()) {
|
||||||
|
log.Warn("skipping whitelist", repo.Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Warn("running git reset --hard", repo.Name())
|
||||||
|
repo.Status.RunCmd([]string{"git", "reset", "--hard"})
|
||||||
|
}
|
||||||
|
me.Enable()
|
||||||
|
})
|
||||||
|
|
||||||
|
grid.NewButton("git ls-files |grep go.mod", func() {
|
||||||
|
// var all []string
|
||||||
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
|
log.Info("repo:", repo.Name())
|
||||||
|
if repo.Status.ReadOnly() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if whitelist(repo.GoPath()) {
|
||||||
|
log.Warn("skipping whitelist", repo.GoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
good, files := repo.Status.GitLsFiles()
|
||||||
|
if !good {
|
||||||
|
log.Warn("Something went wrong", repo.GoPath())
|
||||||
|
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.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||||
|
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
||||||
|
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||||
|
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.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||||
|
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
||||||
|
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||||
|
log.Info("Found go.sum. version mismatch")
|
||||||
|
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Info("All repos seem okay")
|
||||||
|
})
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func buttonDisable() {
|
func buttonDisable() {
|
||||||
|
@ -251,7 +336,7 @@ func findNextDirty(onlyKind string) bool {
|
||||||
for _, repo := range me.repos.View.AllRepos() {
|
for _, repo := range me.repos.View.AllRepos() {
|
||||||
goSumS := repo.GoState()
|
goSumS := repo.GoState()
|
||||||
|
|
||||||
if repo.Status.GetTargetVersion() == repo.Status.GetCurrentVersion() {
|
if repo.Status.IsReleased() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if goSumS == "WHITELIST" {
|
if goSumS == "WHITELIST" {
|
||||||
|
|
17
repoview.go
17
repoview.go
|
@ -44,20 +44,11 @@ func makeRepoView() *repoWindow {
|
||||||
r.win.Make()
|
r.win.Make()
|
||||||
|
|
||||||
r.box = r.win.Box().NewBox("bw vbox", false)
|
r.box = r.win.Box().NewBox("bw vbox", false)
|
||||||
// me.reposwin.Draw()
|
|
||||||
r.win.Custom = func() {
|
r.win.Custom = func() {
|
||||||
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
||||||
log.Warn("Should I do something special here?")
|
log.Warn("Should I do something special here?")
|
||||||
}
|
}
|
||||||
|
|
||||||
r.repoAllButtons()
|
|
||||||
|
|
||||||
r.View = repolist.GuireleaserView(r.box)
|
|
||||||
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *repoWindow) repoAllButtons() {
|
|
||||||
// reposbox.SetExpand(false)
|
// reposbox.SetExpand(false)
|
||||||
group1 := r.box.NewGroup("Run on all repos:")
|
group1 := r.box.NewGroup("Run on all repos:")
|
||||||
|
|
||||||
|
@ -70,4 +61,12 @@ func (r *repoWindow) repoAllButtons() {
|
||||||
r.Disable()
|
r.Disable()
|
||||||
r.Enable()
|
r.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.View = repolist.GuireleaserView(r.box)
|
||||||
|
|
||||||
|
showncount := r.View.MirrorShownCount()
|
||||||
|
box2.Append(showncount)
|
||||||
|
duration := r.View.MirrorScanDuration()
|
||||||
|
box2.Append(duration)
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,9 @@ type autoType struct {
|
||||||
// our view of the repositories
|
// our view of the repositories
|
||||||
repos *repoWindow
|
repos *repoWindow
|
||||||
|
|
||||||
// #### autotypist Global Display Options
|
// #### guireleaser repolist display options
|
||||||
autoHidePerfect *gui.Node
|
|
||||||
autoHideReadOnly *gui.Node
|
autoHideReadOnly *gui.Node
|
||||||
autoReleased *gui.Node
|
autoHideReleased *gui.Node
|
||||||
ignoreWhitelist *gui.Node
|
ignoreWhitelist *gui.Node
|
||||||
|
|
||||||
// #### autotypist Global Build Options
|
// #### autotypist Global Build Options
|
||||||
|
|
Loading…
Reference in New Issue