update stats every 90 seconds

This commit is contained in:
Jeff Carr 2025-02-21 08:20:44 -06:00
parent 9db8405954
commit a5222d3894
2 changed files with 87 additions and 10 deletions

View File

@ -6,6 +6,7 @@ package main
// An app to submit patches for the 30 GO GUI repos
import (
"fmt"
"os"
"os/user"
"path/filepath"
@ -21,11 +22,38 @@ import (
)
func debug() {
// log.Info("cmd line --debugger == true")
time.Sleep(5 * time.Second)
for {
now := time.Now()
tmp := fmt.Sprintf("All (%d)", me.forge.Repos.Len())
me.repoAllB.SetLabel(tmp)
findMergeToDevel()
tmp = fmt.Sprintf("needs merge to devel (%d)", me.found.Len())
me.repoDevelMergeB.SetLabel(tmp)
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
continue
}
me.found.AppendByGoPath(repo)
}
tmp = fmt.Sprintf("writable (%d)", me.found.Len())
me.repoWritableB.SetLabel(tmp)
me.found = new(gitpb.Repos)
findDirty()
tmp = fmt.Sprintf("dirty (%d)", me.found.Len())
me.repoDirtyB.SetLabel(tmp)
log.Printf("finished a forge scan here in (%s)\n", shell.FormatDuration(time.Since(now)))
time.Sleep(90 * time.Second)
log.Info("TODO: add a forge scan here. repo count =", me.forge.Repos.Len())
// debugger.DebugWindow()
}
}
@ -182,22 +210,68 @@ func drawWindow(win *gadgets.BasicWindow) {
group2 := vbox.NewGroup("Repos")
grid = group2.RawGrid()
grid.NewButton("All", func() {
makeStandardReposWindow(me.forge.Repos)
me.repoAllB = grid.NewButton("All", func() {
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
me.found.AppendByGoPath(repo)
}
makeStandardReposWindow(me.found)
})
grid.NewButton("dirty", func() {
me.repoDirtyB = grid.NewButton("dirty", func() {
me.found = new(gitpb.Repos)
findDirty()
makeStandardReposWindow(me.found)
})
grid.NewButton("needs merge to devel", func() {
me.repoWritableB = grid.NewButton("writable", func() {
me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
continue
}
me.found.AppendByGoPath(repo)
}
makeStandardReposWindow(me.found)
})
me.repoDevelMergeB = grid.NewButton("needs merge to devel", func() {
findMergeToDevel()
makeStandardReposWindow(me.found)
})
grid.NextRow()
group2 = vbox.NewGroup("Repos with problems")
grid = group2.RawGrid()
grid.NewButton("devel is behind master", func() {
log.Info("not done yet")
})
grid.NewButton("user branch is remote", func() {
log.Info("not done yet")
})
grid.NewButton("unknown branches", func() {
log.Info("not done yet")
})
grid.NextRow()
grid.NewButton("remote devel != local devel", func() {
log.Info("not done yet")
})
grid.NewButton("remote master != local master", func() {
log.Info("not done yet")
})
group3 := vbox.NewGroup("debugging stuff")
grid = group3.RawGrid()
@ -295,7 +369,6 @@ func drawWindow(win *gadgets.BasicWindow) {
reposWin.View.ScanRepositoriesOld()
reposWin.win.Show()
})
}
func makeStandardReposWindow(pb *gitpb.Repos) {

View File

@ -70,8 +70,12 @@ type mainType struct {
// these hold the branches that the user can switch all
// the repositories to them
newBranch *gui.Node
setBranchB *gui.Node
newBranch *gui.Node // deprecate?
setBranchB *gui.Node // deprecate?
repoAllB *gui.Node // "all" repos button
repoDirtyB *gui.Node // "dirty" repos button
repoDevelMergeB *gui.Node // "merge to devel" repos button
repoWritableB *gui.Node // "what repos are writable" repos button
argvCheckoutUser bool // shared between the GUI and the command line tools
argvCheckoutDevel bool // shared between the GUI and the command line tools