summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doDirty.go4
-rw-r--r--doGui.go31
-rw-r--r--find.go36
-rw-r--r--windowFound.go4
4 files changed, 15 insertions, 60 deletions
diff --git a/doDirty.go b/doDirty.go
index 0380bd0..bebf456 100644
--- a/doDirty.go
+++ b/doDirty.go
@@ -26,9 +26,7 @@ func straightCheckDirty() int {
var count int
// var total int
// now := time.Now()
- all := me.found.All()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.found.IterAll() {
// total += 1
if repo.IsDirty() {
count += 1
diff --git a/doGui.go b/doGui.go
index 54e6d0e..0628fe5 100644
--- a/doGui.go
+++ b/doGui.go
@@ -36,9 +36,7 @@ func debug() {
if me.repoWritableB != nil {
found := gitpb.NewRepos()
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
continue
}
@@ -291,28 +289,6 @@ func forgeSwitchMode(newMode forgepb.ForgeMode) {
me.forge.Config.ConfigSave()
}
-/*
-func doDisableUserW() {
- me.argvCheckoutUser = false
-
- var count int
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
- if !repo.IsLocalBranch(repo.GetUserBranchName()) {
- // log.Info("repo doesn't have user branch", repo.GetGoPath())
- continue
- }
- count += 1
- }
-
- if count > 0 {
- s := fmt.Sprintf("git delete %d user branches", count)
- return
- }
-}
-*/
-
// this is the magic that generates a window directly from the protocol buffer
func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
t := pb.NewTable("testDirty")
@@ -356,9 +332,7 @@ func makeStandardReposWindow(title string, pb *gitpb.Repos) (*gitpb.ReposTable,
func findMergeToDevel() *gitpb.Repos {
found := gitpb.NewRepos()
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
// this sees if user has patches for devel. If it does, add it to me.found
if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 {
@@ -383,6 +357,7 @@ func findMergeToMaster() {
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
+
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
continue
}
diff --git a/find.go b/find.go
index 1173be4..d8f2231 100644
--- a/find.go
+++ b/find.go
@@ -54,10 +54,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos {
}
func findPrivate() {
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
-
+ for repo := range me.forge.Repos.IterByFullPath() {
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
me.found.AppendByGoPath(repo)
}
@@ -67,9 +64,8 @@ func findPrivate() {
// finds repos that are writable
func findMine() {
// log.Printf("get mine %s\n", me.forge.GetGoSrc())
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
+
if me.forge.Config.IsWritable(repo.GetGoPath()) {
me.found.AppendByGoPath(repo)
}
@@ -79,9 +75,8 @@ func findMine() {
// finds repos the user has marked as favorites in the forge .config
func findFavorites() {
// log.Printf("get favorites %s\n", me.forge.GetGoSrc())
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
+
if me.forge.Config.IsFavorite(repo.GetGoPath()) {
me.found.AppendByGoPath(repo)
}
@@ -91,10 +86,7 @@ func findFavorites() {
// finds repos that git is reporting as dirty
func findDirty() *gitpb.Repos {
found := gitpb.NewRepos()
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- var repo *gitpb.Repo
- repo = all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
if repo.IsDirty() {
found.AppendByGoPath(repo)
}
@@ -103,17 +95,13 @@ func findDirty() *gitpb.Repos {
}
func findAll() {
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
me.found.AppendByGoPath(repo)
}
}
func findUser() {
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
me.found.AppendByGoPath(repo)
}
@@ -121,9 +109,7 @@ func findUser() {
}
func findPublishable() {
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
if repo.GetTargetVersion() == "" {
continue
}
@@ -132,9 +118,7 @@ func findPublishable() {
}
func findReposWithPatches() {
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.forge.Repos.IterByFullPath() {
if repo.GetTargetVersion() != "" {
// add everything that has a target version set
me.found.AppendByGoPath(repo)
diff --git a/windowFound.go b/windowFound.go
index 9b085f1..c79e514 100644
--- a/windowFound.go
+++ b/windowFound.go
@@ -80,9 +80,7 @@ func (r *foundWindow) initWindow() {
}
func (r *foundWindow) listRepos() {
- all := me.found.All()
- for all.Scan() {
- repo := all.Next()
+ for repo := range me.found.IterAll() {
r.addRepo(repo)
}
}