summaryrefslogtreecommitdiff
path: root/applyPatch.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-13 05:32:19 -0500
committerJeff Carr <[email protected]>2025-09-13 05:32:19 -0500
commitf4d60d1fb952697c9de93534572d0aa108aa6506 (patch)
treeedd85f8b5448f0789258cea58fcc1681bb051c4a /applyPatch.go
parent72d728d4e7104274067bde712373504dd47c1780 (diff)
work on a new repo Scan() function
Diffstat (limited to 'applyPatch.go')
-rw-r--r--applyPatch.go70
1 files changed, 0 insertions, 70 deletions
diff --git a/applyPatch.go b/applyPatch.go
index 626a582..18077c9 100644
--- a/applyPatch.go
+++ b/applyPatch.go
@@ -12,39 +12,6 @@ func savePatchset(pset *forgepb.Patchset) error {
log.Info("savePatches() GIT_AUTHOR_EMAIL", pset.GetGitAuthorEmail())
log.Info("savePatches() Branch Name", pset.GetStartBranchName())
log.Info("savePatches() Start Hash", pset.GetStartBranchHash())
-
- var count int
- var bad int
- var lasterr error
- all := pset.Patches.SortByFilename()
- for all.Scan() {
- p := all.Next()
- basedir := filepath.Join(os.Getenv("FORGE_CONFIG"), "currentpatches")
- if fullname, err := savePatchFile(p, basedir); err != nil {
- log.Info(fullname, "save failed", err)
- bad += 1
- lasterr = err
- }
- count += 1
- }
- log.Info("pset has", count, "total patches, ", bad, "bad save patches")
- if bad == 0 {
- return lasterr
- }
- return nil
-}
-*/
-
-/*
-// re-run git CheckDirty() on everything
-func IsAnythingDirty() bool {
- doCheckDirtyAndConfigSave()
- found := me.forge.FindDirty()
- if found.Len() == 0 {
- return false
- } else {
- return true
- }
}
*/
@@ -62,43 +29,6 @@ func countCurrentPatches(repo *gitpb.Repo) int {
return len(result.Stdout)
}
-func savePatchFile(p *forgepb.Patch, basedir string) (string, error) {
- basepath, filename := filepath.Split(p.Filename)
- fulldir := filepath.Join(basedir, basepath)
- err := os.MkdirAll(fulldir, os.ModePerm)
- if err != nil {
- log.Info("applyPathces() MkdirAll failed for", fulldir)
- log.Info("applyPathces() MkdirAll failed err", err)
- return "", err
- }
- tmpname := filepath.Join(fulldir, filename)
- log.Info("pset filename FILENAME IS REAL?", tmpname)
- raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
- raw.Write(p.Data)
- raw.Close()
- return tmpname, nil
-}
-
-func readPatchFile(pbfile string) (*forgepb.Patchset, error) {
- bytes, err := os.ReadFile(pbfile)
- if err != nil {
- log.Info("readfile error", pbfile, err)
- return nil, err
- }
- return handleBytes(bytes)
-}
-
-func handleBytes(bytes []byte) (*forgepb.Patchset, error) {
- var pset *forgepb.Patchset
- pset = new(forgepb.Patchset)
- err := pset.Unmarshal(bytes)
- if err != nil {
- log.Info("Unmarshal failed", err)
- return nil, err
- }
- return pset, nil
-}
-
func doRegister(newurl string) error {
var url string
url = me.urlbase + "/register?url=" + newurl