diff options
| author | Jeff Carr <[email protected]> | 2024-12-23 03:45:30 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-23 03:45:30 -0600 |
| commit | b7a6001ba450de82e1aa216410f236f516f50a17 (patch) | |
| tree | 8a612ac0b88a33882a23028d4ecbaf4c271b851e /subitPatches.go | |
| parent | e68cb3e80f792b0288680ec04ceb4b9c77426563 (diff) | |
submit sends patches
Diffstat (limited to 'subitPatches.go')
| -rw-r--r-- | subitPatches.go | 256 |
1 files changed, 0 insertions, 256 deletions
diff --git a/subitPatches.go b/subitPatches.go deleted file mode 100644 index 9929909..0000000 --- a/subitPatches.go +++ /dev/null @@ -1,256 +0,0 @@ -package main - -import ( - "os" - "path/filepath" - "strconv" - - "go.wit.com/gui" - "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" - "go.wit.com/lib/gui/shell" - "go.wit.com/log" -) - -/* -type patch struct { - ref string - giturl string - comment string - rs *repostatus.RepoStatus -} -*/ - -type patchSummary struct { - grid *gui.Node - updateB *gui.Node - docsB *gui.Node - gitPushB *gui.Node - gitPullB *gui.Node - checkB *gui.Node - - // stats - totalOL *gadgets.OneLiner - // totalGoOL *gadgets.OneLiner - dirtyOL *gadgets.OneLiner - readonlyOL *gadgets.OneLiner - totalPatchesOL *gadgets.OneLiner - totalUserRepos *gui.Node - totalDevelRepos *gui.Node - totalMasterRepos *gui.Node - totalUserPatches *gui.Node - totalDevelPatches *gui.Node - totalMasterPatches *gui.Node - - // patch set generation - unknownOL *gadgets.BasicEntry - unknownSubmitB *gui.Node - reason *gadgets.BasicEntry - submitB *gui.Node - allp []*repolist.Patch -} - -func submitPatchesBox(box *gui.Node) *patchSummary { - s := new(patchSummary) - group1 := box.NewGroup("Patch Summary") - s.grid = group1.RawGrid() - - /* - s.grid.NewButton("Update Patch Counts", func() { - var repocount, patchcount int - // broken after move to forge protobuf - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - if repo.GetReadOnly() { - continue - } - i, _ := repo.GetMasterPatches() - patchcount += i - if i > 0 { - repocount += 1 - } - } - s.totalMasterPatches.SetText(strconv.Itoa(patchcount) + " patches") - s.totalMasterRepos.SetText(strconv.Itoa(repocount) + " go repos") - - repocount = 0 - patchcount = 0 - // broken after move to forge protobuf - all = me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - if repo.GetReadOnly() { - continue - } - i, _ := repo.GetUserPatches() - patchcount += i - if i > 0 { - repocount += 1 - } - } - s.totalUserPatches.SetText(strconv.Itoa(patchcount) + " patches") - s.totalUserRepos.SetText(strconv.Itoa(repocount) + " go repos") - }) - */ - - /* this used to be the way and should probably be revisited - s.grid.NewButton("Make Patches", func() { - for i, p := range s.allp { - log.Info(i, p.Ref, p.RS.String()) - } - }) - */ - - s.grid.NextRow() - - s.totalOL = gadgets.NewOneLiner(s.grid, "Total") - s.grid.NextRow() - - // s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") - // s.grid.NextRow() - - s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") - s.grid.NextRow() - - 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("x patches") - s.totalDevelPatches = s.grid.NewLabel("") - s.totalMasterPatches = s.grid.NewLabel("x patches") - s.grid.NextRow() - - /* - s.grid.NewLabel("") - s.grid.NewLabel("") - s.grid.NewButton("merge from user", func() { - log.Info("this should make a patchset of your patches") - }) - s.grid.NewButton("merge from devel", func() { - log.Info("this probably should not exist") - }) - */ - s.grid.NextRow() - - group1 = box.NewGroup("Submit Patch Set") - s.grid = group1.RawGrid() - s.reason = gadgets.NewBasicEntry(s.grid, "set name:") - s.reason.Custom = func() { - if s.reason.String() != "" { - s.submitB.Enable() - } else { - s.submitB.Disable() - } - } - s.submitB = s.grid.NewButton("Submit", func() { - dirname := "submit-patchset.quilt" - patchdir := filepath.Join(me.userHomePwd.String(), dirname) - if shell.Exists(patchdir) { - log.Info("patchset dir already exists", patchdir) - shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname}) - } - os.MkdirAll(patchdir, os.ModeDir) - if !shell.Exists(patchdir) { - log.Info("something went wrong making", patchdir) - return - } - me.repos.View.MakePatchset(patchdir) - }) - s.grid.NewButton("Show Repos", func() { - s.Update() - if me.repos.Hidden() { - me.repos.Show() - } else { - me.repos.Hide() - } - }) - - /* - s.submitB = s.grid.NewButton("Submit quilt", func() { - log.Info("do a submit here") - }) - */ - // disable these until there are not dirty repos - // s.reason.Disable() - s.submitB.Disable() - s.grid.NextRow() - - // s.unknownOL.Disable() - // s.unknownSubmitB.Disable() - s.grid.NextRow() - - return s -} - -// does not run any commands -func (s *patchSummary) Update() { - var total, dirty, readonly int - var userT, develT, masterT int - // var userP, develP, masterP int - // broken after move to forge protobuf - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - repo := all.Next() - total += 1 - if repo.IsDirty() { - dirty += 1 - } - 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.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.GetGoPath()) - develT += 1 - } - if masterV != lastV { - masterT += 1 - } - } - s.totalOL.SetText(strconv.Itoa(total) + " repos") - // s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") - s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") - s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") - - s.totalUserRepos.SetText(strconv.Itoa(userT) + " repos") - s.totalDevelRepos.SetText(strconv.Itoa(develT) + " repos") - s.totalMasterRepos.SetText(strconv.Itoa(masterT) + " repos") - - if dirty == 0 { - s.reason.Enable() - s.submitB.Enable() - // s.unknownOL.Enable() - // s.unknownSubmitB.Enable() - } else { - // s.reason.Disable() - s.submitB.Enable() - // s.unknownOL.Enable() - // s.unknownSubmitB.Enable() - } -} |
