summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doList.go17
-rw-r--r--http.go25
-rw-r--r--main.go5
3 files changed, 41 insertions, 6 deletions
diff --git a/doList.go b/doList.go
index 149ecc0..a7b2a17 100644
--- a/doList.go
+++ b/doList.go
@@ -6,15 +6,20 @@ import (
)
func doList() error {
- log.Info("do list here")
- // show all the patchsets with Names
+ log.Infof("do list here. Patchsets.Len()=%d\n", me.forge.Patchsets.Len())
for pset := range me.forge.Patchsets.IterAll() {
- log.Info("Info", pset.Name, pset.Uuid)
- for i, patch := range pset.Patches.Patches {
- log.Info("\t", i, patch.CommitHash, patch.Namespace)
- }
+ pset.PrintTable()
}
+ /*
+ // show all the patchsets with Names
+ for pset := range me.forge.Patchsets.IterAll() {
+ log.Info("Info", pset.Name, pset.Uuid)
+ for i, patch := range pset.Patches.Patches {
+ log.Info("\t", i, patch.CommitHash, patch.Namespace)
+ }
+ }
+ */
return nil
}
diff --git a/http.go b/http.go
index f482499..f35837c 100644
--- a/http.go
+++ b/http.go
@@ -63,6 +63,31 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
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/") {
pb := forgepb.NewPatches()
if err := pb.Unmarshal(reqPB.ClientData); err == nil {
diff --git a/main.go b/main.go
index a57b5ab..eb37459 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@ import (
"time"
"go.wit.com/dev/alexflint/arg"
+ "go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
@@ -34,9 +35,13 @@ func main() {
if err := me.forge.InitPatchsets(); err != nil {
log.Info("patches failed to open", err)
+ badExit(err)
}
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()
okExit("")
}