From e9d281b4cadd6831612c4ddf92e22e85cbcdfa43 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 14 Nov 2024 21:48:00 -0600 Subject: [PATCH] use scan() --- common.go | 2 ++ configfile.go | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common.go b/common.go index dedbd04..fafc11a 100644 --- a/common.go +++ b/common.go @@ -34,6 +34,7 @@ func (r *RepoList) FindRepo(path string) *RepoRow { return repo } +/* func (r *RepoList) AllRepos() []*RepoRow { var all []*RepoRow for _, repo := range me.allrepos { @@ -50,6 +51,7 @@ func AllRepos() []*RepoRow { } return all } +*/ // a human readable state of the current repo func (r *RepoRow) State() string { diff --git a/configfile.go b/configfile.go index b46c5a2..c6391a6 100644 --- a/configfile.go +++ b/configfile.go @@ -116,7 +116,9 @@ func (rl *RepoList) ArgGitPull() bool { log.Log(REPOWARN, "running git pull everywhere") var failed int = 0 - for _, repo := range rl.AllRepos() { + loop := rl.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() if out, err := repo.Status.GitPull(); err == nil { log.Log(REPOWARN, "Ran git pull ok", repo.Status.Path(), out) } else { @@ -142,7 +144,9 @@ func (rl *RepoList) ArgCheckoutDevel() bool { log.Log(REPOWARN, "running git checkout devel everwhere") var failed int = 0 var count int = 0 - for _, repo := range rl.AllRepos() { + loop := rl.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() count += 1 if repo.Status.CheckoutDevel() { // checkout ok @@ -158,7 +162,9 @@ func (rl *RepoList) ArgCheckoutMaster() bool { log.Log(REPOWARN, "running git checkout master everwhere") var failed int = 0 var count int = 0 - for _, repo := range rl.AllRepos() { + loop := rl.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() count += 1 if repo.Status.CheckoutMaster() { // checkout ok @@ -174,7 +180,9 @@ func (rl *RepoList) ArgCheckoutUser() bool { log.Log(REPOWARN, "running git checkout master everwhere") var failed int = 0 var count int = 0 - for _, repo := range rl.AllRepos() { + loop := rl.ReposSortByName() + for loop.Scan() { + repo := loop.Repo() count += 1 if repo.Status.CheckoutUser() { // checkout ok