summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-14 14:09:15 -0600
committerJeff Carr <[email protected]>2024-12-14 14:09:15 -0600
commitbe3841578cb466f02bbc4ea1e13e024b5a77e85d (patch)
tree9fa2e4f2e7ac9d2cb37e955ba4717605d73a2fad
parent268e05f1082c081f6afbc42c5f8df83aec7c6848 (diff)
-rw-r--r--Makefile3
-rw-r--r--argv.go1
-rw-r--r--main.go5
-rw-r--r--send.go31
4 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6e2872f..440a160 100644
--- a/Makefile
+++ b/Makefile
@@ -63,3 +63,6 @@ patches: install
patches-localhost: install
forge --do-patches --url "http://localhost:2233/"
+
+patches-list: install
+ forge --list-patches --url "http://localhost:2233/"
diff --git a/argv.go b/argv.go
index 2ca704c..d731903 100644
--- a/argv.go
+++ b/argv.go
@@ -23,6 +23,7 @@ type args struct {
DoInstall bool `arg:"--do-install" help:"try to install every binary package"`
DoRedoGoMod bool `arg:"--do-RedoGoMod" help:"remake all the go.sum and go.mod files"`
DoPatchSet bool `arg:"--do-patches" help:"make patch set"`
+ ListPatchSet bool `arg:"--list-patches" help:"make patch set"`
DoGui bool `arg:"--do-gui" help:"test the gui"`
DryRun bool `arg:"--dry-run" help:"show what would be run"`
Fix bool `arg:"--fix" help:"fix config, save config & exit"`
diff --git a/main.go b/main.go
index 5a9c673..0ebe1bc 100644
--- a/main.go
+++ b/main.go
@@ -81,6 +81,11 @@ func main() {
okExit("patches")
}
+ if argv.ListPatchSet {
+ listPatches()
+ okExit("patches")
+ }
+
// do the gui at the very end
if argv.DoGui {
doGui()
diff --git a/send.go b/send.go
index 4a1046f..b04b503 100644
--- a/send.go
+++ b/send.go
@@ -32,6 +32,37 @@ func sendPatches(pset *forgepb.Patchs) error {
return nil
}
+func listPatches() error {
+ var url string
+ url = me.urlbase + "/patchsetlist"
+ body, err := httpPost(url, nil)
+ if err != nil {
+ log.Info("httpPost() failed:", err)
+ return err
+ }
+
+ var last string
+ test := strings.TrimSpace(string(body))
+ for _, line := range strings.Split(test, "\n") {
+ log.Info("patchset:", line)
+ last = strings.TrimSpace(line)
+ }
+ getPatch(last)
+ return nil
+}
+
+func getPatch(pbfile string) error {
+ url := me.urlbase + "/patchsetget?filename=" + pbfile
+ log.Info("getPatch() url", url)
+ body, err := httpPost(url, nil)
+ if err != nil {
+ log.Info("httpPost() failed:", err)
+ return err
+ }
+ log.Info("getPatch() len(body)", len(body))
+ return nil
+}
+
func sendDevelDiff() {
pset, err := me.forge.MakeDevelPatchSet()
if err != nil {