forge/doDirty.go

45 lines
914 B
Go

package main
import (
"time"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func doDirty() {
findAll() // select all the repos
doCheckDirtyAndConfigSave()
me.found = new(gitpb.Repos)
findDirty()
me.forge.PrintHumanTableDirty(me.found)
}
func doCheckDirtyAndConfigSave() {
var count int
now := time.Now()
// log.Info("before findAll()")
all := me.found.SortByFullPath()
for all.Scan() {
repo := all.Next()
// log.Info("before isDirty()")
dirty := repo.IsDirty()
if repo.CheckDirty() {
count += 1
if me.found.AppendByGoPath(repo) {
log.Info("doCheckDirtyAndConfigSave() repo already existed", repo.GetGoPath())
}
if !dirty {
configSave = true
}
} else {
if dirty {
configSave = true
}
}
}
log.Printf("dirty check (%d repos) took:%s\n", count, shell.FormatDuration(time.Since(now)))
me.forge.SetConfigSave(configSave)
}