check for the terrible situation of devel < master
This commit is contained in:
parent
11d1136797
commit
bb54c065ad
|
@ -6,6 +6,17 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// count all objects only in branch1
|
||||
func (repo *Repo) countDiffObjects(branch1, branch2 string) int {
|
||||
cmd := repo.ConstructGitDiffLog(branch1, branch2)
|
||||
r, err := repo.RunVerboseOnError(cmd)
|
||||
if err != nil {
|
||||
return -1
|
||||
}
|
||||
// log.Info("countDiffObjects()", cmd, len(r.Stdout), strings.Join(r.Stdout, " "))
|
||||
return len(r.Stdout)
|
||||
}
|
||||
|
||||
func (repo *Repo) setRepoState() {
|
||||
if repo == nil {
|
||||
return
|
||||
|
@ -23,7 +34,15 @@ func (repo *Repo) setRepoState() {
|
|||
}
|
||||
}
|
||||
if repo.GetDevelVersion() != repo.GetMasterVersion() {
|
||||
repo.State = "merge to main"
|
||||
b1 := repo.countDiffObjects(repo.GetMasterBranchName(), repo.GetDevelBranchName())
|
||||
if b1 == 0 {
|
||||
repo.State = "merge to main"
|
||||
// log.Info("master vs devel count is normal b1 == 0", b1)
|
||||
} else {
|
||||
repo.State = "DEVEL < MASTER"
|
||||
// log.Info("master vs devel count b1 != 0", b1)
|
||||
log.Info("SERIOUS ERROR. DEVEL BRANCH NEEDS MERGE FROM MASTER b1 ==", b1, repo.GetGoPath())
|
||||
}
|
||||
return
|
||||
}
|
||||
// if IsGoTagVersionGreater(oldtag string, newtag string) bool {
|
||||
|
|
Loading…
Reference in New Issue