summaryrefslogtreecommitdiff
path: root/doNormal.go
diff options
context:
space:
mode:
Diffstat (limited to 'doNormal.go')
-rw-r--r--doNormal.go57
1 files changed, 43 insertions, 14 deletions
diff --git a/doNormal.go b/doNormal.go
index d182a82..a8e53f8 100644
--- a/doNormal.go
+++ b/doNormal.go
@@ -6,6 +6,7 @@ package main
// checks that repos are in a "normal" state
import (
+ "errors"
"fmt"
"path/filepath"
"strings"
@@ -20,18 +21,47 @@ import (
"google.golang.org/protobuf/proto"
)
-// This does lots of "sanity" checking. It digs around and tries to resolve as much as possible
-// It'll dig into the actual git patchId to match patches since the normal hashes don't match
-// when you are applying with 'git am'. It tries to be thourogh (I can't spell)
-func doNormal() (string, error) {
- if doNormalOld() {
- if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
- me.forge.SetMode(forgepb.ForgeMode_NORMAL)
- me.forge.Config.Save()
- }
- s := fmt.Sprintf("all your %d repos are in a normal stete for development", me.forge.Repos.Len())
- return s, nil
+// when in normal and requestiong "normal" again, do more stuff
+func doNormalAll() (string, error) {
+ var s string
+ var err error
+
+ me.curpatches = forgepb.NewPatches()
+ me.curpatches.Filename = config.Get("curpatches")
+ if me.curpatches.Filename == "" {
+ panic("config failed. no 'curpatches' set in ~/.config/forge/config.text")
+ }
+ if err := me.curpatches.Load(); err != nil {
+ me.curpatches.Save()
+ me.curpatches.Save()
+ log.Info(err)
+ panic("no file")
+ // return
+ // // THIS IS NEEDED? NOTSURE
+ me.curpatches = forgepb.NewPatches()
+ me.curpatches.Filename = config.Get("curpatches")
+ me.curpatches.Save()
+ }
+
+ psets := forgepb.NewSets()
+ newpb, _, _ := psets.HttpPostVerbose(myServer(), "get")
+ footer, err := doPatchGet(newpb)
+ if footer == "" {
+ log.Info(footer)
}
+
+ // forces patching to be done in 'NORMAL' mode
+ // forge is too new to be able to handle anything else
+ if !isPatchingSafe() {
+ return "not safe", errors.New("not safe to work on patches")
+ }
+
+ s, err = doPatchProcess()
+ return s, err
+}
+
+// try to switch to "Normal" mode
+func doNormalAttempt() (string, error) {
start := time.Now()
err := me.forge.DoAllCheckoutUser(argv.Force)
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
@@ -41,13 +71,12 @@ func doNormal() (string, error) {
if err != nil {
return "not everything is 'normal' yet", err
}
- me.forge.SetMode(forgepb.ForgeMode_NORMAL)
- me.forge.Config.Save()
log.Info("normal mode on")
return "normal mode on", nil
}
-func doNormalOld() bool {
+// a quick check run each time when in "normal" mode
+func doNormalStatus() bool {
me.forge.CheckDirtyQuiet()
var count int