package repolist import ( "fmt" "os/user" "strings" "go.wit.com/log" ) func (r *RepoList) SetAutoScan(b bool) { me.autoScan = b } func (r *RepoList) ScanRepositories() (int, string) { var i int t := timeFunction(func() { for _, repo := range me.allrepos { i += 1 repo.NewScan() } }) s := fmt.Sprint(t) log.Info("Scanned", i, "repositories. todo: count/show changes", s) return i, s } func (r *Repo) NewScan() bool { if r.status == nil { log.Warn("repo.status = nil. not initialized for some reason") return false } // first run the repostatus update r.status.UpdateNew() // now read those values and display them in our table mname := r.status.GetMasterBranchName() mver := r.status.GetMasterVersion() 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() usr, _ := user.Current() if uname != usr.Username { 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 c, ok := r.status.Changed(); ok { c := strings.TrimSpace(c) for _, line := range strings.Split(c, "\n") { log.Info(r.status.Path(), line) } } status := r.status.GetStatus() r.dirtyLabel.SetLabel(status) if status == "PERFECT" { if me.autoHidePerfect { r.Hide() } return true } return false }