recieve a gitpb.Repos protobuf

This commit is contained in:
Jeff Carr 2025-07-02 12:53:34 -05:00
parent 61cc346f6c
commit fde780869e
3 changed files with 25 additions and 1 deletions

View File

@ -27,7 +27,7 @@ install:
log:
@#systemctl status forged.service
journalctl -f -xeu forged.service
journalctl -n 100 -f -xeu forged.service
enable:
systemctl enable forged.service

View File

@ -9,6 +9,7 @@ import (
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@ -164,3 +165,18 @@ func savePatchset(w http.ResponseWriter, msg []byte) {
regfile.Write(msg)
regfile.Close()
}
func lookupRepos(w http.ResponseWriter, msg []byte) (*gitpb.Repos, error) {
log.Info("proto.Unmarshal() try message len", len(msg))
m := gitpb.NewRepos()
if err := m.Unmarshal(msg); err != nil {
log.Info("gitpb.Repos.Unmarshal() failed. len(msg) =", len(msg), err)
return m, err
}
log.Info("GOT repos:", len(msg))
for repo := range m.IterAll() {
log.Infof("repo:%s,%s\n", repo.Namespace, repo.FullPath)
// fmt.Fprintln(w, "repo:", repo.FullPath, repo.Namespace)
}
return m, nil
}

View File

@ -38,10 +38,18 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
listPatchsets(w)
return
}
if route == "/patchset" {
savePatchset(w, msg)
return
}
if route == "/lookup" {
// repos, err := lookupRepos(w, msg)
lookupRepos(w, msg)
return
}
if route == "/GetPatchsets" {
doSendPatchsets(w)
return