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/lib/debugger"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
func showHideRepos() {
for _, repo := range me.repos.View.AllRepos() {
// always show dirty repos
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
}
}
func showHideRepos(repo *repolist.Repo) {
// always show dirty repos
if repo.IsDirty() {
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() {
@ -77,7 +76,8 @@ func globalDisplayOptions(box *gui.Node) {
me.repos.Hide()
}
log.Info("showing reposwin")
showHideRepos()
// showHideRepos()
// have to run this twice for now
// scanForReady()
// scanForReady()
@ -90,7 +90,7 @@ func globalDisplayOptions(box *gui.Node) {
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() {
showHideRepos()
// showHideRepos()
} else {
globalDisplayShow()
}
@ -99,11 +99,15 @@ func globalDisplayOptions(box *gui.Node) {
me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() {
showHideRepos()
} else {
globalDisplayShow()
}
log.Info("registered hide function to showHideRepos()")
me.repos.View.RegisterHideFunction(showHideRepos)
/*
if me.autoHidePerfect.Checked() {
showHideRepos()
} else {
globalDisplayShow()
}
*/
}
hidegrid.NextRow()
@ -142,6 +146,19 @@ func globalDisplayOptions(box *gui.Node) {
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.Disable()
for _, repo := range me.repos.View.AllRepos() {

View File

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