summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helperPatches.go64
1 files changed, 8 insertions, 56 deletions
diff --git a/helperPatches.go b/helperPatches.go
index 846ad46..fbc9032 100644
--- a/helperPatches.go
+++ b/helperPatches.go
@@ -6,7 +6,6 @@ package main
import (
"bytes"
"fmt"
- "os"
"os/exec"
"regexp"
"strings"
@@ -36,51 +35,6 @@ import (
}
*/
-func setPatchsetState(p *forgepb.Set) {
- var bad bool
- var good bool
- var done bool = true
-
- all := p.Patches.All()
- for all.Scan() {
- patch := all.Next()
- // log.Info("patch:", patch.StartHash, patch.CommitHash, patch.Namespace, patch.Filename)
- repo := me.forge.FindByGoPath(patch.Namespace)
- if repo == nil {
- log.Info("could not find repo", patch.Namespace)
- bad = true
- continue
- }
- if _, err := repo.GetHashName(patch.CommitHash); err == nil {
- // this patch has been applied
- patch.Applied = true
- done = true
- continue
- }
- if name, err := repo.GetHashName(patch.StartHash); err == nil {
- // it might be possible to apply this patch
- log.Info("patch may be good:", patch.Namespace, name, patch.CommitHash, patch.Filename)
- good = true
- } else {
- // probably screwed up git trees
- log.Info("patch with unknown origin:", patch.Namespace, name, err, patch.CommitHash, patch.Filename)
- bad = true
- }
- }
- if bad {
- p.State = "BAD"
- return
- }
- if good {
- p.State = "TRY"
- return
- }
- if done {
- p.State = "DONE"
- return
- }
-}
-
func cleanSubject(line string) string {
// Regular expression to remove "Subject:" and "[PATCH...]" patterns
re := regexp.MustCompile(`(?i)^Subject:\s*(\[\s*PATCH[^\]]*\]\s*)?`)
@@ -134,6 +88,7 @@ func findCommitBySubject(subject string) (string, error) {
return "", fmt.Errorf("no commit found for subject: %s", subject)
}
+/*
// returns true if PB changed
func setNewCommitHash(patch *forgepb.Patch) error {
repo := me.forge.FindByGoPath(patch.Namespace)
@@ -160,7 +115,9 @@ func setNewCommitHash(patch *forgepb.Patch) error {
log.Info("patch: found hash:", patch.CommitHash, newhash, patch.Namespace, comment)
return nil
}
+*/
+/*
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
for patch := range pset.Patches.IterAll() {
comment := cleanSubject(patch.Comment)
@@ -174,7 +131,9 @@ func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
}
}
+*/
+/*
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
for patch := range pset.Patches.IterAll() {
comment := cleanSubject(patch.Comment)
@@ -218,7 +177,9 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
}
}
+*/
+/*
func findExpired() *forgepb.Patches {
var pset *forgepb.Patches
for found := range me.forge.Patchsets.IterAll() {
@@ -255,20 +216,11 @@ func findExpired() *forgepb.Patches {
found.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
continue
}
- /*
-
- newhash, err = findCommitBySubject(comment)
- if err == nil {
- patch.NewHash = newhash
- log.Info("patch: found hash:", patch.Namespace, "commit patch", patch.CommitHash, "new hash", newhash, "start hash", patch.StartHash, comment)
- found.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
- continue
- }
- */
}
return found
}
+*/
func findApplied() *forgepb.Patches {
var pset *forgepb.Patches