diff options
| author | Jeff Carr <[email protected]> | 2025-02-21 10:21:13 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-21 10:21:13 -0600 |
| commit | 9cc63ce391c3df35baa5ea3fcf4a19622117ed1f (patch) | |
| tree | 0199ae4eda3c81cf2086e2f2cf3ca13a004fb6d2 | |
| parent | 76143a647457884b11249032a498eac61753cbe6 (diff) | |
show problem totals
| -rw-r--r-- | windowRepoProblems.go | 103 |
1 files changed, 86 insertions, 17 deletions
diff --git a/windowRepoProblems.go b/windowRepoProblems.go index 4ff6be4..9b22bb1 100644 --- a/windowRepoProblems.go +++ b/windowRepoProblems.go @@ -4,6 +4,7 @@ package main import ( + "fmt" "sync" "go.wit.com/lib/gadgets" @@ -92,20 +93,14 @@ func makeRepoProblemsWindow() *repoProblemsWindow { } makeStandardReposWindow(me.found) }) + var found *gitpb.Repos + var txt string - grid.NewButton("user branch is remote", func() { - log.Info("not done yet") - me.found = new(gitpb.Repos) - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - username := repo.GetUserBranchName() - if repo.IsBranchRemote(username) { - me.found.AppendByGoPath(repo) - } - - } - makeStandardReposWindow(me.found) + found = remoteUserBranchProblem() + txt = fmt.Sprintf("user branch is remote (%d)", found.Len()) + grid.NewButton(txt, func() { + found := remoteUserBranchProblem() + makeStandardReposWindow(found) }) grid.NewButton("unknown branches", func() { @@ -113,14 +108,88 @@ func makeRepoProblemsWindow() *repoProblemsWindow { }) grid.NextRow() - grid.NewButton("remote devel != local devel", func() { - log.Info("not done yet") + found = develRemoteProblem() + txt = fmt.Sprintf("remote devel != local devel (%d)", found.Len()) + grid.NewButton(txt, func() { + found := develRemoteProblem() + makeStandardReposWindow(found) }) - grid.NewButton("remote master != local master", func() { - log.Info("not done yet") + found = masterRemoteProblem() + txt = fmt.Sprintf("remote master != local master (%d)", found.Len()) + grid.NewButton(txt, func() { + found := masterRemoteProblem() + makeStandardReposWindow(found) }) grid.NextRow() return pw } + +func remoteUserBranchProblem() *gitpb.Repos { + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + username := repo.GetUserBranchName() + if repo.IsBranchRemote(username) { + found.AppendByGoPath(repo) + } + + } + return found +} + +func develRemoteProblem() *gitpb.Repos { + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + brname := repo.GetDevelBranchName() + if !repo.IsBranchRemote(brname) { + // log.Info("repo does not have remote devel branch", repo.GetGoPath()) + continue + } + lhash := repo.GetLocalHash(brname) + rhash := repo.GetRemoteHash(brname) + // log.Info(lhash, rhash, repo.GetGoPath()) + if lhash == "" || rhash == "" { + // something is wrong if either of these are blank + found.AppendByGoPath(repo) + continue + } + if lhash == rhash { + continue + } + found.AppendByGoPath(repo) + + } + return found +} + +func masterRemoteProblem() *gitpb.Repos { + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + brname := repo.GetMasterBranchName() + if !repo.IsBranchRemote(brname) { + // log.Info("repo does not have remote devel branch", repo.GetGoPath()) + continue + } + lhash := repo.GetLocalHash(brname) + rhash := repo.GetRemoteHash(brname) + // log.Info(lhash, rhash, repo.GetGoPath()) + if lhash == "" || rhash == "" { + // something is wrong if either of these are blank + found.AppendByGoPath(repo) + continue + } + if lhash == rhash { + continue + } + found.AppendByGoPath(repo) + + } + return found +} |
