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() {
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)

View File

@ -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
}
}

View File

@ -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
}

View File

@ -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()

View File

@ -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
}

View File

@ -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

View File

@ -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