summaryrefslogtreecommitdiff
path: root/send.go
diff options
context:
space:
mode:
Diffstat (limited to 'send.go')
-rw-r--r--send.go30
1 files changed, 17 insertions, 13 deletions
diff --git a/send.go b/send.go
index cf389ce..80073b1 100644
--- a/send.go
+++ b/send.go
@@ -35,27 +35,31 @@ func sendPatches(pset *forgepb.Patchset) error {
return nil
}
-func listPatches() error {
+func listPatches() ([]string, error) {
var url string
url = me.urlbase + "/patchsetlist"
body, err := me.forge.HttpPost(url, nil)
if err != nil {
log.Info("httpPost() failed:", err)
- return err
+ return nil, err
}
- var last string
+ /*
+ var last string
+ test := strings.TrimSpace(string(body))
+ for _, line := range strings.Split(test, "\n") {
+ log.Info("patchset:", line)
+ last = strings.TrimSpace(line)
+ }
+ parts := strings.Fields(last)
+ if len(parts) == 0 {
+ return fmt.Errorf("listPatches() there are no patchsets at this time")
+ }
+ getPatch(parts[0])
+ return nil
+ */
test := strings.TrimSpace(string(body))
- for _, line := range strings.Split(test, "\n") {
- log.Info("patchset:", line)
- last = strings.TrimSpace(line)
- }
- parts := strings.Fields(last)
- if len(parts) == 0 {
- return fmt.Errorf("listPatches() there are no patchsets at this time")
- }
- getPatch(parts[0])
- return nil
+ return strings.Split(test, "\n"), nil
}
func lastPatch() string {