From 92ff05cf6fe09578538bb7dde0769d2f72d018a6 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 5 Jan 2025 03:21:26 -0600 Subject: [PATCH] start adding logic to check the hashes --- applyPatch.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/applyPatch.go b/applyPatch.go index d4eec08..e08bc6c 100644 --- a/applyPatch.go +++ b/applyPatch.go @@ -16,13 +16,28 @@ func dumpPatchset(pset *forgepb.Patchs) error { log.Info("applyPatches() COMMENT", pset.Comment) log.Info("applyPatches() GIT_AUTHOR_NAME", pset.GetGitAuthorName()) log.Info("applyPatches() GIT_AUTHOR_EMAIL", pset.GetGitAuthorEmail()) + log.Info("applyPatches() Branch Name", pset.GetStartBranchName()) + log.Info("applyPatches() Start Hash", pset.GetStartBranchHash()) + + var count int all := pset.SortByFilename() for all.Scan() { p := all.Next() // log.Info("pset filename FILENAME IS REAL?", p.Filename, pset.Name, pset.Comment) - // basepath, filename := filepath.Split(p.Filename) - log.Info("pset p.Filename", p.Filename) + basepath, filename := filepath.Split(p.Filename) + repo := me.forge.FindByGoPath(basepath) + if repo == nil { + log.Info("can not apply patch! repo not found", basepath, filename) + continue + } + if repo.DevelHash() != p.StartHash { + log.Info("can not apply patch! devel hash mismatch", basepath, filename) + continue + } + log.Info("start:", p.StartHash, "end:", p.CommitHash, "file:", basepath, filename, "devel version", repo.GetDevelVersion()) + count += 1 } + log.Info("pset has", count, "patches") return nil }