summaryrefslogtreecommitdiff
path: root/applyPatch.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-27 22:27:19 -0600
committerJeff Carr <[email protected]>2024-12-27 22:27:19 -0600
commita957c22f8b63f390fc4289b93a84e921e5c3d64d (patch)
treebd497bd3a6e409176cd1b6cc985ed996c7703c89 /applyPatch.go
parent8b3be0ab42e68ab0616ff6e461dbe8b582b12d21 (diff)
start work on an applyPatch()
Diffstat (limited to 'applyPatch.go')
-rw-r--r--applyPatch.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/applyPatch.go b/applyPatch.go
new file mode 100644
index 0000000..9dccc6c
--- /dev/null
+++ b/applyPatch.go
@@ -0,0 +1,35 @@
+// Copyright 2024 WIT.COM Inc Licensed GPL 3.0
+
+package main
+
+import (
+ "os"
+
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+func applyPatches(pset *forgepb.Patchs) error {
+ all := pset.SortByFilename()
+ for all.Scan() {
+ p := all.Next()
+ log.Info("pset filename", p.Filename)
+ }
+ return nil
+}
+
+func readPatchFile(pbfile string) (*forgepb.Patchs, error) {
+ bytes, err := os.ReadFile(pbfile)
+ if err != nil {
+ log.Info("readfile error", pbfile, err)
+ return nil, err
+ }
+ var pset *forgepb.Patchs
+ pset = new(forgepb.Patchs)
+ err = pset.Unmarshal(bytes)
+ if err != nil {
+ log.Info("Unmarshal failed", pbfile, err)
+ return nil, err
+ }
+ return pset, nil
+}