From 817107dc160071ca3fe1c196335d6747271f3c99 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 5 Sep 2025 01:24:34 -0500 Subject: [PATCH] more patch stuff --- http.go | 2 +- humanTable.go | 6 +++++- init.go | 1 + patchset.Get.go | 9 +++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/http.go b/http.go index 9d5fff0..f983220 100644 --- a/http.go +++ b/http.go @@ -21,7 +21,7 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) { usr, _ := user.Current() req.Header.Set("author", usr.Username) - req.Header.Set("hostname", "fixme:hostname") + req.Header.Set("hostname", f.hostname) client := &http.Client{} resp, err := client.Do(req) diff --git a/humanTable.go b/humanTable.go index d70baf1..2b25728 100644 --- a/humanTable.go +++ b/humanTable.go @@ -342,7 +342,11 @@ func (psets *Patchsets) PrintTable() { var countCONTENTS int var countPARTS int for x, pset := range psets.GetPatchsets() { - log.Info(pset.Uuid, pset.Name) + log.Info(pset.Uuid, pset.Name, pset.State) + if pset.State == "DONE" { + // old patchset + continue + } cId := log.Sprintf("%d", x) countCONTENTS += 1 for i, p := range pset.Patches.GetPatches() { diff --git a/init.go b/init.go index 1dc1fb6..5205e4b 100644 --- a/init.go +++ b/init.go @@ -178,6 +178,7 @@ func (f *Forge) setenv() { f.repoPB = os.Getenv("FORGE_REPOPB") f.forgeURL = os.Getenv("FORGE_URL") f.patchDir = os.Getenv("FORGE_PATCHDIR") + f.hostname = os.Getenv("HOSTNAME") if os.Getenv("FORGE_GOWORK") == "true" { f.goWork = true } diff --git a/patchset.Get.go b/patchset.Get.go index 5570b87..c650a82 100644 --- a/patchset.Get.go +++ b/patchset.Get.go @@ -28,6 +28,14 @@ func (f *Forge) GetPatches() error { return nil } +func (f *Forge) expireAllPatchsets() { + all := f.Patchsets.All() + for all.Scan() { + pset := all.Next() + pset.State = "DONE" + } +} + func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) { var foundnew bool @@ -36,6 +44,7 @@ func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) { pset := all.Next() found := f.Patchsets.FindByUuid(pset.Uuid) if found == nil { + f.expireAllPatchsets() log.Info("new patchset", pset.Name, pset.Uuid) pset.State = "new" foundnew = true