summaryrefslogtreecommitdiff
path: root/windowPatches.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-28 18:10:32 -0600
committerJeff Carr <[email protected]>2025-01-28 18:10:32 -0600
commitca92a4f4e4677ed14d3a4b2d028f667f31ed02c9 (patch)
treeffa3d3445d9d46bc6de013ff2450617aa232f153 /windowPatches.go
parentd16f4d4d32b47e17b58017bcf2a6e234d720f299 (diff)
gui patchset cleanupsv0.22.61
Diffstat (limited to 'windowPatches.go')
-rw-r--r--windowPatches.go85
1 files changed, 43 insertions, 42 deletions
diff --git a/windowPatches.go b/windowPatches.go
index aaf1c4f..bcb41bb 100644
--- a/windowPatches.go
+++ b/windowPatches.go
@@ -12,10 +12,10 @@ import (
)
type patchesWindow struct {
- once sync.Once // only init() the window once
- win *gadgets.BasicWindow // the patches window
- stack *gui.Node // the top box set as vertical
- shelf *gui.Node // the first box in the stack, set as horizontal
+ once sync.Once // only init() the window once
+ win *gadgets.BasicWindow // the patches window
+ stack *gui.Node // the top box set as vertical
+ // shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
@@ -66,50 +66,34 @@ func (r *patchesWindow) initWindow() {
r.grid = r.stack.NewGrid("", 0, 0)
- r.shelf = r.initGroup()
+ /*
+ r.shelf = r.initGroup()
+ group1 := r.stack.NewGroup("stuff")
+ vbox := group1.Box()
+ vbox.Vertical()
+ */
+
r.summary = r.submitPatchesBox(r.stack)
- r.initSetList()
-}
-func (r *patchesWindow) initGroup() *gui.Node {
- group1 := r.stack.NewGroup("stuff")
+ // update the stats about the repos and patches
+ r.summary.Update()
- vbox := group1.Box()
- vbox.Vertical()
+ g := r.stack.NewGroup("PatchSet List")
- hbox := vbox.Box().Horizontal()
+ // add the grid
+ r.setgrid = g.NewGrid("", 0, 0)
+ r.setlist = make(map[string]*forgepb.Patchset)
- dirty := hbox.NewCheckbox("dirty")
- dirty.Custom = func() {
- log.Info("filter dirty =", dirty.Checked())
+ // query for current patchsets
+ lines, err := listPatches()
+ if err != nil {
+ log.Info(err)
+ return
+ }
+ for i, line := range lines {
+ log.Info(i, line)
+ r.addPatchset(line)
}
-
- hbox.NewButton("update patch summary", func() {
- r.summary.Update()
- })
- hbox.NewButton("test add", func() {
- me.patchWin.initGroup()
- })
-
- hbox.NewButton("Get Patchsets", func() {
- psets, err := me.forge.GetPatchesets()
- if err != nil {
- log.Info(err)
- return
- }
- all := psets.All()
- for all.Scan() {
- pset := all.Next()
- log.Info(pset)
- }
- })
- return vbox
-}
-
-func (r *patchesWindow) initSetList() *gui.Node {
- r.setgrid = r.stack.NewGrid("", 0, 0)
- r.setlist = make(map[string]*forgepb.Patchset)
- return nil
}
func (r *patchesWindow) addPatchset(line string) {
@@ -151,5 +135,22 @@ func (r *patchesWindow) addPatchset(line string) {
return
}
})
+ r.setgrid.NewButton("Apply", func() {
+ pset := r.setlist[name]
+ if pset == nil {
+ log.Info(name, "was nil")
+ return
+ }
+ if _, _, _, err := IsEverythingOnDevel(); err != nil {
+ log.Info("You can only apply patches to the devel branch")
+ return
+ }
+ if IsAnythingDirty() {
+ log.Info("You can't apply patches when repos are dirty")
+ me.forge.PrintHumanTable(me.found)
+ return
+ }
+ applyPatchset(pset)
+ })
r.setgrid.NextRow()
}