common patch submit code
This commit is contained in:
parent
66802a287f
commit
11bf5481c7
22
doCommit.go
22
doCommit.go
|
@ -11,7 +11,7 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func doCommit() {
|
func doCommit() error {
|
||||||
if argv.All {
|
if argv.All {
|
||||||
found := me.forge.CheckDirty()
|
found := me.forge.CheckDirty()
|
||||||
var newpatches bool
|
var newpatches bool
|
||||||
|
@ -26,7 +26,7 @@ func doCommit() {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
if newpatches {
|
if newpatches {
|
||||||
patchSubmitAndExit()
|
return doPatchSubmit()
|
||||||
}
|
}
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
@ -69,23 +69,7 @@ func doCommit() {
|
||||||
badExit(err)
|
badExit(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
patchSubmitAndExit()
|
return doPatchSubmit()
|
||||||
}
|
|
||||||
|
|
||||||
func patchSubmitAndExit() {
|
|
||||||
_, err := me.forge.SubmitDevelPatchSet("forge auto commit")
|
|
||||||
if err != nil {
|
|
||||||
// TRY different URL
|
|
||||||
me.forge.SetForgeURL("https://forge.grid.wit.com/")
|
|
||||||
log.Info("GOING TO TRY AGAIN", me.forge.GetForgeURL())
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = me.forge.SubmitDevelPatchSet("forge auto commit")
|
|
||||||
if err != nil {
|
|
||||||
badExit(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
okExit("git commit ok. forge done")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func doCommitRepo(repo *gitpb.Repo) error {
|
func doCommitRepo(repo *gitpb.Repo) error {
|
||||||
|
|
27
doPatch.go
27
doPatch.go
|
@ -31,31 +31,36 @@ func isPatchingSafe() bool {
|
||||||
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
log.Info("forge requres a 'normal' state to work with patches")
|
log.Info("This patch command is not safe to run now")
|
||||||
log.Info("you must run:")
|
log.Info("you must reset the state of your git repositories. Run:")
|
||||||
log.Info("")
|
log.Info("")
|
||||||
log.Info("forge normal")
|
log.Info("forge normal")
|
||||||
log.Info("")
|
log.Info("")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// submit's current working patches
|
||||||
|
func doPatchSubmit() error {
|
||||||
|
pset, err := me.forge.MakeDevelPatchSet("testing")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, _, err = pset.Patches.HttpPostVerbose(myServer(), "new")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func doPatch() error {
|
func doPatch() error {
|
||||||
if argv.Patch.Repos != nil {
|
if argv.Patch.Repos != nil {
|
||||||
dumpDirtyRepos()
|
dumpDirtyRepos()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isPatchingSafe() {
|
if argv.Patch.Submit != nil {
|
||||||
return log.Errorf("not safe to work on patches")
|
return doPatchSubmit()
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Patch.Submit != nil {
|
if !isPatchingSafe() {
|
||||||
pset, err := me.forge.MakeDevelPatchSet("testing")
|
return log.Errorf("not safe to work on patches")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
pset.Patches.HttpPostVerbose(myServer(), "new")
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Patch.Get != nil {
|
if argv.Patch.Get != nil {
|
||||||
|
|
Loading…
Reference in New Issue