diff options
| author | Jeff Carr <[email protected]> | 2025-01-29 09:06:19 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-29 12:18:16 -0600 |
| commit | f2281a2102d5821d337029a9f36395b955f3ec80 (patch) | |
| tree | eca9f11c59c8c3ca7dda42eee2d73b4a529a3c66 /send.go | |
| parent | b047d706795074a63cbbfd771bdd6787fa80a9ab (diff) | |
start a 'view patch' window
Diffstat (limited to 'send.go')
| -rw-r--r-- | send.go | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -96,6 +96,8 @@ func doRegister(newurl string) error { return nil } +// gets the patch +// todo: move to forgepb func getPatch(pbfile string) (*forgepb.Patchset, error) { url := me.urlbase + "/patchsetget?filename=" + pbfile log.Info("getPatch() url", url) @@ -112,6 +114,25 @@ func getPatch(pbfile string) (*forgepb.Patchset, error) { log.Info("Unmarshal failed", err) return nil, err } + return pset, nil +} + +func savePatch(pbfile string) (*forgepb.Patchset, error) { + url := me.urlbase + "/patchsetget?filename=" + pbfile + log.Info("getPatch() url", url) + body, err := me.forge.HttpPost(url, nil) + if err != nil { + log.Info("httpPost() failed:", err) + return nil, err + } + log.Info("getPatch() len(body)", len(body)) + var pset *forgepb.Patchset + pset = new(forgepb.Patchset) + err = pset.Unmarshal(body) + if err != nil { + log.Info("Unmarshal failed", err) + return nil, err + } filename := filepath.Join("/tmp", pbfile) f, _ := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) f.Write(body) |
