diff --git a/Makefile b/Makefile index fa6edc9..77c790d 100644 --- a/Makefile +++ b/Makefile @@ -49,10 +49,10 @@ redomod: curl-help: curl --silent http://localhost:9419/help -curl-list: +curl-list-changed: curl --silent http://localhost:9419/list?perfect=false -curl-list-readonly: +curl-list-include-readonly: curl --silent http://localhost:9419/list?readonly=true curl-gitpull-everypackage: @@ -64,6 +64,12 @@ curl-gitpull-helloworld: curl-gitpull-basicworld: curl --silent http://localhost:9419/gitpull?repo=go.wit.com/apps/basicworld +curl-release-helloworld: + curl --silent http://localhost:9419/release?repo=go.wit.com/apps/helloworld + +curl-release-gowit: + curl --silent http://localhost:9419/release?repo=go.wit.com/lib/gui/gowit + curl-file-for-go.wit.com: curl --silent http://localhost:9419/goweblist?readonly=true curl --silent http://localhost:9419/goweblist?readonly=true |sort > ~/go.wit.com.versions diff --git a/http.go b/http.go index caefadb..a3780ad 100644 --- a/http.go +++ b/http.go @@ -52,6 +52,11 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } + if route == "/release" { + simpleRelease(w, r) + return + } + if route == "/gitpull" { repoName := r.URL.Query().Get("repo") if repoName != "" { diff --git a/simpleRelease.go b/simpleRelease.go index c195301..684b634 100644 --- a/simpleRelease.go +++ b/simpleRelease.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "net/http" "strings" ) @@ -17,19 +18,39 @@ import ( func simpleRelease(w http.ResponseWriter, r *http.Request) { repoName := r.URL.Query().Get("repo") if repoName == "" { + msg(w, "url did not have repo variable") return } // git pull (or go-clone of it doesn't exist) repo := me.repos.View.FindRepoByName(repoName) if repo == nil { + msg(w, "repo unknown: " + repoName) return } header := repo.StandardHeader() if repo.CheckDirty() { msg(w, header+"skip dirty repo") - continue + return + } + if repo.State() == "PERFECT" { + msg(w, header+"already released") + return + } + + curName := repo.Status.GetCurrentBranchName() + mName := repo.Status.GetMasterBranchName() + if curName != mName { + // s := log.Sprintf("\trepo is not working from main branch", curName, "!=", mName) + s := fmt.Sprint("repo is not working from main branch ", curName, " != ", mName) + msg(w, s) + return } cmd := []string{"git", "pull", "-v"} msg(w, header+strings.Join(cmd, " ")) + if repo.Status.MergeUserToDevel() { + msg(w, "THINGS SEEM OK MergeUserToDevel() returned true.") + } else { + msg(w, "THINGS FAILED MergeUserToDevel() returned false") + } return }