summaryrefslogtreecommitdiff
path: root/patchset.Send.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-06 15:22:31 -0500
committerJeff Carr <[email protected]>2025-09-06 15:22:31 -0500
commitbf031595e359548f0a0d7197140195f1486c168e (patch)
tree13805532605edb8e978389735c5b28f982186324 /patchset.Send.go
parentc0b9518c0db72aa40e4e37e3d90341b32b364bd5 (diff)
patchset http routines
Diffstat (limited to 'patchset.Send.go')
-rw-r--r--patchset.Send.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/patchset.Send.go b/patchset.Send.go
index 31e10ef..ab79718 100644
--- a/patchset.Send.go
+++ b/patchset.Send.go
@@ -11,6 +11,27 @@ import (
"go.wit.com/log"
)
+func (f *Forge) SendPatches(what string, p *Patches) (*Patches, error) {
+ route := "/patches/" + what
+ data, err := p.Marshal()
+ if err != nil {
+ return nil, err
+ }
+ log.Infof("pb: len=%d, err=%v\n", len(data), err)
+ newdata, err := f.HttpPost("rm this", route, data)
+ if err != nil {
+ return nil, err
+ }
+ if newdata == nil {
+ return nil, err
+ }
+ if len(newdata) == 0 {
+ return nil, err
+ }
+ log.Info("TODO: Unmarshal() to patches", len(newdata))
+ return nil, err
+}
+
// makes a new patches protobuf. These are all the patches on your machine.
func NewPatches() *Patches {
x := new(Patches)
@@ -47,19 +68,18 @@ func (f *Forge) SubmitDevelPatchSet(name string) (*Patchset, error) {
}
func (f *Forge) submitPatchset(pset *Patchset) error {
- var url string
- url = f.forgeURL + "patchset"
msg, err := pset.Marshal()
if err != nil {
log.Info("proto.Marshal() failed:", err)
return err
}
log.Info("proto.Marshal() msg len", len(msg))
- body, err := f.HttpPost(url, msg)
+ body, err := f.HttpPost("rm this", "patchset", msg)
if err != nil {
log.Info("httpPost() failed:", err)
return err
}
+ log.Info("HTTP: proto.Marshal() sent", len(msg), "ok and got back", len(body))
newpb := NewPatches()
if err := newpb.Unmarshal(body); err != nil {
@@ -83,19 +103,18 @@ func (f *Forge) submitPatchset(pset *Patchset) error {
}
func (f *Forge) SubmitPatchesNew(pset *Patches, urlpath string) (*Patches, error) {
- var url string
- url = f.forgeURL + "oldpatchset"
msg, err := pset.Marshal()
if err != nil {
log.Info("proto.Marshal() failed:", err)
return nil, err
}
log.Info("proto.Marshal() msg len", len(msg))
- body, err := f.HttpPost(url, msg)
+ body, err := f.HttpPost("rm this", urlpath, msg)
if err != nil {
log.Info("httpPost() failed:", err)
return nil, err
}
+ log.Info("HTTP: proto.Marshal() sent", len(msg), "ok and got back", len(body))
newpb := NewPatches()
if err := newpb.Unmarshal(body); err != nil {