list patches and get a patch set works

This commit is contained in:
Jeff Carr 2024-12-14 14:09:15 -06:00
parent 268e05f108
commit be3841578c
4 changed files with 40 additions and 0 deletions

View File

@ -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/"

View File

@ -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"`

View File

@ -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()

31
send.go
View File

@ -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 {