summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.go2
-rw-r--r--cleanGoSum.go4
-rw-r--r--finalGoSumCheck.go4
-rw-r--r--init.go4
-rw-r--r--load.go6
-rw-r--r--repos.go20
-rw-r--r--rill.go9
-rw-r--r--scanRepoDir.go6
-rw-r--r--tableErrors.go23
9 files changed, 54 insertions, 24 deletions
diff --git a/build.go b/build.go
index 9dd84f1..4a1bd5c 100644
--- a/build.go
+++ b/build.go
@@ -59,7 +59,7 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
// if not GoPrimitive, autogen each dependent git repo
if repo.GoDepsLen() != 0 {
// build the protobuf files in all protobuf repos
- all := repo.GoDeps.SortByGoPath()
+ all := repo.GoInfo.GoDeps.SortByGoPath()
for all.Scan() {
t := all.Next()
found := f.Repos.FindByNamespace(t.GetGoPath())
diff --git a/cleanGoSum.go b/cleanGoSum.go
index d98fb56..e45fdc5 100644
--- a/cleanGoSum.go
+++ b/cleanGoSum.go
@@ -22,10 +22,10 @@ func (f *Forge) CleanGoDepsCheckOk(check *gitpb.Repo) error {
var fixes [][]string
log.Printf("%s repo go dependancy count: %d\n", check.GetGoPath(), check.GoDepsLen())
- if check.GoDeps == nil {
+ if check.GoInfo.GoDeps == nil {
return errors.New("check.GoDeps == nil")
}
- all := check.GoDeps.SortByGoPath()
+ all := check.GoInfo.GoDeps.SortByGoPath()
for all.Scan() {
depRepo := all.Next()
found := f.Repos.FindByNamespace(depRepo.GetGoPath())
diff --git a/finalGoSumCheck.go b/finalGoSumCheck.go
index 0646d39..2c6cefb 100644
--- a/finalGoSumCheck.go
+++ b/finalGoSumCheck.go
@@ -33,7 +33,7 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) error {
return nil
}
- deps := check.GoDeps.SortByGoPath()
+ deps := check.GoInfo.GoDeps.SortByGoPath()
for deps.Scan() {
depRepo := deps.Next()
found := f.Repos.FindByNamespace(depRepo.GetGoPath())
@@ -128,7 +128,7 @@ func (f *Forge) CheckUpdatingGoDeps(godeps *gitpb.GoDeps, upgrading *gitpb.Repos
depRepo := all.Next()
found := upgrading.FindByNamespace(depRepo.GetGoPath())
if found != nil {
- return fmt.Errorf("waiting on %s", depRepo.GetGoPath())
+ return fmt.Errorf("can't continue dep. upgrading %s", depRepo.GetGoPath())
}
}
return nil
diff --git a/init.go b/init.go
index 26daa49..90bb402 100644
--- a/init.go
+++ b/init.go
@@ -142,14 +142,14 @@ func (f *Forge) postInit() error {
}
} else {
log.Printf("forge failed to load %s file with len(%d) repos err=(%v)\n", f.Repos.Filename, f.Repos.Len(), err)
- panic("failed to load repos.pb")
+ panic("failed to load .pb cache")
}
err = f.patchesCacheLoad() // loads the file from ~/.cache/forge/patches.pb
if err == nil {
// log.Printf("forge loaded %s file with len(%d) repos\n", f.Repos.Filename, f.Repos.Len())
} else {
log.Printf("forge failed to load %s file with len(%d) patches err=(%v)\n", f.Patches.Filename, f.Patches.Len(), err)
- panic("failed to load repos.pb")
+ panic("failed to load .pb cache")
}
return err
}
diff --git a/load.go b/load.go
index 38790bd..e5c2f8c 100644
--- a/load.go
+++ b/load.go
@@ -81,15 +81,19 @@ func (f *Forge) reposCacheLoad() error {
// if using a go.work file, the filename should have already been set
fullname = env.Get("ReposPB")
}
+ if env.Verbose() {
+ env.PrintTable()
+ }
f.Repos = gitpb.NewRepos()
f.Repos.Filename = fullname
- err := config.ReLoad(f.Repos)
+ err := config.ForceCreatePB(f.Repos)
if err == nil {
if f.Repos.Filename != fullname {
// reset the filename, user probably did "mv" or "cp"
f.Repos.Filename = fullname
}
env.SetGlobal("lib/forgepb", "ReposPB", f.Repos.Filename)
+ log.Printf("%s repos len = %d\n", f.Repos.Filename, f.Repos.Len())
}
return err
}
diff --git a/repos.go b/repos.go
index 54eec7a..284869a 100644
--- a/repos.go
+++ b/repos.go
@@ -14,20 +14,20 @@ func (f *Forge) PrepareCheckRepos() *gitpb.Repos {
newrepo := new(gitpb.Repo)
newrepo.Namespace = repo.Namespace
newrepo.URL = repo.URL
- newrepo.Tags = gitpb.NewGitTags()
+ newrepo.Tags = gitpb.NewStats()
if repo.Tags == nil {
log.Infof("%s no tags\n", repo.FullPath)
continue
}
- if repo.Tags.Master != nil {
- newrepo.Tags.Master = proto.Clone(repo.Tags.Master).(*gitpb.GitTag)
+ if repo.MasterStat != nil {
+ newrepo.MasterStat = proto.Clone(repo.MasterStat).(*gitpb.Stat)
} else {
log.Infof("no master tag %s\n", repo.FullPath)
}
- if repo.Tags.Devel != nil {
- newrepo.Tags.Devel = proto.Clone(repo.Tags.Devel).(*gitpb.GitTag)
+ if repo.DevelStat != nil {
+ newrepo.DevelStat = proto.Clone(repo.DevelStat).(*gitpb.Stat)
}
submit.Append(newrepo)
}
@@ -42,20 +42,20 @@ func (f *Forge) PrepareCheckRepo(namespace string) *gitpb.Repo {
newrepo := new(gitpb.Repo)
newrepo.Namespace = found.Namespace
newrepo.URL = found.URL
- newrepo.Tags = gitpb.NewGitTags()
+ newrepo.Tags = gitpb.NewStats()
if found.Tags == nil {
log.Infof("%s Tags == nil\n", found.FullPath)
return newrepo
}
- if found.Tags.Master != nil {
- newrepo.Tags.Master = proto.Clone(found.Tags.Master).(*gitpb.GitTag)
+ if found.MasterStat != nil {
+ newrepo.MasterStat = proto.Clone(found.MasterStat).(*gitpb.Stat)
} else {
log.Infof("no master tag %s\n", found.FullPath)
}
- if found.Tags.Devel != nil {
- newrepo.Tags.Devel = proto.Clone(found.Tags.Devel).(*gitpb.GitTag)
+ if found.DevelStat != nil {
+ newrepo.DevelStat = proto.Clone(found.DevelStat).(*gitpb.Stat)
}
return newrepo
}
diff --git a/rill.go b/rill.go
index ad181ee..3f0bab7 100644
--- a/rill.go
+++ b/rill.go
@@ -161,8 +161,8 @@ func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[string]*RillStats {
}
// returns the set of failed repos
-func (f *Forge) RunOnReposNew(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos {
- stats := f.RunOnRepos(repos, rillf)
+func (f *Forge) RunOnRepos(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos {
+ stats := f.RunOnReposOld(repos, rillf)
failed := gitpb.NewRepos()
for s, stat := range stats {
if stat.Err == nil {
@@ -184,10 +184,11 @@ func (f *Forge) RunOnReposNew(repos *gitpb.Repos, rillf func(*gitpb.Repo) error)
// Use this if you think SMP processing might be the problem.
// if this works, and GO Rill doesn't work, then you, yes you, are the problem. Your code sucks.
// fix it, happy hacking
-func (f *Forge) RunOnReposNewDumb(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos {
+func (f *Forge) RunOnReposSlow(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) *gitpb.Repos {
failed := gitpb.NewRepos()
counter := 1
for repo := range repos.IterAll() {
+ log.Info("Starting Slow() on", repo.FullPath)
err := rillf(repo)
if err == nil {
continue
@@ -204,7 +205,7 @@ func (f *Forge) RunOnReposNewDumb(repos *gitpb.Repos, rillf func(*gitpb.Repo) er
// y is how many simultanous functions will run
// todo: tune and compute x,y by # of CPUs and disk io
// todo: store x,y in forge config ? (or compute them. notsure)
-func (f *Forge) RunOnRepos(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) map[string]*RillStats {
+func (f *Forge) RunOnReposOld(repos *gitpb.Repos, rillf func(*gitpb.Repo) error) map[string]*RillStats {
var all []*gitpb.Repo
var stats map[string]*RillStats
diff --git a/scanRepoDir.go b/scanRepoDir.go
index c9c6d78..881067c 100644
--- a/scanRepoDir.go
+++ b/scanRepoDir.go
@@ -175,15 +175,17 @@ func gitDirectoriesNew(srcDir string) ([]string, error) {
log.Info("WARNING:")
log.Info("WARNING: you have files that are untracked by .git repos here")
log.Info("WARNING:")
- log.Printf("WARNING: you have %d untracked files %d paths\n", len(untracked), len(dirs))
count := 0
for _, file := range untracked {
- log.Info(file)
+ log.Info("WARNING:", file)
if count > 7 {
break
}
count += 1
}
+ log.Info("WARNING:")
+ log.Printf("WARNING: you have %d untracked files %d paths\n", len(untracked), len(dirs))
+ log.Info("WARNING:")
}
return all, err
}
diff --git a/tableErrors.go b/tableErrors.go
new file mode 100644
index 0000000..6ee1504
--- /dev/null
+++ b/tableErrors.go
@@ -0,0 +1,23 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
+package forgepb
+
+import (
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func (f *Forge) PrintErrorsTB(pb *gitpb.Repos) string {
+ pb = pb.SortActual()
+
+ var col *gitpb.RepoFunc
+ t := f.makeDefaultBaseTB(pb)
+
+ col = t.AddStateChange()
+ col.Width = 16
+ col = t.AddState()
+ col.Width = -1
+
+ t.PrintTable()
+ return log.Sprintf("f.ErrorsTB(): total=(%d)", pb.Len())
+}