go-clone/gitPull.go

31 lines
806 B
Go
Raw Permalink Normal View History

2024-12-15 08:45:44 -06:00
package main
import (
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
func gitPull() {
log.Info("Total repositories:", forge.Repos.Len())
log.Info("Going to run git pull in each one. TODO: use rill here")
pull := []string{"git", "pull"}
var trycount, errcount int
2024-12-17 07:02:45 -06:00
repos := forge.Repos.SortByFullPath()
2024-12-15 08:45:44 -06:00
for repos.Scan() {
repo := repos.Next()
if argv.DryRun {
2024-12-17 07:02:45 -06:00
log.Info("git pull --dry-run", repo.GetGoPath())
2024-12-15 08:45:44 -06:00
continue
}
log.Info("git pull:", repo.FullPath)
trycount += 1
2024-12-17 07:02:45 -06:00
log.Info("actually run: git pull:", repo.GetGoPath())
2024-12-15 08:45:44 -06:00
if result := shell.PathRunRealtime(repo.FullPath, pull); result.Error != nil {
log.Info("git pull error:", result.Error)
errcount += 1
}
}
log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount)
}