summaryrefslogtreecommitdiff
path: root/find.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-07-01 18:37:11 -0500
committerJeff Carr <[email protected]>2025-07-01 18:37:11 -0500
commit1d50f9eb697591a0c9fb06056b1c0762c9a7f50d (patch)
tree5a3bf084278cba5ff0806eab5b8b16197e492dd9 /find.go
parentd962ff8db05a50f9110e9ccbdce7bfd9064d6dac (diff)
rename
Diffstat (limited to 'find.go')
-rw-r--r--find.go169
1 files changed, 0 insertions, 169 deletions
diff --git a/find.go b/find.go
deleted file mode 100644
index c32a116..0000000
--- a/find.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
-// Use of this source code is governed by the GPL 3.0
-
-package main
-
-import (
- "go.wit.com/lib/protobuf/gitpb"
-)
-
-// this populates a slice of protobuf records representing each git repo
-// var me.found []*gitpb.Repo
-//
-// so, it makes a subset of repos that are then used performing actions on
-//
-// by default, it adds every repo
-
-func doFind() *gitpb.Repos {
- if argv.List == nil {
- return findAll()
- }
-
- if argv.List.Mine {
- return findMine()
- }
-
- if argv.List.Dirty {
- return findDirty()
- }
-
- return findAll()
-}
-
-func (f *FindCmd) findRepos() *gitpb.Repos {
- if f == nil {
- return findMine()
- }
-
- if f.All {
- return findAll()
- }
-
- if f.Private {
- findPrivate()
- return me.found
- }
-
- if f.Mine {
- return findMine()
- }
-
- if f.Favorites {
- findFavorites()
- return me.found
- }
-
- if f.Dirty {
- return findDirty()
- }
-
- if f.User {
- findUser()
- return me.found
- }
-
- return findAll()
-}
-
-func findPrivate() {
- for repo := range me.forge.Repos.IterByFullPath() {
- if me.forge.Config.IsPrivate(repo.GetGoPath()) {
- me.found.AppendByGoPath(repo)
- }
- }
-}
-
-// finds repos that are writable
-func findMine() *gitpb.Repos {
- found := gitpb.NewRepos()
-
- // log.Printf("get mine %s\n", me.forge.GetGoSrc())
- for repo := range me.forge.Repos.IterByFullPath() {
-
- if me.forge.Config.IsWritable(repo.GetGoPath()) {
- found.AppendByGoPath(repo)
- }
- }
- return found
-}
-
-// finds repos the user has marked as favorites in the forge .config
-func findFavorites() {
- // 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)
- }
- }
-}
-
-// 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)
- }
- }
- return found
-}
-
-func findAll() *gitpb.Repos {
- found := gitpb.NewRepos()
- for repo := range me.forge.Repos.IterByFullPath() {
- found.AppendByGoPath(repo)
- }
- return found
-}
-
-func findUser() {
- for repo := range me.forge.Repos.IterByFullPath() {
- if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
- me.found.AppendByGoPath(repo)
- }
- }
-}
-
-func findPublishable() {
- for repo := range me.forge.Repos.IterByFullPath() {
- if repo.GetTargetVersion() == "" {
- continue
- }
- me.found.AppendByGoPath(repo)
- }
-}
-
-func findReposWithPatches() *gitpb.Repos {
- for repo := range me.forge.Repos.IterByFullPath() {
- if repo.GetTargetVersion() != "" {
- // add everything that has a target version set
- me.found.AppendByGoPath(repo)
- continue
- }
- if repo.IsDirty() {
- // always add dirty branches
- me.found.AppendByGoPath(repo)
- continue
- }
- if repo.GetUserVersion() == "" || repo.GetUserVersion() == "uerr" {
- // skip anything without a user branch
- continue
- }
- if repo.GetUserVersion() != repo.GetDevelVersion() {
- me.found.AppendByGoPath(repo)
- continue
- }
-
- // this is an old test to see if the current 'last tag' is accurate and should be removed
- if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
- continue
- }
- if repo.GetLastTag() != repo.GetMasterVersion() {
- me.found.AppendByGoPath(repo)
- repo.FindLastTag()
- continue
- }
- }
- return me.found
-}