130 lines
3.2 KiB
Go
130 lines
3.2 KiB
Go
// This is a simple example
|
|
package main
|
|
|
|
import (
|
|
"go.wit.com/log"
|
|
|
|
"go.wit.com/lib/gui/repostatus"
|
|
)
|
|
|
|
func (r *repo) newScan() bool {
|
|
if r.status == nil {
|
|
log.Warn("repo.status = nil. not initialized for some reason")
|
|
return false
|
|
}
|
|
// r.scan()
|
|
if repostatus.VerifyLocalGoRepo(r.getPath()) {
|
|
log.Verbose("repo actually exists", r.getPath())
|
|
} else {
|
|
log.Warn("repo does not exist", r.getPath())
|
|
return false
|
|
}
|
|
mname := r.status.GetMasterBranchName()
|
|
mver := r.status.GetMasterVersion()
|
|
if mname != "guimaster" {
|
|
mver = mver + " (" + mname + ")"
|
|
}
|
|
r.masterVersion.SetLabel(mver)
|
|
|
|
dname := r.status.GetDevelBranchName()
|
|
dver := r.status.GetDevelVersion()
|
|
if dname != "devel" {
|
|
dver = dver + " (" + dname + ")"
|
|
}
|
|
r.develVersion.SetLabel(dver)
|
|
|
|
uname := r.status.GetUserBranchName()
|
|
uver := r.status.GetUserVersion()
|
|
if uname != "jcarr" {
|
|
uver = uver + " (" + uname + ")"
|
|
}
|
|
r.userVersion.SetLabel(uver)
|
|
|
|
cbname := r.status.GetCurrentBranchName()
|
|
cbversion := r.status.GetCurrentBranchVersion()
|
|
lasttag := r.status.GetLastTagVersion()
|
|
r.lastTag.SetLabel(lasttag)
|
|
r.vLabel.SetLabel(cbname + " " + cbversion)
|
|
|
|
if r.status.Changed() {
|
|
log.Warn("should scan here")
|
|
}
|
|
status := r.status.GetStatus()
|
|
r.dirtyLabel.SetLabel(status)
|
|
if status == "PERFECT" {
|
|
if me.autoHidePerfect.Checked() {
|
|
r.Hide()
|
|
}
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (r *repo) getStatus() string {
|
|
if r.status.CheckDirty() {
|
|
log.Warn("CheckDirty() true")
|
|
return "dirty"
|
|
}
|
|
|
|
if r.status.CheckBranches() {
|
|
log.Warn("Branches are Perfect")
|
|
return "PERFECT"
|
|
}
|
|
log.Warn("Branches are not Perfect")
|
|
return "merge"
|
|
}
|
|
|
|
func scanGoSum() {
|
|
for _, repo := range me.allrepos {
|
|
latestversion := repo.status.GetLastTagVersion()
|
|
if repo.goSumStatus.String() == "BAD" {
|
|
continue
|
|
}
|
|
if repo.goSumStatus.String() == "DIRTY" {
|
|
continue
|
|
}
|
|
if repo.status.CheckPrimativeGoMod() {
|
|
log.Info("PRIMATIVE repo:", latestversion, repo.status.String())
|
|
repo.goSumStatus.SetLabel("PRIMATIVE")
|
|
continue
|
|
}
|
|
if repo.status.CheckDirty() {
|
|
log.Info("dirty repo:", latestversion, repo.status.String())
|
|
log.Info("dirty repo.goSumStatus =", repo.goSumStatus.String())
|
|
repo.goSumStatus.SetLabel("DIRTY")
|
|
|
|
// release.repo.SetValue(repo.status.String())
|
|
// release.status.SetValue("dirty")
|
|
// release.notes.SetValue("You must commit your changes\nbefore you can continue")
|
|
// release.current = repo
|
|
// release.openrepo.Enable()
|
|
continue
|
|
}
|
|
if ok, missing := repo.status.CheckGoSum(); ok {
|
|
log.Info("repo has go.sum requirements that are clean")
|
|
repo.goSumStatus.SetLabel("CLEAN")
|
|
} else {
|
|
log.Info("repo has go.sum requirements that are screwed up. missing:", missing)
|
|
repo.goSumStatus.SetLabel("BAD")
|
|
|
|
// release.repo.SetValue(repo.status.String())
|
|
// release.status.SetValue("bad")
|
|
// release.notes.SetValue("the go.sum file is wrong")
|
|
// release.current = repo
|
|
// release.openrepo.Enable()
|
|
continue
|
|
}
|
|
status := repo.dirtyLabel.String()
|
|
if status == "PERFECT" {
|
|
continue
|
|
} else {
|
|
repo.status.Update()
|
|
repo.newScan()
|
|
}
|
|
|
|
// log.Info("find the next repo to release here")
|
|
log.Info("repo:", latestversion, status, repo.status.String())
|
|
}
|
|
log.Info("scan() did everything, not sure what to do next")
|
|
}
|