summaryrefslogtreecommitdiff
path: root/doCommon.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-05 06:14:06 -0600
committerJeff Carr <[email protected]>2025-01-05 06:14:06 -0600
commit6ded56a13ac7f0e419023e52adae8bd989fe4f94 (patch)
tree963bfa6e0ba5b6dbc2fc733c6eaaf0f8ef5566ae /doCommon.go
parent2c7e15ccfacd065029b5de4360288d72815bc907 (diff)
more overall checking for branch changes
Diffstat (limited to 'doCommon.go')
-rw-r--r--doCommon.go49
1 files changed, 46 insertions, 3 deletions
diff --git a/doCommon.go b/doCommon.go
index a085587..110d3ab 100644
--- a/doCommon.go
+++ b/doCommon.go
@@ -4,6 +4,7 @@ import (
"time"
"go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -55,15 +56,34 @@ func doCheckDirtyAndConfigSave() {
}
func IsEverythingOnDevel() bool {
+ me.found = new(gitpb.Repos)
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if repo.GetCurrentBranchName() != repo.GetDevelBranchName() {
- log.Info(repo.GetFullPath(), repo.GetCurrentBranchName(), repo.GetDevelBranchName())
- return false
+ // log.Info(repo.GetFullPath(), repo.GetCurrentBranchName(), repo.GetDevelBranchName())
+ me.found.AppendUniqueGoPath(repo)
}
}
- return true
+ if len(me.found.Repos) == 0 {
+ return true
+ }
+ return false
+}
+
+func IsEverythingOnUser() bool {
+ me.found = new(gitpb.Repos)
+ all := me.forge.Repos.SortByFullPath()
+ for all.Scan() {
+ repo := all.Next()
+ if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
+ me.found.AppendUniqueGoPath(repo)
+ }
+ }
+ if len(me.found.Repos) == 0 {
+ return true
+ }
+ return false
}
func doGitReset() {
@@ -101,3 +121,26 @@ func checkoutBranches(repo *gitpb.Repo) error {
}
return nil
}
+
+func doAllCheckoutDevel() bool {
+ me.forge.CheckoutDevel()
+ me.forge = forgepb.Init()
+ if !IsEverythingOnDevel() {
+ log.Info("switching to devel branch failed")
+ doCobol()
+ badExit(nil)
+ return false
+ }
+ return true
+}
+
+func doAllCheckoutUser() bool {
+ me.forge.CheckoutUser()
+ me.forge = forgepb.Init()
+ if !IsEverythingOnUser() {
+ log.Info("switching to user branch failed")
+ doCobol()
+ return false
+ }
+ return true
+}