more removals of "me.found"

This commit is contained in:
Jeff Carr 2025-02-21 18:49:33 -06:00
parent 1a255bdbf6
commit df0f0a21c3
1 changed files with 18 additions and 23 deletions

View File

@ -23,15 +23,16 @@ import (
func debug() { func debug() {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
for { for {
var found *gitpb.Repos
now := time.Now() now := time.Now()
tmp := fmt.Sprintf("All (%d)", me.forge.Repos.Len()) tmp := fmt.Sprintf("All (%d)", me.forge.Repos.Len())
me.repoAllB.SetLabel(tmp) me.repoAllB.SetLabel(tmp)
findMergeToDevel() found = findMergeToDevel()
tmp = fmt.Sprintf("needs merge to devel (%d)", me.found.Len()) tmp = fmt.Sprintf("needs merge to devel (%d)", found.Len())
me.repoDevelMergeB.SetLabel(tmp) me.repoDevelMergeB.SetLabel(tmp)
me.found = new(gitpb.Repos) found = gitpb.NewRepos()
all := me.forge.Repos.SortByFullPath() all := me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
@ -39,14 +40,14 @@ func debug() {
continue continue
} }
me.found.AppendByGoPath(repo) found.AppendByGoPath(repo)
} }
tmp = fmt.Sprintf("writable (%d)", me.found.Len()) tmp = fmt.Sprintf("writable (%d)", found.Len())
me.repoWritableB.SetLabel(tmp) me.repoWritableB.SetLabel(tmp)
doCheckDirtyAndConfigSave() doCheckDirtyAndConfigSave()
found := findDirty() found = findDirty()
tmp = fmt.Sprintf("dirty (%d)", found.Len()) tmp = fmt.Sprintf("dirty (%d)", found.Len())
me.repoDirtyB.SetLabel(tmp) me.repoDirtyB.SetLabel(tmp)
@ -77,12 +78,6 @@ func doGui() {
if count != 0 { if count != 0 {
me.forge.ConfigSave() me.forge.ConfigSave()
} }
// this is just interesting to see how fast it is on various boxes
// and with how many repos you are working with. On my current laptop
// I have 320 repos and when I'm using it and most things are in memory
// cache, it took: rill repos.Reload() took (2ms)
// which is hard to believe when my ~/go/src is 13G with 424266 files
// nevermind, there must be something wrong with the code right now
log.Printf("rill repos.Reload() took (%s)\n", shell.FormatDuration(time.Since(now))) log.Printf("rill repos.Reload() took (%s)\n", shell.FormatDuration(time.Since(now)))
os.Exit(0) os.Exit(0)
} }
@ -240,8 +235,8 @@ func drawWindow(win *gadgets.BasicWindow) {
}) })
me.repoDevelMergeB = grid.NewButton("merge", func() { me.repoDevelMergeB = grid.NewButton("merge", func() {
findMergeToDevel() found := findMergeToDevel()
makeStandardReposWindow("repos to merge from user to devel", me.found) makeStandardReposWindow("repos to merge from user to devel", found)
}) })
var problemsWin *repoProblemsWindow var problemsWin *repoProblemsWindow
grid.NewButton("Repo Problems", func() { grid.NewButton("Repo Problems", func() {
@ -387,8 +382,8 @@ func makeStandardReposWindow(title string, pb *gitpb.Repos) (*gitpb.ReposTable,
return t, box return t, box
} }
func findMergeToDevel() { func findMergeToDevel() *gitpb.Repos {
me.found = new(gitpb.Repos) found := gitpb.NewRepos()
all := me.forge.Repos.SortByFullPath() all := me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {
@ -396,20 +391,20 @@ func findMergeToDevel() {
// this sees if user has patches for devel. If it does, add it to me.found // this sees if user has patches for devel. If it does, add it to me.found
if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 { if repo.CountDiffObjects(repo.GetUserBranchName(), repo.GetDevelBranchName()) > 0 {
me.found.AppendByGoPath(repo) found.AppendByGoPath(repo)
} }
} }
now := time.Now() now := time.Now()
if me.found.Len() == 0 { if found.Len() == 0 {
log.Info("nothing to merge with devel") log.Info("nothing to merge with devel")
return return found
} }
me.forge.PrintHumanTable(me.found) // me.forge.PrintHumanTable(found)
// check for merges from devel // check for merges from devel
total, count, nope, _ := IsEverythingOnDevel() total, count, nope, _ := IsEverythingOnDevel()
log.Printf("devel branch check. %d total repos. (%d ok) (%d not on devel branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now))) log.Printf("devel branch check. %d total repos. (%d ok) (%d not on devel branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
return found
} }
func findMergeToMaster() { func findMergeToMaster() {
me.found = new(gitpb.Repos) me.found = new(gitpb.Repos)
@ -497,13 +492,13 @@ func mergeDevelToMaster(doit bool) {
} }
func mergeUserToDevel(doit bool) { func mergeUserToDevel(doit bool) {
findMergeToDevel() found := findMergeToDevel()
if !doit { if !doit {
return return
} }
all := me.found.SortByFullPath() all := found.SortByFullPath()
for all.Scan() { for all.Scan() {
repo := all.Next() repo := all.Next()
bruser := repo.GetUserBranchName() bruser := repo.GetUserBranchName()