diff options
Diffstat (limited to 'helperPatches.go')
| -rw-r--r-- | helperPatches.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/helperPatches.go b/helperPatches.go index 3450452..ba0f37f 100644 --- a/helperPatches.go +++ b/helperPatches.go @@ -178,7 +178,6 @@ func setNewCommitHash(p *forgepb.Patchset) bool { return done } -/* func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) { for patch := range pset.Patches.IterAll() { comment := cleanSubject(patch.Comment) @@ -222,4 +221,18 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bo notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice } } -*/ + +func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) { + for patch := range pset.Patches.IterAll() { + comment := cleanSubject(patch.Comment) + + if found := notdone.FindByCommitHash(patch.CommitHash); found != nil { + log.Info("duplicate commit hash", patch.Namespace, "patch:", patch.NewHash, "commithash:", patch.CommitHash, comment) + continue + } + newhash, _ := findCommitByHash(patch.StartHash, comment) + + log.Info("adding patch:", patch.Namespace, patch.CommitHash, comment, newhash) + notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice + } +} |
