fix the build
This commit is contained in:
parent
e1411dd1e9
commit
f23109dce8
|
@ -41,7 +41,6 @@ func sendPendingPatches(pb *forgepb.Patches, reqPB *httppb.HttpRequest) *forgepb
|
|||
func sendPendingPatchsets(pb *forgepb.Patchsets, reqPB *httppb.HttpRequest) *forgepb.Patchsets {
|
||||
allPatchsetsPB := new(forgepb.Patchsets)
|
||||
for pset := range me.forge.Patchsets.IterAll() {
|
||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("adding %s with len=%d", pset.Name, pset.Patches.Len()))
|
||||
allPatchsetsPB.Append(pset)
|
||||
}
|
||||
return allPatchsetsPB
|
||||
|
@ -65,19 +64,19 @@ func handlePatches(w http.ResponseWriter, pb *forgepb.Patches) error {
|
|||
|
||||
func makeReposPB(reqPB *httppb.HttpRequest) (*gitpb.Repos, error) {
|
||||
pb := gitpb.NewRepos()
|
||||
err := pb.Unmarshal(reqPB.Body)
|
||||
err := pb.Unmarshal(reqPB.ServerData)
|
||||
return pb, err
|
||||
}
|
||||
|
||||
func makePatchesPB(reqPB *httppb.HttpRequest) (*forgepb.Patches, error) {
|
||||
pb := forgepb.NewPatches()
|
||||
err := pb.Unmarshal(reqPB.Body)
|
||||
err := pb.Unmarshal(reqPB.ServerData)
|
||||
return pb, err
|
||||
}
|
||||
|
||||
func makePatchsetsPB(reqPB *httppb.HttpRequest) (*forgepb.Patchsets, error) {
|
||||
pb := forgepb.NewPatchsets()
|
||||
err := pb.Unmarshal(reqPB.Body)
|
||||
err := pb.Unmarshal(reqPB.ServerData)
|
||||
return pb, err
|
||||
}
|
||||
|
||||
|
|
18
http.go
18
http.go
|
@ -49,14 +49,16 @@ func whoSent(r *http.Request) string {
|
|||
}
|
||||
|
||||
func logReqPB(pb *httppb.HttpRequest) {
|
||||
log.Info("LOG: httppb.HttpRequest Errors START:")
|
||||
log.Info(strings.Join(pb.Errors, "\n"))
|
||||
log.Info("LOG: httppb.HttpRequest Errors END")
|
||||
log.Info("LOG: httppb.HttpRequest START:")
|
||||
for i, line := range strings.Join(pb.Log, "\n") {
|
||||
log.Infof("\t%d %s\n", i, line)
|
||||
}
|
||||
log.Info("LOG: httppb.HttpRequest END")
|
||||
}
|
||||
|
||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||
reqPB, err := httppb.ReqToPB(r)
|
||||
reqPB.Errors = append(reqPB.Errors, fmt.Sprintf("START: Got %d bytes from the client", len(reqPB.Body)))
|
||||
reqPB.Log = append(reqPB.Log, fmt.Sprintf("START: Got %d bytes from the client", len(reqPB.ClientData)))
|
||||
if err != nil {
|
||||
log.Info("something crazy err", err)
|
||||
}
|
||||
|
@ -85,7 +87,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if strings.HasPrefix(route, "/repos/") {
|
||||
pb, err := makeReposPB(reqPB)
|
||||
if err != nil {
|
||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
||||
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||
}
|
||||
result := gitpb.NewRepos()
|
||||
switch route {
|
||||
|
@ -110,7 +112,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if strings.HasPrefix(route, "/patches/") {
|
||||
pb, err := makePatchesPB(reqPB)
|
||||
if err != nil {
|
||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
||||
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||
}
|
||||
result := forgepb.NewPatches()
|
||||
switch route {
|
||||
|
@ -141,7 +143,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if strings.HasPrefix(route, "/patchsets/") {
|
||||
pb, err := makePatchsetsPB(reqPB)
|
||||
if err != nil {
|
||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
||||
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||
}
|
||||
result := forgepb.NewPatchsets()
|
||||
switch route {
|
||||
|
@ -153,7 +155,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
if err := result.SendReply(w, reqPB); err != nil {
|
||||
log.Info("Oh well, Send to client failed. err =", err)
|
||||
}
|
||||
log.Info("Send to client seems to have worked. errors:", reqPB.Errors)
|
||||
log.Info("Send to client seems to have worked. log:", reqPB.Log)
|
||||
me.forge.SavePatchsets()
|
||||
// todo: logReq(reqPB)
|
||||
logReqPB(reqPB)
|
||||
|
|
Loading…
Reference in New Issue