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 {
|
func sendPendingPatchsets(pb *forgepb.Patchsets, reqPB *httppb.HttpRequest) *forgepb.Patchsets {
|
||||||
allPatchsetsPB := new(forgepb.Patchsets)
|
allPatchsetsPB := new(forgepb.Patchsets)
|
||||||
for pset := range me.forge.Patchsets.IterAll() {
|
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)
|
allPatchsetsPB.Append(pset)
|
||||||
}
|
}
|
||||||
return allPatchsetsPB
|
return allPatchsetsPB
|
||||||
|
@ -65,19 +64,19 @@ func handlePatches(w http.ResponseWriter, pb *forgepb.Patches) error {
|
||||||
|
|
||||||
func makeReposPB(reqPB *httppb.HttpRequest) (*gitpb.Repos, error) {
|
func makeReposPB(reqPB *httppb.HttpRequest) (*gitpb.Repos, error) {
|
||||||
pb := gitpb.NewRepos()
|
pb := gitpb.NewRepos()
|
||||||
err := pb.Unmarshal(reqPB.Body)
|
err := pb.Unmarshal(reqPB.ServerData)
|
||||||
return pb, err
|
return pb, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func makePatchesPB(reqPB *httppb.HttpRequest) (*forgepb.Patches, error) {
|
func makePatchesPB(reqPB *httppb.HttpRequest) (*forgepb.Patches, error) {
|
||||||
pb := forgepb.NewPatches()
|
pb := forgepb.NewPatches()
|
||||||
err := pb.Unmarshal(reqPB.Body)
|
err := pb.Unmarshal(reqPB.ServerData)
|
||||||
return pb, err
|
return pb, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func makePatchsetsPB(reqPB *httppb.HttpRequest) (*forgepb.Patchsets, error) {
|
func makePatchsetsPB(reqPB *httppb.HttpRequest) (*forgepb.Patchsets, error) {
|
||||||
pb := forgepb.NewPatchsets()
|
pb := forgepb.NewPatchsets()
|
||||||
err := pb.Unmarshal(reqPB.Body)
|
err := pb.Unmarshal(reqPB.ServerData)
|
||||||
return pb, err
|
return pb, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
http.go
18
http.go
|
@ -49,14 +49,16 @@ func whoSent(r *http.Request) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func logReqPB(pb *httppb.HttpRequest) {
|
func logReqPB(pb *httppb.HttpRequest) {
|
||||||
log.Info("LOG: httppb.HttpRequest Errors START:")
|
log.Info("LOG: httppb.HttpRequest START:")
|
||||||
log.Info(strings.Join(pb.Errors, "\n"))
|
for i, line := range strings.Join(pb.Log, "\n") {
|
||||||
log.Info("LOG: httppb.HttpRequest Errors END")
|
log.Infof("\t%d %s\n", i, line)
|
||||||
|
}
|
||||||
|
log.Info("LOG: httppb.HttpRequest END")
|
||||||
}
|
}
|
||||||
|
|
||||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
reqPB, err := httppb.ReqToPB(r)
|
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 {
|
if err != nil {
|
||||||
log.Info("something crazy err", err)
|
log.Info("something crazy err", err)
|
||||||
}
|
}
|
||||||
|
@ -85,7 +87,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if strings.HasPrefix(route, "/repos/") {
|
if strings.HasPrefix(route, "/repos/") {
|
||||||
pb, err := makeReposPB(reqPB)
|
pb, err := makeReposPB(reqPB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||||
}
|
}
|
||||||
result := gitpb.NewRepos()
|
result := gitpb.NewRepos()
|
||||||
switch route {
|
switch route {
|
||||||
|
@ -110,7 +112,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if strings.HasPrefix(route, "/patches/") {
|
if strings.HasPrefix(route, "/patches/") {
|
||||||
pb, err := makePatchesPB(reqPB)
|
pb, err := makePatchesPB(reqPB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||||
}
|
}
|
||||||
result := forgepb.NewPatches()
|
result := forgepb.NewPatches()
|
||||||
switch route {
|
switch route {
|
||||||
|
@ -141,7 +143,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if strings.HasPrefix(route, "/patchsets/") {
|
if strings.HasPrefix(route, "/patchsets/") {
|
||||||
pb, err := makePatchsetsPB(reqPB)
|
pb, err := makePatchsetsPB(reqPB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reqPB.Errors = append(reqPB.Errors, log.Sprintf("%v", err))
|
reqPB.Log = append(reqPB.Log, log.Sprintf("%v", err))
|
||||||
}
|
}
|
||||||
result := forgepb.NewPatchsets()
|
result := forgepb.NewPatchsets()
|
||||||
switch route {
|
switch route {
|
||||||
|
@ -153,7 +155,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if err := result.SendReply(w, reqPB); err != nil {
|
if err := result.SendReply(w, reqPB); err != nil {
|
||||||
log.Info("Oh well, Send to client failed. err =", err)
|
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()
|
me.forge.SavePatchsets()
|
||||||
// todo: logReq(reqPB)
|
// todo: logReq(reqPB)
|
||||||
logReqPB(reqPB)
|
logReqPB(reqPB)
|
||||||
|
|
Loading…
Reference in New Issue