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
|
||||
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() {
|
||||
// repo is already on master
|
||||
return nil
|
||||
|
|
32
doClean.go
32
doClean.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
|
||||
|
@ -25,6 +24,9 @@ func doClean() error {
|
|||
// skip this while in devel
|
||||
// continue
|
||||
}
|
||||
if repo.IsDirty() {
|
||||
continue
|
||||
}
|
||||
if err := doCleanRepo(repo); err != nil {
|
||||
badRepoExit(repo, err)
|
||||
}
|
||||
|
@ -75,9 +77,11 @@ func doCleanRepo(repo *gitpb.Repo) error {
|
|||
}
|
||||
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote)
|
||||
}
|
||||
if argv.Clean.Force == nil {
|
||||
if hasLocal {
|
||||
return ErrorReposHasLocalBranches
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -115,8 +119,8 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
|||
|
||||
// me.forge.Repos.Delete(repo)
|
||||
me.forge.ConfigSave()
|
||||
os.Exit(0)
|
||||
return err
|
||||
// os.Exit(0)
|
||||
return nil
|
||||
}
|
||||
|
||||
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 {
|
||||
cmd := []string{"git", "branch", "-D", branch.Name}
|
||||
_, err := repo.RunVerbose(cmd)
|
||||
log.Info(err)
|
||||
log.Info("THE GIT BRANCH DELETE ERROR IS:", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -165,19 +169,23 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
|||
|
||||
func userToDevelRequiresGitPush(repo *gitpb.Repo, branchName string) error {
|
||||
devel := repo.GetDevelBranchName()
|
||||
b1 := countDiffObjects(repo, branchName, "origin/"+devel)
|
||||
missing := countDiffObjects(repo, branchName, "origin/"+devel)
|
||||
b2 := countDiffObjects(repo, "origin/"+devel, branchName)
|
||||
log.Info("user vs devel count", b1, b2)
|
||||
if b1 == 0 && b2 == 0 {
|
||||
log.Info("user vs devel count", missing, b2)
|
||||
if missing == 0 && b2 == 0 {
|
||||
return nil
|
||||
}
|
||||
if b1 != 0 {
|
||||
log.Info("user vs devel count b1 != 0, b2 ==", b1, b2)
|
||||
log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", b1)
|
||||
if missing != 0 {
|
||||
log.Info("user vs devel count missing != 0, b2 ==", missing, b2)
|
||||
log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", missing)
|
||||
// if argv.Examine.Fix != nil {
|
||||
// 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