maybe locks will work. maybe I can make a global repos.pb file?

This commit is contained in:
Jeff Carr 2025-08-31 12:16:38 -05:00
parent 9292eb18fa
commit c4252d2103
7 changed files with 39 additions and 34 deletions

View File

@ -142,7 +142,7 @@ func doAllCheckoutUser() error {
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
if repo.GetCurrentBranchName() != repo.GetUserBranchName() { if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
found.AppendByGoPath(repo) found.Append(repo)
} }
} }
me.forge.PrintHumanTable(found) me.forge.PrintHumanTable(found)
@ -188,7 +188,7 @@ func doAllCheckoutDevel() error {
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
if repo.GetCurrentBranchName() != repo.GetDevelBranchName() { if repo.GetCurrentBranchName() != repo.GetDevelBranchName() {
found.AppendByGoPath(repo) found.Append(repo)
} }
} }
me.forge.PrintHumanTable(found) me.forge.PrintHumanTable(found)
@ -255,7 +255,7 @@ func doAllCheckoutMaster() error {
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { if repo.GetCurrentBranchName() != repo.GetMasterBranchName() {
found.AppendByGoPath(repo) found.Append(repo)
} }
} }
me.forge.PrintHumanTable(found) me.forge.PrintHumanTable(found)

View File

@ -55,25 +55,25 @@ func doClean() error {
// find repos not on master branch // find repos not on master branch
if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { if repo.GetCurrentBranchName() != repo.GetMasterBranchName() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
// find dirty repos // find dirty repos
if repo.IsDirty() { if repo.IsDirty() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
// find repos that still have a local user branch // find repos that still have a local user branch
if repo.IsLocalBranch(repo.GetUserBranchName()) { if repo.IsLocalBranch(repo.GetUserBranchName()) {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
// find repos that still have a local devel branch // find repos that still have a local devel branch
if repo.IsLocalBranch(repo.GetDevelBranchName()) { if repo.IsLocalBranch(repo.GetDevelBranchName()) {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
} }

View File

@ -66,7 +66,7 @@ func findPrivate() *gitpb.Repos {
found := gitpb.NewRepos() found := gitpb.NewRepos()
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
if me.forge.Config.IsPrivate(repo.GetGoPath()) { 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() { for repo := range me.forge.Repos.IterByFullPath() {
if me.forge.Config.IsWritable(repo.GetGoPath()) { if me.forge.Config.IsWritable(repo.GetGoPath()) {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
return found return found
@ -95,7 +95,7 @@ func findFavorites() *gitpb.Repos {
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
if me.forge.Config.IsFavorite(repo.GetGoPath()) { if me.forge.Config.IsFavorite(repo.GetGoPath()) {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
return found return found
@ -107,7 +107,7 @@ func findDirty() *gitpb.Repos {
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
if repo.IsDirty() { if repo.IsDirty() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
return found return found
@ -116,7 +116,7 @@ func findDirty() *gitpb.Repos {
func findAll() *gitpb.Repos { func findAll() *gitpb.Repos {
found := gitpb.NewRepos() found := gitpb.NewRepos()
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
return found return found
} }
@ -125,7 +125,7 @@ func find50() *gitpb.Repos {
count := 0 count := 0
found := gitpb.NewRepos() found := gitpb.NewRepos()
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
if count > 50 { if count > 50 {
return found return found
} }
@ -139,7 +139,7 @@ func findUser() *gitpb.Repos {
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
if repo.GetCurrentBranchName() == repo.GetUserBranchName() { if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
return found return found
@ -152,7 +152,7 @@ func findPublishable() *gitpb.Repos {
if repo.GetTargetVersion() == "" { if repo.GetTargetVersion() == "" {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
return found return found
} }
@ -163,12 +163,12 @@ func findReposWithPatches() *gitpb.Repos {
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
if repo.GetTargetVersion() != "" { if repo.GetTargetVersion() != "" {
// add everything that has a target version set // add everything that has a target version set
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
if repo.IsDirty() { if repo.IsDirty() {
// always add dirty branches // always add dirty branches
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
if repo.GetUserVersion() == "" || repo.GetUserVersion() == "uerr" { if repo.GetUserVersion() == "" || repo.GetUserVersion() == "uerr" {
@ -176,13 +176,13 @@ func findReposWithPatches() *gitpb.Repos {
continue continue
} }
if repo.GetUserVersion() != repo.GetDevelVersion() { if repo.GetUserVersion() != repo.GetDevelVersion() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
// show anything that differs between 'devel' & 'master' branches // show anything that differs between 'devel' & 'master' branches
if repo.GetDevelVersion() != repo.GetMasterVersion() { if repo.GetDevelVersion() != repo.GetMasterVersion() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue 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 // this is an old test to see if the current 'last tag' is accurate and should be removed
if repo.GetLastTag() != repo.GetMasterVersion() { if repo.GetLastTag() != repo.GetMasterVersion() {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
repo.FindLastTag() repo.FindLastTag()
continue continue
} }

View File

@ -41,7 +41,7 @@ func debug() {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
tmp := fmt.Sprintf("writable (%d)", found.Len()) tmp := fmt.Sprintf("writable (%d)", found.Len())
@ -233,7 +233,7 @@ func findMergeToDevel() *gitpb.Repos {
for repo := range me.forge.Repos.IterByFullPath() { for repo := range me.forge.Repos.IterByFullPath() {
// this sees if user has patches for devel. If it does, add it to found // this sees if user has patches for devel. If it does, add it to found
if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 { if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
now := time.Now() now := time.Now()
@ -264,7 +264,7 @@ func findMergeToMaster() *gitpb.Repos {
continue continue
} }
if repo.GetMasterVersion() != repo.GetDevelVersion() { if repo.GetMasterVersion() != repo.GetDevelVersion() {
me.found.AppendByGoPath(repo) me.found.AppendByFullPath(repo)
continue 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 // this sees if devel has patches for master. If it does, add it to me.found
if repo.CountDiffObjects(repo.GetDevelBranchName(), repo.GetMasterBranchName()) > 0 { if repo.CountDiffObjects(repo.GetDevelBranchName(), repo.GetMasterBranchName()) > 0 {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
now := time.Now() now := time.Now()

View File

@ -30,6 +30,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
if repo.GetMasterBranchName() == "" { if repo.GetMasterBranchName() == "" {
me.forge.VerifyBranchNames(repo) me.forge.VerifyBranchNames(repo)
configSave = true configSave = true
log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath())
} }
if repo.GetMasterBranchName() == "" { if repo.GetMasterBranchName() == "" {
return log.Errorf("master branch name blank") return log.Errorf("master branch name blank")
@ -44,7 +45,11 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
return err return err
} }
if repo.GetCurrentBranchName() != repo.GetUserBranchName() { 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 return nil
} }

View File

@ -279,7 +279,7 @@ func develBehindMasterProblem() *gitpb.Repos {
if repo.GetDevelVersion() == repo.GetMasterVersion() { if repo.GetDevelVersion() == repo.GetMasterVersion() {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
return found return found
@ -292,7 +292,7 @@ func remoteUserBranchProblem() *gitpb.Repos {
repo := all.Next() repo := all.Next()
username := repo.GetUserBranchName() username := repo.GetUserBranchName()
if repo.IsBranchRemote(username) { if repo.IsBranchRemote(username) {
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
} }
@ -314,13 +314,13 @@ func develRemoteProblem() *gitpb.Repos {
// log.Info(lhash, rhash, repo.GetGoPath()) // log.Info(lhash, rhash, repo.GetGoPath())
if lhash == "" || rhash == "" { if lhash == "" || rhash == "" {
// something is wrong if either of these are blank // something is wrong if either of these are blank
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
if lhash == rhash { if lhash == rhash {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
return found return found
@ -341,13 +341,13 @@ func masterRemoteProblem() *gitpb.Repos {
// log.Info(lhash, rhash, repo.GetGoPath()) // log.Info(lhash, rhash, repo.GetGoPath())
if lhash == "" || rhash == "" { if lhash == "" || rhash == "" {
// something is wrong if either of these are blank // something is wrong if either of these are blank
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
continue continue
} }
if lhash == rhash { if lhash == rhash {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
return found return found

View File

@ -93,7 +93,7 @@ func makeReposWinNew() *gadgets.GenericWindow {
if !me.forge.Config.IsFavorite(repo.GetGoPath()) { if !me.forge.Config.IsFavorite(repo.GetGoPath()) {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
// make the window for the first time // make the window for the first time
@ -117,7 +117,7 @@ func makeReposWinNew() *gadgets.GenericWindow {
if me.forge.Config.IsReadOnly(repo.GetGoPath()) { if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
continue continue
} }
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
// make the window for the first time // make the window for the first time
@ -138,7 +138,7 @@ func makeReposWinNew() *gadgets.GenericWindow {
all := me.forge.Repos.SortByFullPath() all := me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
found.AppendByGoPath(repo) found.AppendByFullPath(repo)
} }
// display the protobuf // display the protobuf