diff options
| author | Jeff Carr <[email protected]> | 2025-09-04 08:28:09 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-04 08:28:09 -0500 |
| commit | 680069d4ca65c75ce1d7d462d98ce7e9e4c8bfdc (patch) | |
| tree | c45dfb05f2282fc039318ac7395d929c1d632e8f /doPatch.go | |
| parent | b02060493197150ef20776cbf920abb81a3844b1 (diff) | |
a breath of fresh air. finally can remove all the old code.
Diffstat (limited to 'doPatch.go')
| -rw-r--r-- | doPatch.go | 64 |
1 files changed, 0 insertions, 64 deletions
@@ -4,8 +4,6 @@ package main import ( - "fmt" - "os" "path/filepath" "go.wit.com/lib/protobuf/forgepb" @@ -69,64 +67,9 @@ func doPatch() error { return nil } -func doPatchList() error { - openPatchsets() - if me.psets == nil { - return fmt.Errorf("Open Patchsets failed") - } - log.Info("got psets len", len(me.psets.Patchsets)) - all := me.psets.SortByName() - for all.Scan() { - pset := all.Next() - // log.Info("pset name =", pset.Name) - dumpPatchset(pset) - } - return nil -} - -func savePatchsets() error { - if me.psets == nil { - return fmt.Errorf("savePatchesets() can't save nil") - } - log.Info("savePatchsets() len =", me.psets.Len()) - data, err := me.psets.Marshal() - if err != nil { - log.Info("protobuf.Marshal() failed:", err) - return err - } - fullpath := filepath.Join(me.forge.GetConfigDir(), "patchsets.pb") - var pfile *os.File - pfile, err = os.OpenFile(fullpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - log.Info("Patchsets save failed:", err, fullpath) - return err - } - pfile.Write(data) - pfile.Close() - return nil -} - -func openPatchsets() { - fullpath := filepath.Join(me.forge.GetConfigDir(), "patchsets.pb") - data, err := os.ReadFile(fullpath) - if err != nil { - log.Info("Patchsets open failed:", err, fullpath) - return - } - - psets := new(forgepb.Patchsets) - err = psets.Unmarshal(data) - if err != nil { - log.Info("Unmarshal patchsets failed", err) - return - } - me.psets = psets -} - // returns bad if patches can not be applied // logic is not great here but it was a first pass func dumpPatchset(pset *forgepb.Patchset) bool { - // don't even bother to continue if we already know it's broken if pset.State == "BROKEN" { log.Printf("Patchset Name: %-24s Author: %s <%s> IS BAD\n", pset.Name, pset.GetGitAuthorName(), pset.GetGitAuthorEmail()) @@ -135,13 +78,6 @@ func dumpPatchset(pset *forgepb.Patchset) bool { log.Printf("Patchset Name: %-24s Author: %s <%s> IS GOOD\n", pset.Name, pset.GetGitAuthorName(), pset.GetGitAuthorEmail()) } - /* - log.Info("applyPatches() State", pset.State) - log.Info("applyPatches() COMMENT", pset.Comment) - log.Info("applyPatches() Branch Name", pset.GetStartBranchName()) - log.Info("applyPatches() Start Hash", pset.GetStartBranchHash()) - */ - var count int var bad int all := pset.Patches.SortByFilename() |
