something good about this
This commit is contained in:
parent
ada923ea05
commit
1f22b771c3
17
doList.go
17
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
|
||||
}
|
||||
|
||||
|
|
25
http.go
25
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 {
|
||||
|
|
5
main.go
5
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("")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue