lots of changes here and in gitpb
This commit is contained in:
parent
ac029ee52c
commit
36073faed5
13
Makefile
13
Makefile
|
@ -2,7 +2,10 @@ VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
all: install
|
all: install
|
||||||
forge
|
@echo make private # only the private ones
|
||||||
|
@echo make mine # just show my repos
|
||||||
|
@echo make restart # remove the repos.pb file
|
||||||
|
@echo make pull # run git pull on every repo
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
|
@ -37,6 +40,9 @@ private: install
|
||||||
fix: install
|
fix: install
|
||||||
forge --fix --find-all
|
forge --fix --find-all
|
||||||
|
|
||||||
|
all: install
|
||||||
|
forge --find-all
|
||||||
|
|
||||||
git-reset: install
|
git-reset: install
|
||||||
forge --do-git-reset --find-all
|
forge --do-git-reset --find-all
|
||||||
|
|
||||||
|
@ -66,3 +72,8 @@ patches-localhost: install
|
||||||
|
|
||||||
patches-list: install
|
patches-list: install
|
||||||
forge --list-patches --url "http://localhost:2233/"
|
forge --list-patches --url "http://localhost:2233/"
|
||||||
|
|
||||||
|
restart:
|
||||||
|
reset
|
||||||
|
rm ~/go/src/repos.pb
|
||||||
|
make config
|
||||||
|
|
47
cobol.go
47
cobol.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -34,7 +33,7 @@ func doCobol() {
|
||||||
log.DaemonMode(true)
|
log.DaemonMode(true)
|
||||||
|
|
||||||
log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
|
log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
|
||||||
all := me.found.SortByGoPath()
|
all := me.found.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
verifyPrint(repo)
|
verifyPrint(repo)
|
||||||
|
@ -78,19 +77,12 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
}
|
}
|
||||||
s := make(map[string]string)
|
s := make(map[string]string)
|
||||||
if !verify(repo, s) {
|
if !verify(repo, s) {
|
||||||
log.Info("going to delete", repo.GoPath)
|
log.Info("going to delete", repo.GetGoPath())
|
||||||
if argv.Fix {
|
if argv.Fix {
|
||||||
me.forge.Repos.DeleteByGoPath(repo.GetGoPath())
|
me.forge.DeleteByGoPath(repo.GetGoPath())
|
||||||
me.forge.Repos.ConfigSave()
|
me.forge.Repos.ConfigSave()
|
||||||
} else {
|
} else {
|
||||||
log.Info("need argv --real to delete", repo.GoPath)
|
log.Info("need argv --fix to delete", repo.GetGoPath())
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
|
||||||
if repo.ReadOnly {
|
|
||||||
} else {
|
|
||||||
log.Info("readonly flag on repo is wrong", repo.GoPath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +93,7 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
// start := fmt.Sprintf("%-40s %-12s %-12s %-12s %-8s", s["gopath"], cname, mhort, uhort, s["rtype"])
|
// start := fmt.Sprintf("%-40s %-12s %-12s %-12s %-8s", s["gopath"], cname, mhort, uhort, s["rtype"])
|
||||||
start := standardStart5(s["gopath"], cname, mhort, uhort, s["rtype"])
|
start := standardStart5(s["gopath"], cname, mhort, uhort, s["rtype"])
|
||||||
|
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
end += "(readonly) "
|
end += "(readonly) "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,46 +102,39 @@ func verifyPrint(repo *gitpb.Repo) {
|
||||||
|
|
||||||
func verify(repo *gitpb.Repo, s map[string]string) bool {
|
func verify(repo *gitpb.Repo, s map[string]string) bool {
|
||||||
s["gopath"] = repo.GetGoPath()
|
s["gopath"] = repo.GetGoPath()
|
||||||
s["rtype"] = repo.RepoType()
|
s["rtype"] = repo.GetRepoType()
|
||||||
|
|
||||||
s["mname"] = repo.GetMasterBranchName()
|
s["mname"] = repo.GetMasterBranchName()
|
||||||
if s["mname"] == "" {
|
if s["mname"] == "" {
|
||||||
log.Info("verify() no master branch name", repo.GoPath)
|
log.Info("verify() no master branch name", repo.FullPath)
|
||||||
s["mver"] = repo.GetMasterVersion()
|
s["mver"] = repo.GetMasterVersion()
|
||||||
return false
|
// return false
|
||||||
}
|
|
||||||
// only verify the master branch name with read-only repos
|
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
|
||||||
s["mver"] = repo.GetMasterVersion()
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
s["mver"] = repo.GetMasterVersion()
|
||||||
|
|
||||||
s["dname"] = repo.GetDevelBranchName()
|
s["dname"] = repo.GetDevelBranchName()
|
||||||
if s["dname"] == "" {
|
if s["dname"] == "" {
|
||||||
log.Info("verify() no devel branch name", repo.GoPath)
|
log.Info("verify() no devel branch name", repo.GetGoPath())
|
||||||
return false
|
// return false
|
||||||
}
|
}
|
||||||
s["uname"] = repo.GetUserBranchName()
|
s["uname"] = repo.GetUserBranchName()
|
||||||
if s["uname"] == "" {
|
if s["uname"] == "" {
|
||||||
log.Info("verify() no user branch name", repo.GoPath)
|
log.Info("verify() no user branch name", repo.GetGoPath())
|
||||||
return false
|
// return false
|
||||||
}
|
}
|
||||||
s["cname"] = repo.GetCurrentBranchName()
|
s["cname"] = repo.GetCurrentBranchName()
|
||||||
|
|
||||||
s["mver"] = repo.GetMasterVersion()
|
s["mver"] = repo.GetMasterVersion()
|
||||||
if s["mver"] == "" {
|
if s["mver"] == "" {
|
||||||
log.Info("verify() no master branch name", repo.GoPath, repo.GetMasterBranchName())
|
log.Info("verify() no master branch name", repo.FullPath, repo.GetMasterBranchName())
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
s["dver"] = repo.GetDevelVersion()
|
s["dver"] = repo.GetDevelVersion()
|
||||||
if s["dver"] == "" {
|
if s["dver"] == "" {
|
||||||
log.Info("verify() no devel branch name", repo.GoPath, repo.GetDevelBranchName())
|
log.Info("verify() no devel branch name", repo.GetGoPath(), repo.GetDevelBranchName())
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
s["uver"] = repo.GetUserVersion()
|
s["uver"] = repo.GetUserVersion()
|
||||||
if s["uver"] == "" {
|
if s["uver"] == "" {
|
||||||
log.Info("verify() no user branch name", repo.GoPath, repo.GetUserBranchName())
|
log.Info("verify() no user branch name", repo.GetGoPath(), repo.GetUserBranchName())
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
s["cver"] = repo.GetCurrentBranchVersion()
|
s["cver"] = repo.GetCurrentBranchVersion()
|
||||||
s["url"] = repo.URL
|
s["url"] = repo.URL
|
||||||
|
|
24
doCommon.go
24
doCommon.go
|
@ -12,24 +12,24 @@ func doScan() {
|
||||||
func doGitPull() {
|
func doGitPull() {
|
||||||
allerr := me.found.RillGitPull(40, 5)
|
allerr := me.found.RillGitPull(40, 5)
|
||||||
|
|
||||||
all := me.found.SortByGoPath()
|
all := me.found.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
result := allerr[repo]
|
result := allerr[repo]
|
||||||
if result.Error == gitpb.ErrorGitPullOnDirty {
|
if result.Error == gitpb.ErrorGitPullOnDirty {
|
||||||
log.Info("skip git pull. repo is dirty", repo.GoPath)
|
log.Info("skip git pull. repo is dirty", repo.GetGoPath())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if result.Error == gitpb.ErrorGitPullOnLocal {
|
if result.Error == gitpb.ErrorGitPullOnLocal {
|
||||||
log.Info("skip git pull. local branch ", repo.GoPath)
|
log.Info("skip git pull. local branch ", repo.GetGoPath())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if result.Exit == 0 {
|
if result.Exit == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("git pull error:", repo.GoPath, result.Error)
|
log.Info("git pull error:", repo.GetGoPath(), result.Error)
|
||||||
log.Info("git pull error:", repo.GoPath, result.Stdout)
|
log.Info("git pull error:", repo.GetGoPath(), result.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,18 +37,18 @@ func doGitReset() {
|
||||||
if !argv.DoGitReset {
|
if !argv.DoGitReset {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
all := me.found.SortByGoPath()
|
all := me.found.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
// log.Info("is readonly", repo.GoPath)
|
// log.Info("is readonly", repo.GetGoPath())
|
||||||
if repo.CheckDirty() {
|
if repo.CheckDirty() {
|
||||||
log.Info("is readonly and dirty", repo.GoPath)
|
log.Info("is readonly and dirty", repo.GetGoPath())
|
||||||
cmd := []string{"git", "reset", "--hard"}
|
cmd := []string{"git", "reset", "--hard"}
|
||||||
repo.RunRealtime(cmd)
|
repo.RunRealtime(cmd)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// log.Info("is not readonly", repo.GoPath)
|
// log.Info("is not readonly", repo.GetGoPath())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,14 +57,14 @@ func checkoutBranches(repo *gitpb.Repo) error {
|
||||||
dname := repo.GetDevelBranchName()
|
dname := repo.GetDevelBranchName()
|
||||||
if dname == "" {
|
if dname == "" {
|
||||||
if err := me.forge.MakeDevelBranch(repo); err != nil {
|
if err := me.forge.MakeDevelBranch(repo); err != nil {
|
||||||
log.Info("verify() no devel branch name", repo.GoPath)
|
log.Info("verify() no devel branch name", repo.GetGoPath())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
configSave = true
|
configSave = true
|
||||||
}
|
}
|
||||||
if repo.GetUserBranchName() == "" {
|
if repo.GetUserBranchName() == "" {
|
||||||
if err := me.forge.MakeUserBranch(repo); err != nil {
|
if err := me.forge.MakeUserBranch(repo); err != nil {
|
||||||
log.Info("verify() no devel branch name", repo.GoPath)
|
log.Info("verify() no devel branch name", repo.GetGoPath())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
configSave = true
|
configSave = true
|
||||||
|
|
|
@ -4,7 +4,7 @@ package main
|
||||||
|
|
||||||
func doRedoGoMod() {
|
func doRedoGoMod() {
|
||||||
// me.forge.RillRedoGoMod()
|
// me.forge.RillRedoGoMod()
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if err := repo.ValidGoSum(); err == nil {
|
if err := repo.ValidGoSum(); err == nil {
|
||||||
|
|
4
exit.go
4
exit.go
|
@ -9,10 +9,10 @@ import (
|
||||||
func okExit(thing string) {
|
func okExit(thing string) {
|
||||||
log.Info(thing, "ok")
|
log.Info(thing, "ok")
|
||||||
if configSave {
|
if configSave {
|
||||||
me.forge.ConfigSave()
|
me.forge.SetConfigSave(configSave)
|
||||||
}
|
}
|
||||||
// log.Info("Finished go-clean on", check.GetGoPath(), "ok")
|
// log.Info("Finished go-clean on", check.GetGoPath(), "ok")
|
||||||
os.Exit(0)
|
me.forge.Exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func badExit(err error) {
|
func badExit(err error) {
|
||||||
|
|
18
findRepos.go
18
findRepos.go
|
@ -35,10 +35,10 @@ func findRepos() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func findPrivate() {
|
func findPrivate() {
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if me.forge.Config.IsPrivate(repo.GoPath) {
|
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
|
||||||
me.found.AppendUniqueGoPath(repo)
|
me.found.AppendUniqueGoPath(repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ func findPrivate() {
|
||||||
// finds repos that are writable
|
// finds repos that are writable
|
||||||
func findMine() {
|
func findMine() {
|
||||||
// log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
// log.Printf("get mine %s\n", me.forge.GetGoSrc())
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if me.forge.Config.IsWritable(repo.GoPath) {
|
if me.forge.Config.IsWritable(repo.GetGoPath()) {
|
||||||
me.found.AppendUniqueGoPath(repo)
|
me.found.AppendUniqueGoPath(repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,25 +59,25 @@ func findMine() {
|
||||||
// finds repos that are writable
|
// finds repos that are writable
|
||||||
func findFavorites() {
|
func findFavorites() {
|
||||||
// log.Printf("get favorites %s\n", me.forge.GetGoSrc())
|
// log.Printf("get favorites %s\n", me.forge.GetGoSrc())
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if me.forge.Config.IsFavorite(repo.GoPath) {
|
if me.forge.Config.IsFavorite(repo.GetGoPath()) {
|
||||||
me.found.AppendUniqueGoPath(repo)
|
me.found.AppendUniqueGoPath(repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func findAll() {
|
func findAll() {
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
me.found.AppendUniqueGoPath(repo)
|
me.found.AppendUniqueGoPath(repo)
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) && !argv.FindReadOnly {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) && !argv.FindReadOnly {
|
||||||
if repo.ReadOnly {
|
if repo.ReadOnly {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("todo: ConfigSave() readonly flag on repo is wrong", repo.GoPath)
|
log.Info("todo: ConfigSave() readonly flag on repo is wrong", repo.GetGoPath())
|
||||||
repo.ReadOnly = true
|
repo.ReadOnly = true
|
||||||
configSave = true
|
configSave = true
|
||||||
continue
|
continue
|
||||||
|
|
27
main.go
27
main.go
|
@ -3,7 +3,6 @@ package main
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
|
@ -19,6 +18,15 @@ var BUILDTIME string
|
||||||
// using this for now. triggers config save
|
// using this for now. triggers config save
|
||||||
var configSave bool
|
var configSave bool
|
||||||
|
|
||||||
|
func getVersion(repo *gitpb.Repo, name string) string {
|
||||||
|
cmd := []string{"git", "describe", "--tags", "--always", name}
|
||||||
|
result := repo.RunQuiet(cmd)
|
||||||
|
output := strings.Join(result.Stdout, "\n")
|
||||||
|
log.Info("cmd =", cmd, output)
|
||||||
|
|
||||||
|
return strings.TrimSpace(output)
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(mainType)
|
me = new(mainType)
|
||||||
me.pp = arg.MustParse(&argv)
|
me.pp = arg.MustParse(&argv)
|
||||||
|
@ -29,6 +37,20 @@ func main() {
|
||||||
me.forge = forgepb.Init()
|
me.forge = forgepb.Init()
|
||||||
me.found = new(gitpb.Repos)
|
me.found = new(gitpb.Repos)
|
||||||
|
|
||||||
|
if configSave {
|
||||||
|
me.forge.ConfigSave()
|
||||||
|
configSave = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// var count int
|
||||||
|
all := me.forge.Repos.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
verifyPrint(repo)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if argv.Fix {
|
if argv.Fix {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
@ -37,7 +59,7 @@ func main() {
|
||||||
if argv.Config {
|
if argv.Config {
|
||||||
if findConfig() {
|
if findConfig() {
|
||||||
me.forge.ConfigPrintTable()
|
me.forge.ConfigPrintTable()
|
||||||
os.Exit(0)
|
okExit("")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
findRepos()
|
findRepos()
|
||||||
|
@ -93,4 +115,5 @@ func main() {
|
||||||
// if nothing was selected, print out a table of them on STDOUT
|
// if nothing was selected, print out a table of them on STDOUT
|
||||||
doCobol()
|
doCobol()
|
||||||
}
|
}
|
||||||
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
s.grid.NewButton("Update Patch Counts", func() {
|
s.grid.NewButton("Update Patch Counts", func() {
|
||||||
var repocount, patchcount int
|
var repocount, patchcount int
|
||||||
// broken after move to forge protobuf
|
// broken after move to forge protobuf
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if repo.GetReadOnly() {
|
if repo.GetReadOnly() {
|
||||||
|
@ -75,7 +75,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
repocount = 0
|
repocount = 0
|
||||||
patchcount = 0
|
patchcount = 0
|
||||||
// broken after move to forge protobuf
|
// broken after move to forge protobuf
|
||||||
all = me.forge.Repos.SortByGoPath()
|
all = me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
if repo.GetReadOnly() {
|
if repo.GetReadOnly() {
|
||||||
|
@ -189,7 +189,7 @@ func (s *patchSummary) Update() {
|
||||||
var userT, develT, masterT int
|
var userT, develT, masterT int
|
||||||
// var userP, develP, masterP int
|
// var userP, develP, masterP int
|
||||||
// broken after move to forge protobuf
|
// broken after move to forge protobuf
|
||||||
all := me.forge.Repos.SortByGoPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
total += 1
|
total += 1
|
||||||
|
|
Loading…
Reference in New Issue