summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-20 10:58:58 -0600
committerJeff Carr <[email protected]>2024-02-20 10:58:58 -0600
commit03773fb996ab2c726903ae9fb3fcaeccab6ffdcc (patch)
treec8334968b0d1f4619554d0463fdfca64ad3b4813
parent9b48a619ad5db8ca75e00a5121dec751eaec5c2e (diff)
make more patch counts
-rw-r--r--globalBuildOptions.go75
-rw-r--r--submitPatches.go205
2 files changed, 148 insertions, 132 deletions
diff --git a/globalBuildOptions.go b/globalBuildOptions.go
index d721293..bcbdf72 100644
--- a/globalBuildOptions.go
+++ b/globalBuildOptions.go
@@ -97,3 +97,78 @@ func globalBuildOptions(vbox *gui.Node) {
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
grid.NextRow()
}
+
+// this code isn't ready yet
+/*
+ s.gitPullB = grid.NewButton("git pull", func() {
+ me.Disable()
+ defer me.Enable()
+ for _, repo := range repolist.AllRepos() {
+ // gitcmd := []string{"git", "fetch", "origin"}
+ gitcmd := []string{"git", "pull"}
+ err, output := repo.RunCmd(gitcmd)
+ log.Info("output =", output)
+ if err == nil {
+ log.Info("git fetch worked", repo.Name())
+ } else {
+ log.Info("git fetch failed", repo.Name())
+ return
+ }
+ }
+ gitPullB.SetText("GOOD")
+ // update the stats
+ // s.Update()
+ })
+
+ s.gitPushB = grid.NewButton("git push", func() {
+ me.Disable()
+ defer me.Enable()
+ for _, repo := range repolist.AllRepos() {
+ gitcmd := []string{"git", "push"}
+ err, output := repo.RunCmd(gitcmd)
+ log.Info("output =", output)
+ if err == nil {
+ log.Info("git push worked", repo.Name())
+ } else {
+ log.Info("git push failed", repo.Name())
+ return
+ }
+ }
+ s.gitPushB.SetText("GOOD")
+ // update the stats
+ s.Update()
+ })
+
+ s.checkB = s.grid.NewButton("Check repos are working", func() {
+ me.Disable()
+ defer me.Enable()
+ for _, repo := range repolist.AllRepos() {
+ if repo.GitURL() != "" {
+ log.Info("repo already checked. do they match?")
+ log.Info("go.wit.com =", repo.GoURL())
+ log.Info("localurl =", repo.Path())
+ } else {
+ ok, giturl := gowit.CheckRegistered(repo)
+ if ok {
+ log.Info("is url correct?", repo.Path(), "vs", giturl)
+ repo.giturl = giturl
+ if giturl != repo.Path() {
+ log.Info("repo check failed", repo.String())
+ s.unknownOL.SetText(repo.String())
+ s.unknownOL.Show()
+ s.unknownSubmitB.Show()
+ return
+ }
+ } else {
+ log.Info("repo check failed", repo.String())
+ repo.giturl = "look in .git/config"
+ s.unknownOL.SetText(repo.String())
+ s.unknownOL.Show()
+ s.unknownSubmitB.Show()
+ return
+ }
+ }
+ }
+ s.checkB.SetText("GOOD")
+ })
+*/
diff --git a/submitPatches.go b/submitPatches.go
index e3d4d97..d4f2c61 100644
--- a/submitPatches.go
+++ b/submitPatches.go
@@ -54,150 +54,51 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
group1 := box.NewGroup("Submit Patches Summary")
s.grid = group1.RawGrid()
- s.grid.NewButton("List Patches", func() {
- for i, p := range s.allp {
- log.Info(i, p.Ref, p.RS.String())
- }
- // update the stats
- s.Update()
- })
-
- s.grid.NewButton("GetPatches()", func() {
- var repocount, count int
+ s.grid.NewButton("Count Patches", func() {
+ var repocount, patchcount int
for _, repo := range repolist.AllRepos() {
- // if repo.GoPath() == "go.wit.com/apps/guireleaser" {
- // repo.GetUserPatches()
- if repo.ReadOnly() {
- continue
- }
- //if repo.IsDirty() {
- // continue
- //}
- patchc, _ := repo.GetMasterPatches()
- count += patchc
+ if repo.ReadOnly() {
+ continue
+ }
+ i, _ := repo.GetMasterPatches()
+ patchcount += i
+ if i > 0 {
repocount += 1
- // }
+ }
}
- s.totalMasterPatches.SetText(strconv.Itoa(count) + " patches")
+ s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches")
s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos")
- })
- s.gitPullB = s.grid.NewButton("git pull", func() {
- me.Disable()
- defer me.Enable()
+ repocount = 0
+ patchcount = 0
for _, repo := range repolist.AllRepos() {
- // gitcmd := []string{"git", "fetch", "origin"}
- gitcmd := []string{"git", "pull"}
- err, output := repo.RunCmd(gitcmd)
- log.Info("output =", output)
- if err == nil {
- log.Info("git fetch worked", repo.Name())
- } else {
- log.Info("git fetch failed", repo.Name())
- return
+ if repo.ReadOnly() {
+ continue
+ }
+ i, _ := repo.GetUserPatches()
+ patchcount += i
+ if i > 0 {
+ repocount += 1
}
}
- s.gitPullB.SetText("GOOD")
- // update the stats
- s.Update()
+ s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches")
+ s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos")
})
- s.gitPushB = s.grid.NewButton("git push", func() {
- me.Disable()
- defer me.Enable()
- for _, repo := range repolist.AllRepos() {
- gitcmd := []string{"git", "push"}
- err, output := repo.RunCmd(gitcmd)
- log.Info("output =", output)
- if err == nil {
- log.Info("git push worked", repo.Name())
- } else {
- log.Info("git push failed", repo.Name())
- return
- }
+ s.grid.NewButton("List Patches", func() {
+ for i, p := range s.allp {
+ log.Info(i, p.Ref, p.RS.String())
}
- s.gitPushB.SetText("GOOD")
// update the stats
s.Update()
})
- s.checkB = s.grid.NewButton("Check repos are working", func() {
- /*
- me.Disable()
- defer me.Enable()
- for _, repo := range repolist.AllRepos() {
- if repo.GitURL() != "" {
- log.Info("repo already checked. do they match?")
- log.Info("go.wit.com =", repo.GoURL())
- log.Info("localurl =", repo.Path())
- } else {
- ok, giturl := gowit.CheckRegistered(repo)
- if ok {
- log.Info("is url correct?", repo.Path(), "vs", giturl)
- repo.giturl = giturl
- if giturl != repo.Path() {
- log.Info("repo check failed", repo.String())
- s.unknownOL.SetText(repo.String())
- s.unknownOL.Show()
- s.unknownSubmitB.Show()
- return
- }
- } else {
- log.Info("repo check failed", repo.String())
- repo.giturl = "look in .git/config"
- s.unknownOL.SetText(repo.String())
- s.unknownOL.Show()
- s.unknownSubmitB.Show()
- return
- }
- }
- }
- s.checkB.SetText("GOOD")
- */
- })
- s.grid.NextRow()
-
- s.unknownOL = gadgets.NewOneLiner(s.grid, "Unknown Repo:")
- s.unknownSubmitB = s.grid.NewButton("Register Repo", func() {
- /*
- log.Info("Submit repo:", s.unknownOL.String())
- if repolist.Exists(s.unknownOL.String()) {
- log.Info("found repo:", repo.String(), "with giturl", repo.giturl)
- localurl := repo.status.GitURL()
- if localurl == "" {
- log.Info("local repo check failed. repo is not uploaded?")
- } else {
- log.Info("local repo has", localurl)
- // attempts to register the unknown repo
- if gowit.Register(repo.String(), localurl) {
- s.unknownOL.Hide()
- s.unknownSubmitB.Hide()
- }
- }
- } else {
- log.Info("what is this?", s.unknownOL.String())
- }
- */
- })
- s.unknownOL.Hide()
- s.unknownSubmitB.Hide()
- s.grid.NextRow()
-
- s.grid = group1.RawGrid()
- s.grid.NewLabel("")
- s.grid.NewLabel("")
- s.grid.NewLabel("user to devel")
- s.grid.NewLabel("devel to master")
- s.grid.NewLabel("master to last tag")
s.grid.NextRow()
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
s.grid.NextRow()
s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO")
- s.totalUserRepos = s.grid.NewLabel("5 go repos")
- s.totalDevelRepos = s.grid.NewLabel("3 go repos")
- s.totalMasterRepos = s.grid.NewLabel("8 go repos")
s.grid.NextRow()
s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty")
@@ -206,10 +107,26 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
s.readonlyOL = gadgets.NewOneLiner(s.grid, "read-only")
s.grid.NextRow()
+ // s.grid = group1.RawGrid()
+ s.grid.NewLabel("")
+ s.grid.NewLabel("")
+ s.grid.NewLabel("user to devel")
+ s.grid.NewLabel("devel to master")
+ s.grid.NewLabel("master to last tag")
+ s.grid.NextRow()
+
+ s.grid.NewLabel("total modified")
+ s.grid.NewLabel("")
+ s.totalUserRepos = s.grid.NewLabel("x go repos")
+ s.totalDevelRepos = s.grid.NewLabel("")
+ s.totalMasterRepos = s.grid.NewLabel("x go repos")
+ s.grid.NextRow()
+
+
s.totalPatchesOL = gadgets.NewOneLiner(s.grid, "total commits")
- s.totalUserPatches = s.grid.NewLabel("5 patches")
- s.totalDevelPatches = s.grid.NewLabel("3 patches")
- s.totalMasterPatches = s.grid.NewLabel("8 patches")
+ s.totalUserPatches = s.grid.NewLabel("x patches")
+ s.totalDevelPatches = s.grid.NewLabel("")
+ s.totalMasterPatches = s.grid.NewLabel("x patches")
s.grid.NextRow()
s.grid.NewLabel("")
@@ -244,10 +161,39 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
// disable these until there are not dirty repos
s.reason.Disable()
s.submitB.Disable()
+ s.grid.NextRow()
+
+ // map a path to gitea
+ s.unknownOL = gadgets.NewOneLiner(s.grid, "Unknown Repo:")
+ s.unknownSubmitB = s.grid.NewButton("map new repo path", func() {
+ /*
+ log.Info("Submit repo:", s.unknownOL.String())
+ if repolist.Exists(s.unknownOL.String()) {
+ log.Info("found repo:", repo.String(), "with giturl", repo.giturl)
+ localurl := repo.status.GitURL()
+ if localurl == "" {
+ log.Info("local repo check failed. repo is not uploaded?")
+ } else {
+ log.Info("local repo has", localurl)
+ // attempts to register the unknown repo
+ if gowit.Register(repo.String(), localurl) {
+ s.unknownOL.Hide()
+ s.unknownSubmitB.Hide()
+ }
+ }
+ } else {
+ log.Info("what is this?", s.unknownOL.String())
+ }
+ */
+ })
+ s.unknownOL.Disable()
+ s.unknownSubmitB.Disable()
+ s.grid.NextRow()
return s
}
+// does not run any commands
func (s *patchSummary) Update() {
var total, totalgo, dirty, readonly int
var userT, develT, masterT int
@@ -255,12 +201,7 @@ func (s *patchSummary) Update() {
for _, repo := range repolist.AllRepos() {
total += 1
if repo.Status.IsDirty() {
- if repo.Status.GoPath() == "go.wit.com/apps/autotypist" {
- // log.Info("ignoring dirty autotypist for now")
- dirty += 1
- } else {
- dirty += 1
- }
+ dirty += 1
}
if repo.Status.ReadOnly() {
readonly += 1