try fixing HideFunction()

This commit is contained in:
Jeff Carr 2024-02-19 22:00:58 -06:00
parent 8df9f47a23
commit 28f5e15350
2 changed files with 63 additions and 43 deletions

View File

@ -7,44 +7,43 @@ import (
"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"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log" "go.wit.com/log"
) )
func showHideRepos() { func showHideRepos(repo *repolist.Repo) {
for _, repo := range me.repos.View.AllRepos() { // always show dirty repos
// always show dirty repos if repo.IsDirty() {
if repo.IsDirty() {
repo.Show()
continue
}
// always show repos that have not been merged to main
if repo.GoState() == "merge to devel" {
repo.Show()
continue
}
// hide read-only repos. These are repos that do not
// match things in the users config file (.config/autotypist)
if me.autoHideReadOnly.Checked() {
if repo.Status.ReadOnly() {
repo.Hide()
continue
}
}
if me.autoHidePerfect.Checked() {
if repo.State() == "PERFECT" {
repo.Hide()
continue
}
}
if me.autoReleased.Checked() {
if repo.GoState() == "RELEASED" {
repo.Hide()
continue
}
}
repo.Show() repo.Show()
return
} }
// always show repos that have not been merged to main
if repo.GoState() == "merge to devel" {
repo.Show()
return
}
// hide read-only repos. These are repos that do not
// match things in the users config file (.config/autotypist)
if me.autoHideReadOnly.Checked() {
if repo.Status.ReadOnly() {
repo.Hide()
return
}
}
if me.autoHidePerfect.Checked() {
if repo.State() == "PERFECT" {
repo.Hide()
return
}
}
if me.autoReleased.Checked() {
if repo.GoState() == "RELEASED" {
repo.Hide()
return
}
}
repo.Show()
} }
func globalDisplayShow() { func globalDisplayShow() {
@ -77,7 +76,8 @@ func globalDisplayOptions(box *gui.Node) {
me.repos.Hide() me.repos.Hide()
} }
log.Info("showing reposwin") log.Info("showing reposwin")
showHideRepos() // showHideRepos()
// have to run this twice for now // have to run this twice for now
// scanForReady() // scanForReady()
// scanForReady() // scanForReady()
@ -90,7 +90,7 @@ func globalDisplayOptions(box *gui.Node) {
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() {
if me.autoHideReadOnly.Checked() { if me.autoHideReadOnly.Checked() {
showHideRepos() // showHideRepos()
} else { } else {
globalDisplayShow() globalDisplayShow()
} }
@ -99,11 +99,15 @@ func globalDisplayOptions(box *gui.Node) {
me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true) me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() { me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() { log.Info("registered hide function to showHideRepos()")
showHideRepos() me.repos.View.RegisterHideFunction(showHideRepos)
} else { /*
globalDisplayShow() if me.autoHidePerfect.Checked() {
} showHideRepos()
} else {
globalDisplayShow()
}
*/
} }
hidegrid.NextRow() hidegrid.NextRow()
@ -142,6 +146,19 @@ func globalDisplayOptions(box *gui.Node) {
setBranchToMaster() 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("")
// double check the found next repo
fullDoubleCheckFix()
})
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() { me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
me.Disable() me.Disable()
for _, repo := range me.repos.View.AllRepos() { for _, repo := range me.repos.View.AllRepos() {

View File

@ -263,24 +263,27 @@ func goodCheckGoSum() bool {
var maybe bool = true var maybe bool = true
goConfig := release.current.Status.GetGoDeps() goConfig := release.current.Status.GetGoDeps()
for depname, version := range goConfig { for depname, version := range goConfig {
log.Info("Checking repo deps:", depname, version) log.Info("Starting repo deps:", depname, version)
repo := me.repos.View.FindRepo(depname) repo := me.repos.View.FindRepo(depname)
if repo != nil { if repo == nil {
log.Info(" repo deps: IGNORE", depname, version) log.Info(" skipping repo == nil", depname, version)
continue continue
} }
goSumS := repo.GoState() goSumS := repo.GoState()
// ignore dependencies on whitelisted repos // ignore dependencies on whitelisted repos
// TODO: warn the user about the whitelist // TODO: warn the user about the whitelist
if goSumS == "WHITELIST" { if goSumS == "WHITELIST" {
log.Info(" skipping repo == nil", depname, version)
continue continue
} }
// check if the dependent repo is ReadOnly // check if the dependent repo is ReadOnly
// if so, there isn't anything we can do about // if so, there isn't anything we can do about
// version mis-matches // version mis-matches
if repo.ReadOnly() { if repo.ReadOnly() {
log.Info(" repo deps: WHITELIST", depname, version)
continue continue
} }
log.Info("Checking repo deps match:", depname, version)
lastS := repo.LastTag() lastS := repo.LastTag()
targetS := repo.Status.GetTargetVersion() targetS := repo.Status.GetTargetVersion()
log.Info(" repo deps:", depname, version, "vs", goSumS, lastS, targetS) log.Info(" repo deps:", depname, version, "vs", goSumS, lastS, targetS)