trying to verify new protobuf works

This commit is contained in:
Jeff Carr 2024-12-02 15:45:06 -06:00
parent f3803d5929
commit 9a57a20ef7
4 changed files with 63 additions and 45 deletions

View File

@ -37,6 +37,7 @@ redomod:
GO111MODULE= go mod tidy
list: build
reset
./forge --list
list-config: build

View File

@ -9,6 +9,7 @@ var argv args
type args struct {
List bool `arg:"--list" help:"list found repos"`
ListConf bool `arg:"--list-conf" help:"list your .config/forge/ configuration"`
ReadOnly bool `arg:"--read-only" help:"include read-only repos"`
GetMine bool `arg:"--mine" help:"download private and writeable repos"`
GetFav bool `arg:"--favorites" help:"download repos marked as favorites"`
Pull bool `arg:"--git-pull" help:"run 'git pull' on all your repos"`

19
list.go
View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"os"
"go.wit.com/log"
@ -16,11 +17,25 @@ func list() {
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
var rtype string
if !repo.IsValid() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
rtype = "rm?"
continue
} else {
rtype = repo.RepoType()
}
if me.forge.IsReadOnly(repo.GetGoPath()) {
continue
}
log.Printf("%10s %-50s", repo.RepoType(), repo.GetGoPath())
var end string
if repo.CheckDirty() {
end += "(dirty) "
}
mver := repo.GetMasterVersion()
dver := repo.GetDevelVersion()
uver := repo.GetUserVersion()
s := fmt.Sprintf("%-50s %-8s %-10s %-10s %-10s", repo.GetGoPath(), rtype, mver, dver, uver)
log.Info(s, end)
}
os.Exit(0)
}

View File

@ -6,7 +6,6 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
@ -57,10 +56,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
s.grid.NewButton("Update Patch Counts", func() {
var repocount, patchcount int
loop := me.repos.View.UnmergedRepos()
// broken after move to forge protobuf
loop := me.forge.Repos.SortByGoPath()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() {
repo := loop.Next()
if repo.GetReadOnly() {
continue
}
i, _ := repo.GetMasterPatches()
@ -74,10 +74,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
repocount = 0
patchcount = 0
loop = me.repos.View.UnmergedRepos()
// broken after move to forge protobuf
loop = me.forge.Repos.SortByGoPath()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() {
repo := loop.Next()
if repo.GetReadOnly() {
continue
}
i, _ := repo.GetUserPatches()
@ -175,6 +176,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
s.submitB.Disable()
s.grid.NextRow()
/*
// map a path to gitea
s.unknownOL = gadgets.NewBasicEntry(s.grid, "Unknown Repo:")
s.unknownSubmitB = s.grid.NewButton("map new repo path", func() {
@ -185,7 +187,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
return
}
localurl := repo.Status.GitURL()
localurl := repo.GetURL()
log.Info("found repo:", repo.GoPath(), "with giturl", localurl)
if localurl == "" {
log.Info("local repo check failed. repo")
@ -200,6 +202,7 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
}
}
})
*/
s.unknownOL.Disable()
s.unknownSubmitB.Disable()
s.grid.NextRow()
@ -212,31 +215,29 @@ func (s *patchSummary) Update() {
var total, totalgo, dirty, readonly int
var userT, develT, masterT int
// var userP, develP, masterP int
loop := me.repos.View.UnmergedRepos()
// broken after move to forge protobuf
loop := me.forge.Repos.SortByGoPath()
for loop.Scan() {
repo := loop.Repo()
repo := loop.Next()
total += 1
if repo.Status.IsDirty() {
if repo.IsDirty() {
dirty += 1
}
if repo.Status.IsGoLang() {
totalgo += 1
}
if repo.Status.ReadOnly() {
if repo.GetReadOnly() {
readonly += 1
// don't count these in any further stats
continue
}
// compute which GUI repos are out of sync with master
userV := repo.Status.GetUserVersion()
develV := repo.Status.GetDevelVersion()
masterV := repo.Status.GetMasterVersion()
lastV := repo.Status.GetLastTagVersion()
userV := repo.GetUserVersion()
develV := repo.GetDevelVersion()
masterV := repo.GetMasterVersion()
lastV := repo.GetLastTagVersion()
if userV != develV {
userT += 1
}
if develV != masterV {
log.Info("develV != masterV", develV, masterV, repo.GoPath())
log.Info("develV != masterV", develV, masterV, repo.GetGoPath())
develT += 1
}
if masterV != lastV {