start checking the "normal" state every time
This commit is contained in:
parent
1087b39f9c
commit
d99eb81385
|
@ -62,6 +62,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
|
|||
|
||||
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||
configSave = true
|
||||
log.Info("crapnuts")
|
||||
repo.CheckoutUser()
|
||||
repo.Reload()
|
||||
return log.Errorf("now on user branch")
|
||||
|
|
10
doPatch.go
10
doPatch.go
|
@ -12,7 +12,11 @@ import (
|
|||
|
||||
func doPatchInit() {
|
||||
if me.forge.Patchsets != nil {
|
||||
log.Info("IGNORE: patches already initalized")
|
||||
if me.forge.Patchsets.Len() == 0 {
|
||||
// log.Info("IGNORE: patches are empty")
|
||||
} else {
|
||||
log.Info("IGNORE: patches already initalized len =", me.forge.Patchsets.Len())
|
||||
}
|
||||
}
|
||||
if err := me.forge.LoadPatchsets(); err != nil {
|
||||
log.Info("patches failed to open", err)
|
||||
|
@ -82,6 +86,10 @@ func doPatch() error {
|
|||
me.forge.Patchsets.PrintTable()
|
||||
// return doPatchList()
|
||||
applied := findApplied()
|
||||
if applied.Len() == 0 {
|
||||
log.Info("no patches have to appled to the devel branch yet")
|
||||
return nil
|
||||
}
|
||||
// for patch := range applied.IterAll() {
|
||||
// log.Info("SEND APPLIED: newhash:", patch.NewHash, "commithash:", patch.CommitHash, "patch", patch.Namespace)
|
||||
// }
|
||||
|
|
15
main.go
15
main.go
|
@ -99,6 +99,7 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Checkout != nil {
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_MASTER
|
||||
if err := doCheckout(); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
@ -120,6 +121,7 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Clean != nil {
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_CLEAN
|
||||
if argv.Clean.Repo != "" {
|
||||
log.Info("only looking at repo:", argv.Clean.Repo)
|
||||
okExit("")
|
||||
|
@ -140,11 +142,24 @@ func main() {
|
|||
if argv.Normal != nil {
|
||||
if doNormal() {
|
||||
log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len())
|
||||
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
|
||||
log.Infof("Forge has set the mode to 'Normal'\n")
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_NORMAL
|
||||
me.forge.ConfigSave()
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
|
||||
// if you are in "normal" mode, always run normal every time to catch accidental errors
|
||||
// for example, if you accidentally changed branches from your user branch
|
||||
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
||||
if doNormal() {
|
||||
log.Infof("all %d repos are still normal\n", me.forge.Repos.Len())
|
||||
}
|
||||
}
|
||||
|
||||
if argv.Dirty != nil {
|
||||
doDirty()
|
||||
okExit("")
|
||||
|
|
Loading…
Reference in New Issue