summaryrefslogtreecommitdiff
path: root/doPatch.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-06 21:58:55 -0500
committerJeff Carr <[email protected]>2025-10-06 21:58:55 -0500
commitabf2951624b39f7633a938a0c8dc681fac1257aa (patch)
tree2413fcde026568d2bb348630e775548ecad910f5 /doPatch.go
parenta45fd1beed715914b36baf6c9dfa157801b75d6d (diff)
patchId wasn't been checked correctly
Diffstat (limited to 'doPatch.go')
-rw-r--r--doPatch.go105
1 files changed, 60 insertions, 45 deletions
diff --git a/doPatch.go b/doPatch.go
index 50a3c5d..77904ed 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -4,10 +4,11 @@
package main
import (
+ "os"
"path/filepath"
- "go.wit.com/lib/fhelp"
"go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -109,67 +110,81 @@ func doPatch() error {
func doPatchList() error {
// if nothing selected, list the patches
- var changed bool
- newpatches := new(forgepb.Set)
- newpatches.Patches = forgepb.NewPatches()
+ // var changed bool
+ // newpatches := new(forgepb.Set)
+ // newpatches.Patches = forgepb.NewPatches()
for pset := range me.forge.Patchsets.IterAll() {
- pset.PrintTable()
+ // pset.PrintTable()
if pset.Patches.Len() == 0 {
log.Info("pset is empty")
me.forge.Patchsets.Delete(pset)
- changed = true
+ // changed = true
continue
}
for patch := range pset.Patches.IterAll() {
- changed = true
- if err := isPatchIdApplied(patch); err == nil {
- log.Infof("%s patchId already applied %s\n", patch.PatchId, patch.Filename)
- pset.Patches.Delete(patch)
- changed = true
+ if patch.CommitHash != "5b277e7686974d2195586d5f5b82838ee9ddb036" {
continue
}
-
- if patch.NewHash == "" || patch.NewHash == "na" {
- if newpatches.Patches.AppendByPatchId(patch) {
- log.Infof("%s patchId added here\n", patch.PatchId)
- } else {
- log.Infof("%s patchId already here\n", patch.PatchId)
+ if len(patch.Data) > 0 {
+ patchid, hash, err := gitpb.FindPatchIdFromGitAm(patch.Data)
+ // gitpb.FindPatchIdFromGitAmBroken(patch.Data) // doesn't os.Exec()
+ log.Info("patch", patchid, hash, patch.CommitHash, patch.Filename, len(patch.Data), err)
+ // log.Info(string(patch.Data))
+ os.Exit(0)
+ }
+ /*
+ changed = true
+ if err := isPatchIdApplied(patch); err == nil {
+ log.Infof("%s patchId already applied %s\n", patch.PatchId, patch.Filename)
pset.Patches.Delete(patch)
changed = true
+ continue
}
- } else {
- if err := setNewCommitHash(patch); err != nil {
- log.Infof("%s bad check on patch failure %v\n", patch.Filename, err)
- return err
+
+ if patch.NewHash == "" || patch.NewHash == "na" {
+ if newpatches.Patches.AppendByPatchId(patch) {
+ log.Infof("%s patchId added here\n", patch.PatchId)
+ } else {
+ log.Infof("%s patchId already here\n", patch.PatchId)
+ pset.Patches.Delete(patch)
+ changed = true
+ }
+ } else {
+ if err := setNewCommitHash(patch); err != nil {
+ log.Infof("%s bad check on patch failure %v\n", patch.Filename, err)
+ return err
+ }
+ log.Infof("%s %s newhash set already here\n", patch.PatchId, patch.NewHash)
}
- log.Infof("%s %s newhash set already here\n", patch.PatchId, patch.NewHash)
- }
+ */
}
}
- log.Info("NEW PATCHES TABLE")
- newpatches.PrintTable()
- for patch := range newpatches.Patches.IterAll() {
- if err := setNewCommitHash(patch); err == nil {
- log.Info("newhash set already here", patch.PatchId, patch.NewHash)
- changed = true
- continue
- }
- log.Infof("%s is new\n", patch.Filename)
- repo := me.forge.FindByGoPath(patch.Namespace)
- if repo == nil {
- log.Info("\tCould not find namespace:", patch.Namespace)
- continue
- }
- if fhelp.QuestionUser("apply this patch?") {
- newhash, err := applyAndTrackPatch(repo, patch)
- log.Info("apply results:", newhash, err)
+ /*
+ log.Info("NEW PATCHES TABLE")
+ newpatches.PrintTable()
+ for patch := range newpatches.Patches.IterAll() {
+ if err := setNewCommitHash(patch); err == nil {
+ log.Info("newhash set already here", patch.PatchId, patch.NewHash)
+ changed = true
+ continue
+ }
+ log.Infof("%s is new\n", patch.Filename)
+ repo := me.forge.FindByGoPath(patch.Namespace)
+ if repo == nil {
+ log.Info("\tCould not find namespace:", patch.Namespace)
+ continue
+ }
+ if fhelp.QuestionUser("apply this patch?") {
+ newhash, err := applyAndTrackPatch(repo, patch)
+ log.Info("apply results:", newhash, err)
+ }
}
- }
- if changed {
- if err := me.forge.SavePatchsets(); err != nil {
- log.Warn("savePatchsets() failed", err)
+ if changed {
+ if err := me.forge.SavePatchsets(); err != nil {
+ log.Warn("savePatchsets() failed", err)
+ }
}
- }
+ */
return nil
/*
if newpatches.Len() != 0 {