From 0e84f2f1c116c69700a77ee745782f2628654126 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 17 Dec 2024 01:14:37 -0600 Subject: [PATCH] more cleanups to fix forgepb values --- cobol.go | 3 --- doCommon.go | 23 ----------------------- doDelete.go | 41 ----------------------------------------- main.go | 11 +++++------ 4 files changed, 5 insertions(+), 73 deletions(-) delete mode 100644 doDelete.go diff --git a/cobol.go b/cobol.go index 4c2263d..d3d1724 100644 --- a/cobol.go +++ b/cobol.go @@ -109,9 +109,6 @@ func verifyPrint(repo *gitpb.Repo) { } func verify(repo *gitpb.Repo, s map[string]string) bool { - if !repo.IsValid() { - // return false - } s["gopath"] = repo.GetGoPath() s["rtype"] = repo.RepoType() diff --git a/doCommon.go b/doCommon.go index 3e94055..5c37739 100644 --- a/doCommon.go +++ b/doCommon.go @@ -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 { dname := repo.GetDevelBranchName() if dname == "" { diff --git a/doDelete.go b/doDelete.go deleted file mode 100644 index b0ab05e..0000000 --- a/doDelete.go +++ /dev/null @@ -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 -} diff --git a/main.go b/main.go index 0ebe1bc..1cd90a3 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,10 @@ func main() { me.forge = forgepb.Init() me.found = new(gitpb.Repos) + if argv.Fix { + okExit("") + } + // first find the repos or gopaths to operate on if argv.Config { if findConfig() { @@ -38,6 +42,7 @@ func main() { } else { findRepos() } + // okExit("") log.Info("found", me.found.Len(), "repos. found", len(me.foundPaths), "paths from .config/forge") @@ -69,12 +74,6 @@ func main() { done = true } - if argv.Fix { - // print out the repos - doFix() - done = true - } - if argv.DoPatchSet { sendDevelDiff() // sendMasterDiff()