summaryrefslogtreecommitdiff
path: root/doCommon.go
blob: 81578bf74ddce03fff0ad4bbd5150620ae5f7066 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main

import (
	"go.wit.com/lib/protobuf/gitpb"
	"go.wit.com/log"
)

func doScan() {
	me.forge.ScanGoSrc()
}

func doGitPull() {
	allerr := me.found.RillGitPull(40, 5)

	all := me.found.SortByGoPath()
	for all.Scan() {
		repo := all.Next()
		result := allerr[repo]
		if result.Error == gitpb.ErrorGitPullOnDirty {
			log.Info("skip git pull. repo is dirty", repo.GoPath)
			continue
		}
		if result.Error == gitpb.ErrorGitPullOnLocal {
			log.Info("skip git pull. local branch ", repo.GoPath)
			continue
		}
		if result.Exit == 0 {
			continue
		}

		log.Info("git pull error:", repo.GoPath, result.Error)
		log.Info("git pull error:", repo.GoPath, result.Stdout)
	}

}

func doFix() {
	all := me.found.SortByGoPath()
	for all.Scan() {
		repo := all.Next()
		if !repo.IsValid() {
			log.Printf("%10s %-50s", "old?\n", repo.GetGoPath())
			continue
		}
		log.Printf("running on: %-50s\n", repo.GetGoPath())
		cmd := []string{"ls"}
		repo.Run(cmd)
	}
}