2024-01-13 23:42:06 -06:00
|
|
|
// This is a simple example
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
|
|
|
|
2024-01-15 15:09:47 -06:00
|
|
|
"go.wit.com/gui/lib/repostatus"
|
2024-01-13 23:42:06 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
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.GetMasterName()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.masterName.Set(mn)
|
2024-01-13 23:42:06 -06:00
|
|
|
mv := r.status.GetMasterVersion()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.masterVersion.Set(mv)
|
2024-01-13 23:42:06 -06:00
|
|
|
|
|
|
|
dn := r.status.GetDevelName()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.develName.Set(dn)
|
2024-01-13 23:42:06 -06:00
|
|
|
dv := r.status.GetDevelVersion()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.develVersion.Set(dv)
|
2024-01-13 23:42:06 -06:00
|
|
|
|
|
|
|
un := r.status.GetUserName()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.userName.Set(un)
|
2024-01-13 23:42:06 -06:00
|
|
|
uv := r.status.GetUserVersion()
|
2024-01-14 13:29:24 -06:00
|
|
|
r.userVersion.Set(uv)
|
2024-01-13 23:42:06 -06:00
|
|
|
|
|
|
|
cbname := r.status.GetCurrentBranchName()
|
|
|
|
cbversion := r.status.GetCurrentBranchVersion()
|
2024-01-15 08:11:08 -06:00
|
|
|
lasttag := r.status.GetLastTagVersion()
|
|
|
|
r.lastTag.Set(lasttag)
|
|
|
|
r.vLabel.Set(cbname + " " + cbversion)
|
2024-01-13 23:42:06 -06:00
|
|
|
|
2024-01-15 08:11:08 -06:00
|
|
|
status := r.getStatus()
|
|
|
|
if status == "dirty" {
|
|
|
|
r.dirtyLabel.Set(status)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if status == "merge" {
|
|
|
|
r.dirtyLabel.Set(status)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if status == "PERFECT" {
|
|
|
|
r.dirtyLabel.Set(status)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
r.dirtyLabel.Set("unknown " + status)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *repo) getStatus() string {
|
2024-01-13 23:42:06 -06:00
|
|
|
if r.status.CheckDirty() {
|
|
|
|
log.Warn("CheckDirty() true")
|
2024-01-15 08:11:08 -06:00
|
|
|
return "dirty"
|
2024-01-13 23:42:06 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if r.status.CheckBranches() {
|
|
|
|
log.Warn("Branches are Perfect")
|
2024-01-15 08:11:08 -06:00
|
|
|
return "PERFECT"
|
2024-01-13 23:42:06 -06:00
|
|
|
}
|
2024-01-15 08:11:08 -06:00
|
|
|
log.Warn("Branches are not Perfect")
|
|
|
|
return "merge"
|
2024-01-13 23:42:06 -06:00
|
|
|
}
|