diff options
Diffstat (limited to 'doPatch.go')
| -rw-r--r-- | doPatch.go | 105 |
1 files changed, 60 insertions, 45 deletions
@@ -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 { |
