diff options
| author | Jeff Carr <[email protected]> | 2025-07-01 18:54:41 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-07-01 18:54:41 -0500 |
| commit | 1ea9bdf841cb4eae4cd7b1d96288852e799fbeb2 (patch) | |
| tree | f8b4248268334967b6f668c0a45806f717b60f98 /doFind.go | |
| parent | 1d50f9eb697591a0c9fb06056b1c0762c9a7f50d (diff) | |
deprecate old stuff
Diffstat (limited to 'doFind.go')
| -rw-r--r-- | doFind.go | 52 |
1 files changed, 32 insertions, 20 deletions
@@ -8,7 +8,7 @@ import ( ) // this populates a slice of protobuf records representing each git repo -// var me.found []*gitpb.Repo +// var found []*gitpb.Repo // // so, it makes a subset of repos that are then used performing actions on // @@ -40,8 +40,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos { } if f.Private { - findPrivate() - return me.found + return findPrivate() } if f.Mine { @@ -49,8 +48,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos { } if f.Favorites { - findFavorites() - return me.found + return findFavorites() } if f.Dirty { @@ -58,19 +56,21 @@ func (f *FindCmd) findRepos() *gitpb.Repos { } if f.User { - findUser() - return me.found + return findUser() } return findAll() } -func findPrivate() { +func findPrivate() *gitpb.Repos { + found := gitpb.NewRepos() for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsPrivate(repo.GetGoPath()) { - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) } } + + return found } // finds repos that are writable @@ -88,19 +88,23 @@ func findMine() *gitpb.Repos { } // finds repos the user has marked as favorites in the forge .config -func findFavorites() { +func findFavorites() *gitpb.Repos { + found := gitpb.NewRepos() + // log.Printf("get favorites %s\n", me.forge.GetGoSrc()) for repo := range me.forge.Repos.IterByFullPath() { if me.forge.Config.IsFavorite(repo.GetGoPath()) { - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) } } + return found } // finds repos that git is reporting as dirty func findDirty() *gitpb.Repos { found := gitpb.NewRepos() + for repo := range me.forge.Repos.IterByFullPath() { if repo.IsDirty() { found.AppendByGoPath(repo) @@ -117,33 +121,41 @@ func findAll() *gitpb.Repos { return found } -func findUser() { +func findUser() *gitpb.Repos { + found := gitpb.NewRepos() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetCurrentBranchName() == repo.GetUserBranchName() { - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) } } + return found } -func findPublishable() { +func findPublishable() *gitpb.Repos { + found := gitpb.NewRepos() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetTargetVersion() == "" { continue } - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) } + return found } func findReposWithPatches() *gitpb.Repos { + found := gitpb.NewRepos() + for repo := range me.forge.Repos.IterByFullPath() { if repo.GetTargetVersion() != "" { // add everything that has a target version set - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) continue } if repo.IsDirty() { // always add dirty branches - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) continue } if repo.GetUserVersion() == "" || repo.GetUserVersion() == "uerr" { @@ -151,7 +163,7 @@ func findReposWithPatches() *gitpb.Repos { continue } if repo.GetUserVersion() != repo.GetDevelVersion() { - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) continue } @@ -160,10 +172,10 @@ func findReposWithPatches() *gitpb.Repos { continue } if repo.GetLastTag() != repo.GetMasterVersion() { - me.found.AppendByGoPath(repo) + found.AppendByGoPath(repo) repo.FindLastTag() continue } } - return me.found + return found } |
