autotypist/scan.go

70 lines
1.5 KiB
Go
Raw Normal View History

// 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.Warn("repo actually exists", r.getPath())
} else {
log.Warn("repo does not exist", r.getPath())
return false
}
mn := r.status.GetMasterBranchName()
r.masterName.SetLabel(mn)
mv := r.status.GetMasterVersion()
r.masterVersion.SetLabel(mv)
dn := r.status.GetDevelBranchName()
r.develName.SetLabel(dn)
dv := r.status.GetDevelVersion()
r.develVersion.SetLabel(dv)
un := r.status.GetUserBranchName()
r.userName.SetLabel(un)
uv := r.status.GetUserVersion()
r.userVersion.SetLabel(uv)
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"
}