change for changes in GitPull()

This commit is contained in:
Jeff Carr 2024-02-29 19:51:56 -06:00
parent d3c0679fd9
commit e4769df090
2 changed files with 9 additions and 17 deletions

View File

@ -1,13 +1,14 @@
package repolist package repolist
import ( import (
"fmt" "errors"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/lib/gui/repostatus"
) )
func (v *RepoList) InitRepoList(cfgfile string) { func (v *RepoList) InitRepoList(cfgfile string) {
@ -115,30 +116,21 @@ func (rl *RepoList) ArgGitPull() bool {
log.Log(REPOWARN, "running git pull everywhere") log.Log(REPOWARN, "running git pull everywhere")
var failed int = 0 var failed int = 0
for _, repo := range rl.AllRepos() { for _, repo := range rl.AllRepos() {
log.Log(REPOWARN, "Running:", repo.Status.Path()) if out, err := repo.Status.GitPull(); err == nil {
if err := repo.Status.GitPull(); err == nil { log.Log(REPOWARN, "Ran git pull ok", repo.Status.Path(), out)
} else { } else {
failed += 1 failed += 1
repo.Status.DumpTags() repo.Status.DumpTags()
name := repo.Status.GetCurrentBranchName() if errors.Is(repostatus.ErrorGitPullOnLocal, err) {
if repo.Status.IsOnlyLocalTag(name) {
log.Log(REPOWARN, repo.Status.Path(), "can not git pull on local only branch", name, err)
} else {
log.Log(REPOWARN, repo.Status.Path(), "this branch should have worked", name, err)
}
if fmt.Sprint(err) == "git config error" {
badmap += 1
continue
}
if fmt.Sprint(err) == "local only" {
localonly += 1 localonly += 1
continue continue
} }
return false badmap += 1
log.Log(REPOWARN, "bad unknown git error", repo.Status.Path(), out, err)
} }
} }
log.Log(REPOWARN, "Ran git pull in all repos. failure count =", failed) log.Log(REPOWARN, "Ran git pull in all repos. failure count =", failed)
log.Log(REPOWARN, "Ran git pull in all repos. git config map errors =", badmap) log.Log(REPOWARN, "Ran git pull in all repos. bad errors =", badmap)
if localonly != 0 { if localonly != 0 {
log.Log(REPOWARN, "Ran git pull in all repos. ignored local only branches =", localonly) log.Log(REPOWARN, "Ran git pull in all repos. ignored local only branches =", localonly)
} }

View File

@ -24,7 +24,7 @@ func GuireleaserView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("Current") me.reposgrid.NewLabel("Current")
me.reposgrid.NewLabel("Version") me.reposgrid.NewLabel("Version")
me.reposgrid.NewLabel("git State") me.reposgrid.NewLabel("git State")
me.reposgrid.NewLabel("GO State") // me.reposgrid.NewLabel("GO State")
me.reposgrid.NextRow() me.reposgrid.NextRow()
me.blind = gui.RawBox() me.blind = gui.RawBox()