old file gone
This commit is contained in:
parent
50a5695241
commit
7ea9732c8f
|
@ -5,6 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
|
@ -209,3 +210,20 @@ func handleBytes(bytes []byte) (*forgepb.Patchset, error) {
|
||||||
}
|
}
|
||||||
return pset, nil
|
return pset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func doRegister(newurl string) error {
|
||||||
|
var url string
|
||||||
|
url = me.urlbase + "/register?url=" + newurl
|
||||||
|
body, err := me.forge.HttpPost(url, nil)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("httpPost() failed:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
test := strings.TrimSpace(string(body))
|
||||||
|
for _, line := range strings.Split(test, "\n") {
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
log.Info("server returned:", line)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -1,3 +1,5 @@
|
||||||
|
// Copyright 2024 WIT.COM Inc Licensed GPL 3.0
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
// An app to submit patches for the 30 GO GUI repos
|
||||||
|
|
147
send.go
147
send.go
|
@ -1,147 +0,0 @@
|
||||||
// Copyright 2024 WIT.COM Inc Licensed GPL 3.0
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
|
||||||
func submitPatches(pset *forgepb.Patchset) error {
|
|
||||||
var url string
|
|
||||||
url = me.urlbase + "/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 := me.forge.HttpPost(url, msg)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("httpPost() failed:", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
test := strings.TrimSpace(string(body))
|
|
||||||
for _, line := range strings.Split(test, "\n") {
|
|
||||||
log.Info("got back:", line)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
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 nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
test := strings.TrimSpace(string(body))
|
|
||||||
return strings.Split(test, "\n"), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func lastPatch() string {
|
|
||||||
var url string
|
|
||||||
url = me.urlbase + "/patchsetlist"
|
|
||||||
body, err := me.forge.HttpPost(url, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("httpPost() failed:", err)
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
return parts[0]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func doRegister(newurl string) error {
|
|
||||||
var url string
|
|
||||||
url = me.urlbase + "/register?url=" + newurl
|
|
||||||
body, err := me.forge.HttpPost(url, nil)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("httpPost() failed:", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
test := strings.TrimSpace(string(body))
|
|
||||||
for _, line := range strings.Split(test, "\n") {
|
|
||||||
line = strings.TrimSpace(line)
|
|
||||||
log.Info("server returned:", line)
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
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
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
f.Close()
|
|
||||||
return pset, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendMasterDiff() {
|
|
||||||
pset, err := me.forge.MakeMasterPatchSet()
|
|
||||||
if err != nil {
|
|
||||||
badExit(err)
|
|
||||||
}
|
|
||||||
all := pset.Patches.SortByFilename()
|
|
||||||
for all.Scan() {
|
|
||||||
p := all.Next()
|
|
||||||
log.Info("read in patch:", p.Filename)
|
|
||||||
}
|
|
||||||
err = me.forge.SendPatchSet(pset)
|
|
||||||
if err != nil {
|
|
||||||
badExit(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
Loading…
Reference in New Issue