working on more standard patch windows
This commit is contained in:
parent
18d9a7a099
commit
391a988e5f
|
@ -11,7 +11,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
|
@ -102,8 +101,10 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
log.Info("you have no current patches")
|
log.Info("you have no current patches")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
win := makePatchWindow(pset)
|
/*
|
||||||
win.Show()
|
win := makePatchWindow(pset)
|
||||||
|
win.Show()
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
r.reason = gadgets.NewBasicEntry(grid, "Patchset name:")
|
r.reason = gadgets.NewBasicEntry(grid, "Patchset name:")
|
||||||
|
@ -123,12 +124,12 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
log.Info("submit button is disabled. BAD GUI TOOLKIT ERROR")
|
log.Info("submit button is disabled. BAD GUI TOOLKIT ERROR")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pset, err := me.forge.SubmitDevelPatchSet(r.reason.String())
|
// pset, err := me.forge.SubmitDevelPatchSet(r.reason.String())
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
log.Info(err)
|
// log.Info(err)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
r.addPatchsetNew(pset)
|
// r.addPatchsetNew(pset)
|
||||||
})
|
})
|
||||||
|
|
||||||
psets, err := openPatchsets()
|
psets, err := openPatchsets()
|
||||||
|
@ -144,12 +145,14 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
}
|
}
|
||||||
savePatchsets(psets)
|
savePatchsets(psets)
|
||||||
|
|
||||||
log.Info("got psets len", len(psets.Patchsets))
|
/*
|
||||||
all := psets.SortByName()
|
log.Info("got psets len", len(psets.Patchsets))
|
||||||
for all.Scan() {
|
all := psets.SortByName()
|
||||||
pset := all.Next()
|
for all.Scan() {
|
||||||
r.addPatchsetNew(pset)
|
pset := all.Next()
|
||||||
}
|
r.addPatchsetNew(pset)
|
||||||
|
}
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
|
|
||||||
// disables the submit button until the user enters a name
|
// disables the submit button until the user enters a name
|
||||||
|
@ -165,15 +168,18 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
|
|
||||||
if psets != nil {
|
if psets != nil {
|
||||||
log.Info("got psets len", len(psets.Patchsets))
|
log.Info("got psets len", len(psets.Patchsets))
|
||||||
all := psets.SortByName()
|
/*
|
||||||
for all.Scan() {
|
all := psets.SortByName()
|
||||||
pset := all.Next()
|
for all.Scan() {
|
||||||
// log.Info("pset name =", pset.Name)
|
pset := all.Next()
|
||||||
r.addPatchsetNew(pset)
|
log.Info("pset name =", pset.Name)
|
||||||
}
|
r.addPatchsetNew(pset)
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
var win *patchWindow
|
var win *patchWindow
|
||||||
r.psetgrid.NewButton("View", func() {
|
r.psetgrid.NewButton("View", func() {
|
||||||
|
@ -183,8 +189,8 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
win = makePatchWindow(pset)
|
// win = makePatchWindow(pset)
|
||||||
win.Show()
|
// win.Show()
|
||||||
})
|
})
|
||||||
r.psetgrid.NewLabel(pset.Name)
|
r.psetgrid.NewLabel(pset.Name)
|
||||||
r.psetgrid.NewLabel(pset.Comment)
|
r.psetgrid.NewLabel(pset.Comment)
|
||||||
|
@ -202,6 +208,7 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
|
|
||||||
r.psetgrid.NextRow()
|
r.psetgrid.NextRow()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// will update this from the current state of the protobuf
|
// will update this from the current state of the protobuf
|
||||||
func (r *patchesWindow) Update() {
|
func (r *patchesWindow) Update() {
|
||||||
|
|
|
@ -32,9 +32,10 @@ func (w *stdPatchTableWin) Toggle() {
|
||||||
|
|
||||||
func makePatchesWin() *stdPatchTableWin {
|
func makePatchesWin() *stdPatchTableWin {
|
||||||
dwin := new(stdPatchTableWin)
|
dwin := new(stdPatchTableWin)
|
||||||
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "who is squirreling around?")
|
dwin.win = gadgets.NewGenericWindow("current patches", "patching options")
|
||||||
dwin.win.Custom = func() {
|
dwin.win.Custom = func() {
|
||||||
log.Info("test delete window here")
|
log.Info("test delete window here")
|
||||||
|
// dwin = nil
|
||||||
}
|
}
|
||||||
grid := dwin.win.Group.RawGrid()
|
grid := dwin.win.Group.RawGrid()
|
||||||
|
|
||||||
|
@ -54,6 +55,13 @@ func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
|
||||||
dwin.TB.Delete()
|
dwin.TB.Delete()
|
||||||
dwin.TB = nil
|
dwin.TB = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display the protobuf
|
||||||
|
dwin.TB = AddPatchesPB(dwin.box, currentPatches)
|
||||||
|
f := func(p *forgepb.Patch) {
|
||||||
|
log.Info("do something with patch", p.Filename)
|
||||||
|
}
|
||||||
|
dwin.TB.Custom(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
// define what rows to have in the protobuf table
|
// define what rows to have in the protobuf table
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (w *stdPatchsetTableWin) Toggle() {
|
||||||
|
|
||||||
func makePatchsetsWin() *stdPatchsetTableWin {
|
func makePatchsetsWin() *stdPatchsetTableWin {
|
||||||
dwin := new(stdPatchsetTableWin)
|
dwin := new(stdPatchsetTableWin)
|
||||||
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "who is squirreling around?")
|
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "patchset options")
|
||||||
dwin.win.Custom = func() {
|
dwin.win.Custom = func() {
|
||||||
log.Info("test delete window here")
|
log.Info("test delete window here")
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,10 @@ func (dwin *stdPatchsetTableWin) doPatchsetsTable(currentPatchsets *forgepb.Patc
|
||||||
dwin.TB = AddPatchsetsPB(dwin.box, currentPatchsets)
|
dwin.TB = AddPatchsetsPB(dwin.box, currentPatchsets)
|
||||||
f := func(pset *forgepb.Patchset) {
|
f := func(pset *forgepb.Patchset) {
|
||||||
log.Info("Triggered. do something here", pset.Name)
|
log.Info("Triggered. do something here", pset.Name)
|
||||||
win := makePatchWindow(pset)
|
/*
|
||||||
win.Show()
|
win := makePatchWindow(pset)
|
||||||
|
win.Show()
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
dwin.TB.Custom(f)
|
dwin.TB.Custom(f)
|
||||||
}
|
}
|
||||||
|
@ -106,19 +108,22 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
testf := func(p *forgepb.Patchset) string {
|
testf := func(p *forgepb.Patchset) string {
|
||||||
return "test"
|
return "test"
|
||||||
}
|
}
|
||||||
tp := t.AddButtonFunc("Analyse", testf)
|
tp := t.AddButtonFunc("Analyze", testf)
|
||||||
tp.Custom = func(p *forgepb.Patchset) {
|
tp.Custom = func(p *forgepb.Patchset) {
|
||||||
log.Info("show patches here", p.Name)
|
log.Info("analyze patches here", p.Name)
|
||||||
patchwin := makePatchesWin()
|
|
||||||
patchwin.doPatchesTable(p.Patches)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
||||||
return p.Name
|
return p.Name
|
||||||
})
|
})
|
||||||
vp.Custom = func(pset *forgepb.Patchset) {
|
vp.Custom = func(pset *forgepb.Patchset) {
|
||||||
win := makePatchWindow(pset)
|
log.Info("show patches here", pset.Name)
|
||||||
win.Show()
|
patchwin := makePatchesWin()
|
||||||
|
patchwin.doPatchesTable(pset.Patches)
|
||||||
|
/*
|
||||||
|
win := makePatchWindow(pset)
|
||||||
|
win.Show()
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
t.AddComment()
|
t.AddComment()
|
||||||
|
|
|
@ -3,19 +3,7 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
/*
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
|
||||||
"go.wit.com/log"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
|
||||||
)
|
|
||||||
|
|
||||||
type patchWindow struct {
|
type patchWindow struct {
|
||||||
once sync.Once // only init() the window once
|
once sync.Once // only init() the window once
|
||||||
win *gadgets.BasicWindow // the patches window
|
win *gadgets.BasicWindow // the patches window
|
||||||
|
@ -123,28 +111,6 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
|
||||||
grid.NewLabel("Applied in current branch?")
|
grid.NewLabel("Applied in current branch?")
|
||||||
grid.NewLabel("start hash")
|
grid.NewLabel("start hash")
|
||||||
grid.NewLabel("")
|
grid.NewLabel("")
|
||||||
/*
|
|
||||||
grid.NewButton("Extract", func() {
|
|
||||||
if err := savePatchset(pset); err != nil {
|
|
||||||
log.Info("Save err:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
grid.NewButton("Apply with git am", func() {
|
|
||||||
if _, _, _, err := IsEverythingOnUser(); err != nil {
|
|
||||||
log.Info("You can only apply patches to the user branch")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if IsAnythingDirty() {
|
|
||||||
log.Info("You can't apply patches when repos are dirty")
|
|
||||||
me.forge.PrintHumanTable(me.found)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if argv.Force {
|
|
||||||
applyPatchset(pset)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
// add the patches to the grid
|
// add the patches to the grid
|
||||||
|
@ -153,25 +119,6 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
/*
|
|
||||||
repomap := make(map[*gitpb.Repo][]*forgepb.Patch)
|
|
||||||
repohash := make(map[*gitpb.Repo]string)
|
|
||||||
|
|
||||||
// sort patches by repo namespace
|
|
||||||
all := pset.Patches.SortByFilename()
|
|
||||||
for all.Scan() {
|
|
||||||
p := all.Next()
|
|
||||||
s := p.RepoNamespace
|
|
||||||
repo := me.forge.FindByGoPath(s)
|
|
||||||
if repo == nil {
|
|
||||||
log.Info("Could not figure out repo path", s)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
repomap[repo] = append(repomap[repo], p)
|
|
||||||
repohash[repo] = p.StartHash
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
all := pset.Patches.SortByFilename()
|
all := pset.Patches.SortByFilename()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
p := all.Next()
|
p := all.Next()
|
||||||
|
@ -185,14 +132,6 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
log.Info("Adding patches for", rn)
|
log.Info("Adding patches for", rn)
|
||||||
grid.NewLabel(rn)
|
grid.NewLabel(rn)
|
||||||
|
|
||||||
/*
|
|
||||||
for i, p := range patches {
|
|
||||||
log.Info(i, p.Filename)
|
|
||||||
grid.NewLabel(p.Comment)
|
|
||||||
grid.NewLabel("in current branch?")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// hash := repohash[repo]
|
// hash := repohash[repo]
|
||||||
grid.NewLabel(p.StartHash)
|
grid.NewLabel(p.StartHash)
|
||||||
grid.NewLabel(p.Filename)
|
grid.NewLabel(p.Filename)
|
||||||
|
@ -216,16 +155,6 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
// for _, pat := range patches {
|
// for _, pat := range patches {
|
||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
/*
|
|
||||||
grid.NewButton("view hash", func() {
|
|
||||||
cmd := []string{"git", "whatchanged", hash}
|
|
||||||
log.Info(repo.GetFullPath(), cmd)
|
|
||||||
})
|
|
||||||
grid.NewButton("git am", func() {
|
|
||||||
cmd := []string{"git", "whatchanged", hash}
|
|
||||||
log.Info(repo.GetFullPath(), cmd)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,3 +208,4 @@ func savePatchset(pset *forgepb.Patchset) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue