more checks on merge to master
This commit is contained in:
parent
69eee08045
commit
b9d4f88abd
|
@ -144,6 +144,10 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
|
||||||
// don't switch braches if the user branch has uncommitted patches
|
// don't switch braches if the user branch has uncommitted patches
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if repo.GetDevelVersion() != repo.GetMasterVersion() {
|
||||||
|
// don't switch braches if the devel branch does not match master (needs merge)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if repo.GetCurrentBranchName() == repo.GetMasterBranchName() {
|
if repo.GetCurrentBranchName() == repo.GetMasterBranchName() {
|
||||||
// repo is already on master
|
// repo is already on master
|
||||||
return nil
|
return nil
|
||||||
|
|
32
doClean.go
32
doClean.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
|
@ -25,6 +24,9 @@ func doClean() error {
|
||||||
// skip this while in devel
|
// skip this while in devel
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
|
if repo.IsDirty() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if err := doCleanRepo(repo); err != nil {
|
if err := doCleanRepo(repo); err != nil {
|
||||||
badRepoExit(repo, err)
|
badRepoExit(repo, err)
|
||||||
}
|
}
|
||||||
|
@ -75,9 +77,11 @@ func doCleanRepo(repo *gitpb.Repo) error {
|
||||||
}
|
}
|
||||||
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote)
|
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote)
|
||||||
}
|
}
|
||||||
|
if argv.Clean.Force == nil {
|
||||||
if hasLocal {
|
if hasLocal {
|
||||||
return ErrorReposHasLocalBranches
|
return ErrorReposHasLocalBranches
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +119,8 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
||||||
|
|
||||||
// me.forge.Repos.Delete(repo)
|
// me.forge.Repos.Delete(repo)
|
||||||
me.forge.ConfigSave()
|
me.forge.ConfigSave()
|
||||||
os.Exit(0)
|
// os.Exit(0)
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branch.Name)) {
|
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branch.Name)) {
|
||||||
|
@ -154,7 +158,7 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
||||||
if argv.Clean.Force != nil {
|
if argv.Clean.Force != nil {
|
||||||
cmd := []string{"git", "branch", "-D", branch.Name}
|
cmd := []string{"git", "branch", "-D", branch.Name}
|
||||||
_, err := repo.RunVerbose(cmd)
|
_, err := repo.RunVerbose(cmd)
|
||||||
log.Info(err)
|
log.Info("THE GIT BRANCH DELETE ERROR IS:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,19 +169,23 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
||||||
|
|
||||||
func userToDevelRequiresGitPush(repo *gitpb.Repo, branchName string) error {
|
func userToDevelRequiresGitPush(repo *gitpb.Repo, branchName string) error {
|
||||||
devel := repo.GetDevelBranchName()
|
devel := repo.GetDevelBranchName()
|
||||||
b1 := countDiffObjects(repo, branchName, "origin/"+devel)
|
missing := countDiffObjects(repo, branchName, "origin/"+devel)
|
||||||
b2 := countDiffObjects(repo, "origin/"+devel, branchName)
|
b2 := countDiffObjects(repo, "origin/"+devel, branchName)
|
||||||
log.Info("user vs devel count", b1, b2)
|
log.Info("user vs devel count", missing, b2)
|
||||||
if b1 == 0 && b2 == 0 {
|
if missing == 0 && b2 == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if b1 != 0 {
|
if missing != 0 {
|
||||||
log.Info("user vs devel count b1 != 0, b2 ==", b1, b2)
|
log.Info("user vs devel count missing != 0, b2 ==", missing, b2)
|
||||||
log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", b1)
|
log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", missing)
|
||||||
// if argv.Examine.Fix != nil {
|
// if argv.Examine.Fix != nil {
|
||||||
// return gitPushStrict(repo, branchName)
|
// return gitPushStrict(repo, branchName)
|
||||||
// }
|
// }
|
||||||
return fmt.Errorf("user branch not clean to delete %d %d", b1, b2)
|
return fmt.Errorf("user branch not clean to delete %d %d", missing, b2)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("user branch not clean to delete. maybe it is? devel might be ahead of user branch. %d %d", b1, b2)
|
if missing == 0 {
|
||||||
|
log.Info("THIS MEANS THE LOCAL BRANCH IS OK TO DELETE missing =", missing)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return fmt.Errorf("user branch not clean to delete. maybe it is? devel might be ahead of user branch. %d %d", missing, b2)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue