summaryrefslogtreecommitdiff
path: root/gitPull.go
blob: aaee91343af3a2b80fb999a99d9c520681c0f5e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
	repos := forge.Repos.SortByGoPath()
	for repos.Scan() {
		repo := repos.Next()
		if argv.DryRun {
			log.Info("git pull --dry-run", repo.GoPath)
			continue
		}
		log.Info("git pull:", repo.FullPath)
		trycount += 1
		log.Info("actually run: git pull:", repo.GoPath)
		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)
}