summaryrefslogtreecommitdiff
path: root/doPatch.go
diff options
context:
space:
mode:
Diffstat (limited to 'doPatch.go')
-rw-r--r--doPatch.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/doPatch.go b/doPatch.go
index badf5f5..efbc8ec 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -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()