summaryrefslogtreecommitdiff
path: root/doNormal.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-05 17:24:25 -0500
committerJeff Carr <[email protected]>2025-10-05 17:24:25 -0500
commit0d4dfc597ae17b072bd1b8ff971a30cd926dc556 (patch)
tree2eca83ef2985111a31e39977635a043495d13c6f /doNormal.go
parent7f32363769a10fb2bfdc835ec80e8cb7c167c824 (diff)
see if we can remove old user branches
Diffstat (limited to 'doNormal.go')
-rw-r--r--doNormal.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/doNormal.go b/doNormal.go
index 0a92a32..731fe3d 100644
--- a/doNormal.go
+++ b/doNormal.go
@@ -20,6 +20,10 @@ 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() bool {
me.forge.CheckDirtyQuiet()
@@ -35,6 +39,10 @@ func doNormal() bool {
continue
}
repo := me.forge.Repos.FindByFullPath(path)
+ if repo == nil {
+ log.Info("path deleted while running?", path)
+ continue
+ }
if stat.Err == ErrorLocalDevelBranch {
if argv.Fix {
bname := repo.GetDevelBranchName()
@@ -58,6 +66,9 @@ func doNormal() bool {
}
}
}
+ if stat.Err == ErrorLocalBehindDevel {
+ log.Info("NEED TO DELETE USER HERE IF NOTHING NEW", path)
+ }
// log.Infof("%-60s, %-60s %v %s\n", stat.Start, stat.End.String(), dur, path)
// log.Infof("%-30v %s %v\n", dur, path, stat.Err)
// log.Info("got path", path, stat.Err)
@@ -75,6 +86,10 @@ func doNormal() bool {
var ErrorLocalDevelBranch error = errors.New("devel branch problem")
var ErrorLocalMasterBranch error = errors.New("master branch problem")
+var ErrorNoUserBranch error = errors.New("no user branch")
+var ErrorNoDevelBranch error = errors.New("no devel branch")
+var ErrorNoMasterBranch error = errors.New("no master branch")
+var ErrorLocalBehindDevel error = errors.New("local behind devel")
// 99% of the time, the repos during development should be on your user branch.
// error out if it's not
@@ -142,6 +157,26 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
}
}
+ // check to see if the user branch is behind the devel branch
+ if repo.GetUserVersion() != repo.GetDevelVersion() {
+ uver := repo.NewCompareTag(repo.GetUserBranchName())
+ dver := repo.NewCompareTag(repo.GetDevelBranchName())
+ if uver == nil {
+ // make user here (should have already happened)
+ return ErrorNoUserBranch
+ }
+ if dver == nil {
+ // make dev here (should have already happened)
+ return ErrorNoDevelBranch
+ }
+ if uver.LessThan(dver) {
+ repo.State = "usr < dev"
+ // check if nothing new exists in user, then delete
+ return ErrorLocalBehindDevel
+ }
+ // everything is fine
+ }
+
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
log.Infof("changing to user(%s) branch: %s\n", repo.GetUserBranchName(), repo.FullPath)
repo.CheckoutUser()
@@ -149,6 +184,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
err = log.Errorf("now on user branch")
}
+ // hopefully this can be deprecated soon
if repo.Namespace != repo.GetGoPath() {
log.Info(repo.Namespace, repo.GetGoPath())
}