summaryrefslogtreecommitdiff
path: root/helperPatches.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-25 16:24:08 -0500
committerJeff Carr <[email protected]>2025-09-25 16:24:08 -0500
commitd331af80e098dcead00b19b36eb607b0ad862690 (patch)
treec8d1a45401d795b5643bec853ce75bd9f82d3f5e /helperPatches.go
parent92be907bce6fd28a1e49a54b318c2b44ffefaa2a (diff)
delete applied patches from PB filev0.25.30
Diffstat (limited to 'helperPatches.go')
-rw-r--r--helperPatches.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/helperPatches.go b/helperPatches.go
index 88c301a..7bee637 100644
--- a/helperPatches.go
+++ b/helperPatches.go
@@ -172,6 +172,32 @@ func findCommitBySubject(subject string) (string, error) {
return "", fmt.Errorf("no commit found for subject: %s", subject)
}
+func isPatchIdApplied(patch *forgepb.Patch) error {
+ repo := me.forge.FindByGoPath(patch.Namespace)
+ if repo == nil {
+ return log.Errorf("could not find repo %s", patch.Namespace)
+ }
+
+ comment := cleanSubject(patch.Comment)
+
+ os.Chdir(repo.GetFullPath())
+ newhash, err := findCommitBySubject(comment)
+ if err != nil {
+ return log.Errorf("patch: not found hash: %s %s %s %s %v", patch.CommitHash, patch.Namespace, comment, newhash, err)
+ }
+
+ patchId, err := repo.FindPatchId(newhash)
+ if err != nil {
+ return err
+ }
+
+ patch.PatchId = patchId
+ patch.NewHash = newhash
+
+ log.Info("patch: found hash:", patch.CommitHash, newhash, patch.Namespace, comment)
+ return nil
+}
+
// returns true if PB changed
func setNewCommitHash(patch *forgepb.Patch) error {
repo := me.forge.FindByGoPath(patch.Namespace)