do verify handling here
This commit is contained in:
parent
fb05b3eab0
commit
a1f751beb2
39
doNormal.go
39
doNormal.go
|
@ -6,11 +6,14 @@ package main
|
|||
// checks that repos are in a "normal" state
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/fhelp"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -29,6 +32,15 @@ func doNormal() bool {
|
|||
if stat.Err == nil {
|
||||
continue
|
||||
}
|
||||
repo := me.forge.Repos.FindByFullPath(path)
|
||||
if stat.Err == ErrorLocalDevelBranch {
|
||||
bname := repo.GetMasterBranchName()
|
||||
s := fmt.Sprintf("repair the %s branch on %s", bname, repo.FullPath)
|
||||
if fhelp.QuestionUser(s) {
|
||||
repo.RunVerbose([]string{"git", "branch", "-D", bname})
|
||||
repo.RunVerbose([]string{"git", "checkout", bname})
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
|
@ -44,6 +56,9 @@ func doNormal() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
var ErrorLocalDevelBranch error = errors.New("devel branch problem")
|
||||
var ErrorLocalMasterBranch error = errors.New("master branch problem")
|
||||
|
||||
// 99% of the time, the repos during development should be on your user branch.
|
||||
// error out if it's not
|
||||
// this checks to see if a devel and user branch exist
|
||||
|
@ -93,8 +108,28 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
|
|||
}
|
||||
repo.MakeLocalDevelBranch()
|
||||
|
||||
repo.VerifyRemoteAndLocalBranches(repo.GetDevelBranchName())
|
||||
repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName())
|
||||
if !repo.VerifyRemoteAndLocalBranches(repo.GetDevelBranchName()) {
|
||||
return ErrorLocalDevelBranch
|
||||
/*
|
||||
bname := repo.GetDevelBranchName()
|
||||
s := fmt.Sprintf("repair the %s branch on %s", bname, repo.FullPath)
|
||||
if fhelp.QuestionUser(s) {
|
||||
repo.RunVerbose([]string{"git", "branch", "-D", bname})
|
||||
repo.RunVerbose([]string{"git", "checkout", bname})
|
||||
}
|
||||
*/
|
||||
}
|
||||
if !repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName()) {
|
||||
return ErrorLocalMasterBranch
|
||||
/*
|
||||
bname := repo.GetMasterBranchName()
|
||||
s := fmt.Sprintf("repair the %s branch on %s", bname, repo.FullPath)
|
||||
if fhelp.QuestionUser(s) {
|
||||
repo.RunVerbose([]string{"git", "branch", "-D", bname})
|
||||
repo.RunVerbose([]string{"git", "checkout", bname})
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||
log.Infof("changing to user(%s) branch: %s\n", repo.GetUserBranchName(), repo.FullPath)
|
||||
|
|
Loading…
Reference in New Issue