more improvements to viewing patchsets
This commit is contained in:
parent
7c4feea366
commit
ed686fc4d6
|
@ -95,11 +95,6 @@ func applyPatchset(pset *forgepb.Patchset) error {
|
||||||
log.Info("Should run: at", basedir, ":", cmd)
|
log.Info("Should run: at", basedir, ":", cmd)
|
||||||
log.Info(basedir, filename)
|
log.Info(basedir, filename)
|
||||||
result := shell.PathRun(basedir, cmd)
|
result := shell.PathRun(basedir, cmd)
|
||||||
/*
|
|
||||||
if err != nil {
|
|
||||||
log.Info("git am failed", err)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
for _, line := range result.Stdout {
|
for _, line := range result.Stdout {
|
||||||
log.Warn("stdout:", line)
|
log.Warn("stdout:", line)
|
||||||
}
|
}
|
||||||
|
@ -107,32 +102,6 @@ func applyPatchset(pset *forgepb.Patchset) error {
|
||||||
log.Warn("stderr:", line)
|
log.Warn("stderr:", line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// log.Info("pset filename FILENAME IS REAL?", p.Filename, pset.Name, pset.Comment)
|
|
||||||
basepath, filename := filepath.Split(p.Filename)
|
|
||||||
fullpath := filepath.Join(me.forge.GetGoSrc(), basepath)
|
|
||||||
log.Info("pset filename FILENAME IS REAL? fullpath", fullpath)
|
|
||||||
fullTmpdir := filepath.Join(tmpdir, basepath)
|
|
||||||
err := os.MkdirAll(fullTmpdir, os.ModePerm)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("applyPathces() MkdirAll failed for", fullTmpdir)
|
|
||||||
log.Info("applyPathces() MkdirAll failed err", err)
|
|
||||||
everythingworked = false
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info("pset filename FILENAME IS REAL? tmp fullTmpdir", fullTmpdir)
|
|
||||||
tmpname := filepath.Join(fullTmpdir, filename)
|
|
||||||
raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
|
||||||
raw.Write(p.Data)
|
|
||||||
raw.Close()
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
result := shell.PathRun(fullpath, cmd)
|
|
||||||
if result.Exit != 0 {
|
|
||||||
log.Info("cmd failed", cmd, result.Exit)
|
|
||||||
everythingworked = false
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
everythingworked = false
|
everythingworked = false
|
||||||
}
|
}
|
||||||
if everythingworked {
|
if everythingworked {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
2
doGui.go
2
doGui.go
|
@ -1,3 +1,5 @@
|
||||||
|
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
// this is the "main" patch window. The first one
|
||||||
|
// then you can dig down and examine the patchsets and the files
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -115,19 +118,29 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
}
|
}
|
||||||
r.addPatchsetNew(pset)
|
r.addPatchsetNew(pset)
|
||||||
})
|
})
|
||||||
grid.NewButton("Get Patchset List", func() {
|
|
||||||
if psets, err := me.forge.GetPatchesets(); err != nil {
|
psets, err := openPatchsets()
|
||||||
|
if err != nil {
|
||||||
|
log.Info("Open Patchsets failed", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
grid.NewButton("Update Patchset List", func() {
|
||||||
|
psets, err = me.forge.GetPatchesets()
|
||||||
|
if err != nil {
|
||||||
log.Info("Get Patchsets failed", err)
|
log.Info("Get Patchsets failed", err)
|
||||||
return
|
return
|
||||||
} else {
|
}
|
||||||
log.Info("got psets len", len(psets.Patchsets))
|
savePatchsets(psets)
|
||||||
all := psets.SortByName()
|
|
||||||
for all.Scan() {
|
log.Info("got psets len", len(psets.Patchsets))
|
||||||
pset := all.Next()
|
all := psets.SortByName()
|
||||||
r.addPatchsetNew(pset)
|
for all.Scan() {
|
||||||
}
|
pset := all.Next()
|
||||||
|
r.addPatchsetNew(pset)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// disables the submit button until the user enters a name
|
||||||
r.submitB.Disable()
|
r.submitB.Disable()
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
|
@ -135,11 +148,10 @@ func (r *patchesWindow) submitPatchesBox() {
|
||||||
// add the grid
|
// add the grid
|
||||||
r.psetgrid = g.RawGrid()
|
r.psetgrid = g.RawGrid()
|
||||||
|
|
||||||
psets, err := openPatchsets()
|
// will look in ~/.config/forge for an existing patchset file
|
||||||
if err != nil {
|
// attempt to read in patchsets saved on disk
|
||||||
log.Info("Open Patchsets failed", err)
|
|
||||||
// return err
|
if psets != nil {
|
||||||
} else {
|
|
||||||
log.Info("got psets len", len(psets.Patchsets))
|
log.Info("got psets len", len(psets.Patchsets))
|
||||||
all := psets.SortByName()
|
all := psets.SortByName()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
|
@ -154,7 +166,10 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
r.psetgrid.NewLabel(pset.Name)
|
r.psetgrid.NewLabel(pset.Name)
|
||||||
r.psetgrid.NewLabel(pset.Comment)
|
r.psetgrid.NewLabel(pset.Comment)
|
||||||
r.psetgrid.NewLabel(pset.GitAuthorName)
|
r.psetgrid.NewLabel(pset.GitAuthorName)
|
||||||
// r.psetgrid.NewLabel(pset.RepoNamespace)
|
|
||||||
|
ctime := pset.Ctime.AsTime()
|
||||||
|
stime := ctime.UTC().Format("2006-01-02_15:04:05_UTC")
|
||||||
|
r.psetgrid.NewLabel(stime)
|
||||||
if pset.State == "BROKEN" {
|
if pset.State == "BROKEN" {
|
||||||
r.psetgrid.NewLabel("Bad")
|
r.psetgrid.NewLabel("Bad")
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,14 +187,6 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
win = makePatchWindow(pset)
|
win = makePatchWindow(pset)
|
||||||
win.Show()
|
win.Show()
|
||||||
})
|
})
|
||||||
|
|
||||||
if pset.State == "BROKEN" {
|
|
||||||
// a.Disable()
|
|
||||||
} else {
|
|
||||||
r.psetgrid.NewButton("Apply (git am)", func() {
|
|
||||||
applyPatchset(pset)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
r.psetgrid.NextRow()
|
r.psetgrid.NextRow()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
@ -139,8 +141,6 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
repohash[repo] = p.StartHash
|
repohash[repo] = p.StartHash
|
||||||
}
|
}
|
||||||
|
|
||||||
// var repo *gitpb.Repo
|
|
||||||
|
|
||||||
for repo, patches := range repomap {
|
for repo, patches := range repomap {
|
||||||
log.Info(repo.GetGoPath())
|
log.Info(repo.GetGoPath())
|
||||||
grid.NewLabel(repo.GetGoPath())
|
grid.NewLabel(repo.GetGoPath())
|
||||||
|
@ -166,6 +166,24 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
})
|
})
|
||||||
grid.NewCheckbox("").SetChecked(true)
|
grid.NewCheckbox("").SetChecked(true)
|
||||||
grid.NewCheckbox("").SetChecked(true)
|
grid.NewCheckbox("").SetChecked(true)
|
||||||
|
grid.NewButton("save", func() {
|
||||||
|
for _, p := range patches {
|
||||||
|
_, filen := filepath.Split(p.Filename)
|
||||||
|
tmpname := filepath.Join("/tmp", filen)
|
||||||
|
log.Info("saving as", tmpname, p.Filename)
|
||||||
|
raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
|
raw.Write(p.Data)
|
||||||
|
raw.Close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -124,8 +124,6 @@ func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||||
repohash[repo] = p.StartHash
|
repohash[repo] = p.StartHash
|
||||||
}
|
}
|
||||||
|
|
||||||
// var repo *gitpb.Repo
|
|
||||||
|
|
||||||
for repo, patches := range repomap {
|
for repo, patches := range repomap {
|
||||||
log.Info(repo.GetGoPath())
|
log.Info(repo.GetGoPath())
|
||||||
grid.NewLabel(repo.GetGoPath())
|
grid.NewLabel(repo.GetGoPath())
|
||||||
|
|
Loading…
Reference in New Issue