summaryrefslogtreecommitdiff
path: root/doNormal.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-08-28 10:11:31 -0500
committerJeff Carr <[email protected]>2025-08-28 10:11:31 -0500
commit9bcf2d968c7565516ee55c4473670a888f36b3f7 (patch)
tree1277b4a773e5a065670379cc5b41fc9aa53ac5a1 /doNormal.go
parenta21c117e5bff4dac56634ba6ad3b166a0fba2da8 (diff)
add "forge normal" to reset things to default development statev0.22.129
Diffstat (limited to 'doNormal.go')
-rw-r--r--doNormal.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/doNormal.go b/doNormal.go
new file mode 100644
index 0000000..c85c8df
--- /dev/null
+++ b/doNormal.go
@@ -0,0 +1,37 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// checks that repos are in a "normal" state
+
+import (
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+func doNormal() bool {
+ if allerr := me.forge.RillRepos(checkNormalRepoState); len(allerr) != 0 {
+ log.Info("Some repos are not in a 'normal' state. error count =", len(allerr))
+ for repo, err := range allerr {
+ log.Info("repo not normal", repo.GetFullPath(), err)
+ }
+ return false
+ }
+ return true
+}
+
+// 99% of the time, the repos during development should be on your user branch.
+// error out if it's not
+// this checks to see if a devel and user branch exist
+// this needs to run each time in case repos were added manually by the user
+// this also verifies that
+func checkNormalRepoState(repo *gitpb.Repo) error {
+ if _, err := repo.MakeLocalDevelBranch(); err != nil {
+ return err
+ }
+ if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
+ return repo.CheckoutUser()
+ }
+ return nil
+}