summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applyPatch.go31
-rw-r--r--doDirty.go2
-rw-r--r--doExamine.go2
-rw-r--r--doGui.go2
-rw-r--r--windowForgePatchsets.go (renamed from windowPatches.go)53
-rw-r--r--windowPatchset.go (renamed from windowViewPatchset.go)22
-rw-r--r--windowViewRepoPatches.go2
7 files changed, 56 insertions, 58 deletions
diff --git a/applyPatch.go b/applyPatch.go
index 3610c06..1ca716c 100644
--- a/applyPatch.go
+++ b/applyPatch.go
@@ -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 {
diff --git a/doDirty.go b/doDirty.go
index afd39cf..9febe94 100644
--- a/doDirty.go
+++ b/doDirty.go
@@ -1,3 +1,5 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
package main
import (
diff --git a/doExamine.go b/doExamine.go
index c6b9091..26665f5 100644
--- a/doExamine.go
+++ b/doExamine.go
@@ -1,3 +1,5 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
package main
import (
diff --git a/doGui.go b/doGui.go
index 96b964f..fa011a0 100644
--- a/doGui.go
+++ b/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
diff --git a/windowPatches.go b/windowForgePatchsets.go
index 1bdc755..8fec827 100644
--- a/windowPatches.go
+++ b/windowForgePatchsets.go
@@ -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()
}
diff --git a/windowViewPatchset.go b/windowPatchset.go
index a9ff69d..337de2d 100644
--- a/windowViewPatchset.go
+++ b/windowPatchset.go
@@ -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()
}
}
diff --git a/windowViewRepoPatches.go b/windowViewRepoPatches.go
index 9b7ed83..a0cdfc5 100644
--- a/windowViewRepoPatches.go
+++ b/windowViewRepoPatches.go
@@ -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())