From c4252d21031ed432405be6a4f008831732068101 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 31 Aug 2025 12:16:38 -0500 Subject: [PATCH] maybe locks will work. maybe I can make a global repos.pb file? --- doCheckout.go | 6 +++--- doClean.go | 8 ++++---- doFind.go | 26 +++++++++++++------------- doGui.go | 8 ++++---- doNormal.go | 7 ++++++- windowReposFix.go | 12 ++++++------ windowReposNew.go | 6 +++--- 7 files changed, 39 insertions(+), 34 deletions(-) diff --git a/doCheckout.go b/doCheckout.go index 2dbddff..809434d 100644 --- a/doCheckout.go +++ b/doCheckout.go @@ -142,7 +142,7 @@ func doAllCheckoutUser() error { for all.Scan() { repo := all.Next() if repo.GetCurrentBranchName() != repo.GetUserBranchName() { - found.AppendByGoPath(repo) + found.Append(repo) } } me.forge.PrintHumanTable(found) @@ -188,7 +188,7 @@ func doAllCheckoutDevel() error { for all.Scan() { repo := all.Next() if repo.GetCurrentBranchName() != repo.GetDevelBranchName() { - found.AppendByGoPath(repo) + found.Append(repo) } } me.forge.PrintHumanTable(found) @@ -255,7 +255,7 @@ func doAllCheckoutMaster() error { for all.Scan() { repo := all.Next() if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { - found.AppendByGoPath(repo) + found.Append(repo) } } me.forge.PrintHumanTable(found) diff --git a/doClean.go b/doClean.go index 42d2f4a..51230c6 100644 --- a/doClean.go +++ b/doClean.go @@ -55,25 +55,25 @@ func doClean() error { // find repos not on master branch if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } // find dirty repos if repo.IsDirty() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } // find repos that still have a local user branch if repo.IsLocalBranch(repo.GetUserBranchName()) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } // find repos that still have a local devel branch if repo.IsLocalBranch(repo.GetDevelBranchName()) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } } diff --git a/doFind.go b/doFind.go index ca8ab76..65edb43 100644 --- a/doFind.go +++ b/doFind.go @@ -66,7 +66,7 @@ func findPrivate() *gitpb.Repos { found := gitpb.NewRepos() for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsPrivate(repo.GetGoPath()) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } @@ -81,7 +81,7 @@ func findMine() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsWritable(repo.GetGoPath()) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } return found @@ -95,7 +95,7 @@ func findFavorites() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsFavorite(repo.GetGoPath()) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } return found @@ -107,7 +107,7 @@ func findDirty() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { if repo.IsDirty() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } return found @@ -116,7 +116,7 @@ func findDirty() *gitpb.Repos { func findAll() *gitpb.Repos { found := gitpb.NewRepos() for repo := range me.forge.Repos.IterByFullPath() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } return found } @@ -125,7 +125,7 @@ func find50() *gitpb.Repos { count := 0 found := gitpb.NewRepos() for repo := range me.forge.Repos.IterByFullPath() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) if count > 50 { return found } @@ -139,7 +139,7 @@ func findUser() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { if repo.GetCurrentBranchName() == repo.GetUserBranchName() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } return found @@ -152,7 +152,7 @@ func findPublishable() *gitpb.Repos { if repo.GetTargetVersion() == "" { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } return found } @@ -163,12 +163,12 @@ func findReposWithPatches() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { if repo.GetTargetVersion() != "" { // add everything that has a target version set - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } if repo.IsDirty() { // always add dirty branches - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } if repo.GetUserVersion() == "" || repo.GetUserVersion() == "uerr" { @@ -176,13 +176,13 @@ func findReposWithPatches() *gitpb.Repos { continue } if repo.GetUserVersion() != repo.GetDevelVersion() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } // show anything that differs between 'devel' & 'master' branches if repo.GetDevelVersion() != repo.GetMasterVersion() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } @@ -193,7 +193,7 @@ func findReposWithPatches() *gitpb.Repos { // this is an old test to see if the current 'last tag' is accurate and should be removed if repo.GetLastTag() != repo.GetMasterVersion() { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) repo.FindLastTag() continue } diff --git a/doGui.go b/doGui.go index 3b129bd..ec28b2a 100644 --- a/doGui.go +++ b/doGui.go @@ -41,7 +41,7 @@ func debug() { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } tmp := fmt.Sprintf("writable (%d)", found.Len()) @@ -233,7 +233,7 @@ func findMergeToDevel() *gitpb.Repos { for repo := range me.forge.Repos.IterByFullPath() { // this sees if user has patches for devel. If it does, add it to found if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } now := time.Now() @@ -264,7 +264,7 @@ func findMergeToMaster() *gitpb.Repos { continue } if repo.GetMasterVersion() != repo.GetDevelVersion() { - me.found.AppendByGoPath(repo) + me.found.AppendByFullPath(repo) continue } */ @@ -279,7 +279,7 @@ func findMergeToMaster() *gitpb.Repos { // this sees if devel has patches for master. If it does, add it to me.found if repo.CountDiffObjects(repo.GetDevelBranchName(), repo.GetMasterBranchName()) > 0 { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } now := time.Now() diff --git a/doNormal.go b/doNormal.go index b625f65..0382be7 100644 --- a/doNormal.go +++ b/doNormal.go @@ -30,6 +30,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error { if repo.GetMasterBranchName() == "" { me.forge.VerifyBranchNames(repo) configSave = true + log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath()) } if repo.GetMasterBranchName() == "" { return log.Errorf("master branch name blank") @@ -44,7 +45,11 @@ func checkNormalRepoState(repo *gitpb.Repo) error { return err } if repo.GetCurrentBranchName() != repo.GetUserBranchName() { - return repo.CheckoutUser() + if err := repo.CheckoutUser(); err != nil { + return err + } + _, err := me.forge.ReAdd(repo) + return err } return nil } diff --git a/windowReposFix.go b/windowReposFix.go index e5452b5..9fa38f1 100644 --- a/windowReposFix.go +++ b/windowReposFix.go @@ -279,7 +279,7 @@ func develBehindMasterProblem() *gitpb.Repos { if repo.GetDevelVersion() == repo.GetMasterVersion() { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } return found @@ -292,7 +292,7 @@ func remoteUserBranchProblem() *gitpb.Repos { repo := all.Next() username := repo.GetUserBranchName() if repo.IsBranchRemote(username) { - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } } @@ -314,13 +314,13 @@ func develRemoteProblem() *gitpb.Repos { // log.Info(lhash, rhash, repo.GetGoPath()) if lhash == "" || rhash == "" { // something is wrong if either of these are blank - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } if lhash == rhash { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } return found @@ -341,13 +341,13 @@ func masterRemoteProblem() *gitpb.Repos { // log.Info(lhash, rhash, repo.GetGoPath()) if lhash == "" || rhash == "" { // something is wrong if either of these are blank - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) continue } if lhash == rhash { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } return found diff --git a/windowReposNew.go b/windowReposNew.go index 2469205..3651d82 100644 --- a/windowReposNew.go +++ b/windowReposNew.go @@ -93,7 +93,7 @@ func makeReposWinNew() *gadgets.GenericWindow { if !me.forge.Config.IsFavorite(repo.GetGoPath()) { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } // make the window for the first time @@ -117,7 +117,7 @@ func makeReposWinNew() *gadgets.GenericWindow { if me.forge.Config.IsReadOnly(repo.GetGoPath()) { continue } - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } // make the window for the first time @@ -138,7 +138,7 @@ func makeReposWinNew() *gadgets.GenericWindow { all := me.forge.Repos.SortByFullPath() for all.Scan() { repo := all.Next() - found.AppendByGoPath(repo) + found.AppendByFullPath(repo) } // display the protobuf