working on patch handling

This commit is contained in:
Jeff Carr 2025-09-03 05:50:18 -05:00
parent 557a5853a4
commit 30dcc8af9f
7 changed files with 37 additions and 35 deletions

View File

@ -69,7 +69,7 @@ pull: install
# cloudflare blocks POST due to captcha checks / human detection?
# POST must be direct socket. probably for the best anyway
submit:
FORGE_URL="https://forge.grid.wit.com/" forge patch --submit "forge auto commit"
FORGE_URL="https://forge.grid.wit.com/" forge patch submit "forge auto commit"
# forge patch --submit "forge auto commit"
commit:

2
all-patches.pb Normal file
View File

@ -0,0 +1,2 @@
$be926ad9-f07f-484c-adf2-d96eeabf3079'v0.0.45 go.wit.com/lib/protobuf/forgepb

12
argv.go
View File

@ -62,10 +62,14 @@ type CleanDevelCmd struct {
}
type PatchCmd struct {
List *EmptyCmd `arg:"subcommand:list" help:"your downloaded patchsets"`
Get *EmptyCmd `arg:"subcommand:get" help:"get the new patchsets"`
Show *EmptyCmd `arg:"subcommand:show" help:"your pending commits to your code"`
Submit string `arg:"--submit" help:"submit your commits"`
List *EmptyCmd `arg:"subcommand:list" help:"your downloaded patchsets"`
Get *EmptyCmd `arg:"subcommand:get" help:"get the new patchsets"`
Show *EmptyCmd `arg:"subcommand:show" help:"your pending commits to your code"`
Submit *SubmitCmd `arg:"subcommand:submit" help:"submit your commits"`
}
type SubmitCmd struct {
Match string `arg:"positional"`
}
type PullCmd struct {

View File

@ -52,7 +52,7 @@ func (args) doBashAuto() {
case "--find":
fmt.Println("foo bar")
case "patch":
fmt.Println("get list --submit show")
fmt.Println("get list submit show")
case "user":
fmt.Println("--force")
case "devel":

View File

@ -146,7 +146,8 @@ func drawWindow(win *gadgets.GenericWindow) {
patchesWin.Toggle()
return
}
loadUpstreamPatchsets()
me.forge.GetPatches()
// loadUpstreamPatchsets()
if me.psets == nil {
log.Info("failed to download current patchsets")
return

View File

@ -13,8 +13,15 @@ import (
)
func doPatch() error {
if argv.Patch.Submit != "" {
_, err := me.forge.SubmitDevelPatchSet(argv.Patch.Submit)
if err := me.forge.LoadPatchsets(); err != nil {
log.Info("patches failed to open", err)
if err := me.forge.SavePatchsets(); err != nil {
log.Warn("savePatchsets() failed", err)
}
}
if argv.Patch.Submit != nil {
_, err := me.forge.SubmitDevelPatchSet(argv.Patch.Submit.Match)
if err != nil {
return err
}
@ -22,7 +29,12 @@ func doPatch() error {
}
if argv.Patch.Get != nil {
return doPatchGet()
if err := me.forge.GetPatches(); err != nil {
log.Info("Get Patchsets Failed", err)
return err
}
me.forge.Patchsets.PrintTable()
return nil
}
if argv.Patch.List != nil {
@ -156,24 +168,3 @@ func IsValidPatch(p *forgepb.Patch) bool {
}
return true
}
func doPatchGet() error {
psets, err := me.forge.GetPatchesets()
if err != nil {
log.Info("Get Patchsets failed", err)
return err
}
log.Info("Got Patchsets ok", psets.Uuid)
log.Info("got psets len", len(psets.Patchsets))
all := psets.SortByName()
for all.Scan() {
pset := all.Next()
// log.Info("pset name =", pset.Name)
dumpPatchset(pset)
}
log.Info("FIXME: can't save these yet. must merge with on disk psets here")
// savePatchsets()
return nil
}

View File

@ -36,6 +36,7 @@ func (w *stdPatchsetTableWin) Toggle() {
w.win.Toggle()
}
/*
func loadUpstreamPatchsets() {
psets, err := me.forge.GetPatchesets()
if err != nil {
@ -66,6 +67,7 @@ func loadUpstreamPatchsets() {
savePatchsets()
}
}
*/
func makePatchsetsWin() *stdPatchsetTableWin {
dwin := new(stdPatchsetTableWin)
@ -84,10 +86,12 @@ func makePatchsetsWin() *stdPatchsetTableWin {
dwin.doPatchsetsTable(me.psets)
})
grid.NewButton("upstream", func() {
loadUpstreamPatchsets()
dwin.doPatchsetsTable(me.psets)
})
/*
grid.NewButton("upstream", func() {
loadUpstreamPatchsets()
dwin.doPatchsetsTable(me.psets)
})
*/
grid.NewButton("save", func() {
if me.psets == nil {