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(basedir, filename)
|
||||
result := shell.PathRun(basedir, cmd)
|
||||
/*
|
||||
if err != nil {
|
||||
log.Info("git am failed", err)
|
||||
}
|
||||
*/
|
||||
for _, line := range result.Stdout {
|
||||
log.Warn("stdout:", line)
|
||||
}
|
||||
|
@ -107,32 +102,6 @@ func applyPatchset(pset *forgepb.Patchset) error {
|
|||
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
|
||||
}
|
||||
if everythingworked {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
2
doGui.go
2
doGui.go
|
@ -1,3 +1,5 @@
|
|||
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
// An app to submit patches for the 30 GO GUI repos
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package main
|
||||
|
||||
// this is the "main" patch window. The first one
|
||||
// then you can dig down and examine the patchsets and the files
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
@ -115,19 +118,29 @@ func (r *patchesWindow) submitPatchesBox() {
|
|||
}
|
||||
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)
|
||||
return
|
||||
} else {
|
||||
log.Info("got psets len", len(psets.Patchsets))
|
||||
all := psets.SortByName()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
r.addPatchsetNew(pset)
|
||||
}
|
||||
}
|
||||
savePatchsets(psets)
|
||||
|
||||
log.Info("got psets len", len(psets.Patchsets))
|
||||
all := psets.SortByName()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
r.addPatchsetNew(pset)
|
||||
}
|
||||
})
|
||||
|
||||
// disables the submit button until the user enters a name
|
||||
r.submitB.Disable()
|
||||
grid.NextRow()
|
||||
|
||||
|
@ -135,11 +148,10 @@ func (r *patchesWindow) submitPatchesBox() {
|
|||
// add the grid
|
||||
r.psetgrid = g.RawGrid()
|
||||
|
||||
psets, err := openPatchsets()
|
||||
if err != nil {
|
||||
log.Info("Open Patchsets failed", err)
|
||||
// return err
|
||||
} else {
|
||||
// will look in ~/.config/forge for an existing patchset file
|
||||
// attempt to read in patchsets saved on disk
|
||||
|
||||
if psets != nil {
|
||||
log.Info("got psets len", len(psets.Patchsets))
|
||||
all := psets.SortByName()
|
||||
for all.Scan() {
|
||||
|
@ -154,7 +166,10 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
|||
r.psetgrid.NewLabel(pset.Name)
|
||||
r.psetgrid.NewLabel(pset.Comment)
|
||||
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" {
|
||||
r.psetgrid.NewLabel("Bad")
|
||||
} else {
|
||||
|
@ -172,14 +187,6 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
|||
win = makePatchWindow(pset)
|
||||
win.Show()
|
||||
})
|
||||
|
||||
if pset.State == "BROKEN" {
|
||||
// a.Disable()
|
||||
} else {
|
||||
r.psetgrid.NewButton("Apply (git am)", func() {
|
||||
applyPatchset(pset)
|
||||
})
|
||||
}
|
||||
r.psetgrid.NextRow()
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"go.wit.com/lib/gadgets"
|
||||
|
@ -139,8 +141,6 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
|||
repohash[repo] = p.StartHash
|
||||
}
|
||||
|
||||
// var repo *gitpb.Repo
|
||||
|
||||
for repo, patches := range repomap {
|
||||
log.Info(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.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()
|
||||
}
|
||||
}
|
|
@ -124,8 +124,6 @@ func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
|||
repohash[repo] = p.StartHash
|
||||
}
|
||||
|
||||
// var repo *gitpb.Repo
|
||||
|
||||
for repo, patches := range repomap {
|
||||
log.Info(repo.GetGoPath())
|
||||
grid.NewLabel(repo.GetGoPath())
|
||||
|
|
Loading…
Reference in New Issue