diff options
| -rw-r--r-- | doClean.go | 2 | ||||
| -rw-r--r-- | doMode.go | 4 | ||||
| -rw-r--r-- | doNormal.go | 36 |
3 files changed, 41 insertions, 1 deletions
@@ -75,6 +75,8 @@ func doClean() error { if err := me.forge.DoAllCheckoutMaster(); err != nil { // badExit(err) } + me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes + me.forge.SaveRepos() all := me.forge.Repos.SortByFullPath() for all.Scan() { @@ -22,10 +22,12 @@ func doMode() (string, error) { } start := time.Now() err := me.forge.DoAllCheckoutUser(argv.Force) + me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes + me.forge.SaveRepos() dur := time.Since(start) log.Printf("Checked out %d user braches in %s\n", me.forge.Repos.Len(), shell.FormatDuration(dur)) if err != nil { - me.sh.BadExit("not everything on user braches", err) + me.sh.BadExit("not everything is 'normal' yet", err) } setForgeMode(forgepb.ForgeMode_NORMAL) log.Info("normal mode on") 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()) } |
