something good about this

This commit is contained in:
Jeff Carr 2025-09-23 11:38:44 -05:00
parent ada923ea05
commit 1f22b771c3
3 changed files with 41 additions and 6 deletions

View File

@ -6,8 +6,12 @@ import (
) )
func doList() error { func doList() error {
log.Info("do list here")
log.Infof("do list here. Patchsets.Len()=%d\n", me.forge.Patchsets.Len())
for pset := range me.forge.Patchsets.IterAll() {
pset.PrintTable()
}
/*
// show all the patchsets with Names // show all the patchsets with Names
for pset := range me.forge.Patchsets.IterAll() { for pset := range me.forge.Patchsets.IterAll() {
log.Info("Info", pset.Name, pset.Uuid) log.Info("Info", pset.Name, pset.Uuid)
@ -15,6 +19,7 @@ func doList() error {
log.Info("\t", i, patch.CommitHash, patch.Namespace) log.Info("\t", i, patch.CommitHash, patch.Namespace)
} }
} }
*/
return nil return nil
} }

25
http.go
View File

@ -63,6 +63,31 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
if strings.HasPrefix(route, "/set/") {
pb := new(forgepb.Set)
if err := pb.Unmarshal(reqPB.ClientData); err != nil {
reqPB.Logf("Patches Unmarshal() len(data)=%d err=%v", len(reqPB.ClientData), err)
logReqPB(reqPB)
return
}
reqPB.Logf("Patches Unmarshal() len=%d", pb.Patches.Len())
result := new(forgepb.Set)
switch route {
case "/set/new":
me.forge.Patchsets.Append(pb)
reqPB.Logf("addNewPatches() pb.Patches.Len()=%d Patchsets.Len()=%d", pb.Patches.Len(), me.forge.Patchsets.Len())
me.forge.SavePatchsets()
result.Uuid = pb.Uuid
default:
}
if err := result.SendReply(w, reqPB); err != nil {
reqPB.Logf("Oh well, Send to client failed. err=%v", err)
}
// todo: logReq(reqPB)
logReqPB(reqPB)
return
}
if strings.HasPrefix(route, "/patches/") { if strings.HasPrefix(route, "/patches/") {
pb := forgepb.NewPatches() pb := forgepb.NewPatches()
if err := pb.Unmarshal(reqPB.ClientData); err == nil { if err := pb.Unmarshal(reqPB.ClientData); err == nil {

View File

@ -7,6 +7,7 @@ import (
"time" "time"
"go.wit.com/dev/alexflint/arg" "go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/prep" "go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log" "go.wit.com/log"
@ -34,9 +35,13 @@ func main() {
if err := me.forge.InitPatchsets(); err != nil { if err := me.forge.InitPatchsets(); err != nil {
log.Info("patches failed to open", err) log.Info("patches failed to open", err)
badExit(err)
} }
if argv.List != nil { if argv.List != nil {
log.Printf("forge.Init() %s len()=%d\n", me.forge.Config.Filename, me.forge.Repos.Len())
fhelp.DumpENV("finit:")
me.forge.Config.DumpENV()
doList() doList()
okExit("") okExit("")
} }