diff options
Diffstat (limited to 'helperPatches.go')
| -rw-r--r-- | helperPatches.go | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/helperPatches.go b/helperPatches.go index bfc36f7..6bfd4c1 100644 --- a/helperPatches.go +++ b/helperPatches.go @@ -173,51 +173,34 @@ func findCommitBySubject(subject string) (string, error) { } // returns true if PB changed -func setNewCommitHash(patch *forgepb.Patch) bool { - // parts := strings.Fields(patch.Comment) - +func setNewCommitHash(patch *forgepb.Patch) error { repo := me.forge.FindByGoPath(patch.Namespace) if repo == nil { - log.Info("could not find repo", patch.Namespace) - return false + return log.Errorf("could not find repo %s", patch.Namespace) } comment := cleanSubject(patch.Comment) - if patch.NewHash == "" { - log.Info("init() new patch to 'na' ", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment) - patch.NewHash = "na" - return true + if patch.NewHash != "" { + return nil } os.Chdir(repo.GetFullPath()) newhash, err := findCommitBySubject(comment) if err != nil { - log.Info("patch: not found hash:", patch.CommitHash, patch.Namespace, comment, newhash, err) - return false + return log.Errorf("patch: not found hash: %s %s %s %s %v", patch.CommitHash, patch.Namespace, comment, newhash, err) } if patch.NewHash == newhash { // patch was already set - return false + return nil } - if patch.NewHash != "na" { + if patch.NewHash != "" { log.Infof("patch: hash MISMATCH %s old=%s new=%s name=%s\n", patch.Namespace, patch.NewHash, newhash, comment) - return false + return nil } patch.NewHash = newhash log.Info("patch: found hash:", patch.CommitHash, newhash, patch.Namespace, comment) - return true -} - -/* -func setNewCommitHashLoop(p *forgepb.Set) bool { - var done bool = true - for patch := range p.Patches.IterAll() { - setNewCommitHashLoop(patch) - } - - return done + return nil } -*/ func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) { for patch := range pset.Patches.IterAll() { @@ -251,7 +234,7 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) { continue } - if patch.NewHash != "na" { + if patch.NewHash != "" { log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment) continue } @@ -301,7 +284,7 @@ func findExpired() *forgepb.Patches { continue } - if patch.NewHash != "na" { + if patch.NewHash != "" { log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment) found.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice continue |
