more cleanups to fix forgepb values

This commit is contained in:
Jeff Carr 2024-12-17 01:14:37 -06:00
parent a71305ea52
commit 0e84f2f1c1
4 changed files with 5 additions and 73 deletions

View File

@ -109,9 +109,6 @@ 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 {
if !repo.IsValid() {
// return false
}
s["gopath"] = repo.GetGoPath() s["gopath"] = repo.GetGoPath()
s["rtype"] = repo.RepoType() s["rtype"] = repo.RepoType()

View File

@ -53,29 +53,6 @@ func doGitReset() {
} }
} }
func doFix() {
all := me.found.SortByGoPath()
for all.Scan() {
repo := all.Next()
if !repo.IsValid() {
log.Printf("%10s %-50s", "old?\n", repo.GoPath)
me.forge.Repos.DeleteByGoPath(repo.GoPath)
configSave = true
continue
}
log.Printf("running on: %-50s\n", repo.GetGoPath())
cmd := []string{"ls"}
repo.Run(cmd)
if err := checkoutBranches(repo); err != nil {
badExit(err)
}
}
if configSave {
me.forge.Repos.ConfigSave()
okExit("config saved")
}
}
func checkoutBranches(repo *gitpb.Repo) error { func checkoutBranches(repo *gitpb.Repo) error {
dname := repo.GetDevelBranchName() dname := repo.GetDevelBranchName()
if dname == "" { if dname == "" {

View File

@ -1,41 +0,0 @@
package main
import (
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func Delete(repo *gitpb.Repo, s map[string]string) bool {
if repo.Published == nil {
log.Info("published is nil", repo.Published)
} else {
log.Info("published len", repo.Published.Len())
}
// add a new one here
newr := gitpb.Repo{
FullPath: repo.FullPath,
GoPath: repo.GoPath,
URL: repo.URL,
Tags: repo.Tags,
LastPull: repo.LastPull,
MasterBranchName: repo.MasterBranchName,
DevelBranchName: repo.DevelBranchName,
UserBranchName: repo.UserBranchName,
GoLibrary: repo.GoLibrary,
GoBinary: repo.GoBinary,
GoPrimitive: repo.GoPrimitive,
GoPlugin: repo.GoPlugin,
GoDeps: repo.GoDeps,
LastGoDep: repo.LastGoDep,
Dirty: repo.Dirty,
Published: repo.Published,
TargetVersion: repo.TargetVersion,
ReadOnly: repo.ReadOnly,
GoProtobuf: repo.GoProtobuf,
}
if argv.Fix {
me.forge.Repos.AppendUniqueGoPath(&newr)
}
return true
}

11
main.go
View File

@ -29,6 +29,10 @@ func main() {
me.forge = forgepb.Init() me.forge = forgepb.Init()
me.found = new(gitpb.Repos) me.found = new(gitpb.Repos)
if argv.Fix {
okExit("")
}
// first find the repos or gopaths to operate on // first find the repos or gopaths to operate on
if argv.Config { if argv.Config {
if findConfig() { if findConfig() {
@ -38,6 +42,7 @@ func main() {
} else { } else {
findRepos() findRepos()
} }
// okExit("")
log.Info("found", me.found.Len(), "repos. found", len(me.foundPaths), "paths from .config/forge") log.Info("found", me.found.Len(), "repos. found", len(me.foundPaths), "paths from .config/forge")
@ -69,12 +74,6 @@ func main() {
done = true done = true
} }
if argv.Fix {
// print out the repos
doFix()
done = true
}
if argv.DoPatchSet { if argv.DoPatchSet {
sendDevelDiff() sendDevelDiff()
// sendMasterDiff() // sendMasterDiff()