summaryrefslogtreecommitdiff
path: root/applyPatch.go
diff options
context:
space:
mode:
Diffstat (limited to 'applyPatch.go')
-rw-r--r--applyPatch.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/applyPatch.go b/applyPatch.go
index f1beba9..5ad452d 100644
--- a/applyPatch.go
+++ b/applyPatch.go
@@ -12,34 +12,33 @@ import (
)
// saves the patches in ~/.config/forge/currentpatches/
-func savePatchset(pset *forgepb.Patchset) bool {
- log.Info("applyPatches() NAME", pset.Name)
- 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())
+func savePatchset(pset *forgepb.Patchset) error {
+ log.Info("savePatches() NAME", pset.Name)
+ log.Info("savePatches() COMMENT", pset.Comment)
+ log.Info("savePatches() GIT_AUTHOR_NAME", pset.GetGitAuthorName())
+ 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 := me.forge.GetGoSrc()
basedir := filepath.Join(os.Getenv("FORGE_CONFIG"), "currentpatches")
if fullname, err := savePatchFile(p, basedir); err != nil {
log.Info(fullname, "save failed", err)
- continue
- } else {
bad += 1
+ lasterr = err
}
count += 1
}
log.Info("pset has", count, "total patches, ", bad, "bad save patches")
if bad == 0 {
- return true
+ return lasterr
}
- return false
+ return nil
}
// returns bad if patches can not be applied