repos.FindByName()

This commit is contained in:
Jeff Carr 2024-11-22 21:05:09 -06:00
parent 1735ae5826
commit d9b91402cf
2 changed files with 17 additions and 2 deletions

View File

@ -71,6 +71,9 @@ curl-setCurrent-go-wit-com-gui:
curl-setTargetVersion-virtigo-v0.1.1:
curl --silent http://localhost:9419/setTargetVersion?version=v0.1.1
curl-setTargetVersion-go-clone-v0.6:
curl --silent "http://localhost:9419/setTargetVersion?repo=go-clone&version=v0.6"
curl-incrementAllTargetVersions:
curl --silent http://localhost:9419/setAllTargetVersions

16
http.go
View File

@ -92,7 +92,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("version: " + version)
log.Info("comment: " + comment)
repo := me.repos.View.FindRepoByName(repoName)
repo := me.repos.View.FindByName(repoName)
if repo == nil {
log.Info("FindRepoByName() returned nil")
return
@ -120,11 +120,23 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
case "/setTargetVersion":
log.Info("repo: " + repoName)
log.Info("version: " + version)
if repoName != "" {
repo := me.repos.View.FindByName(repoName)
if repo == nil {
log.Info("could not find repo", repoName)
} else {
log.Info("setting target version", version)
repo.Status.SetTargetVersion(version)
}
return
}
if me.current == nil {
log.Info("me.current == nil")
return
}
me.current.Status.SetTargetVersion(version)
return
case "/setAllTargetVersions":
log.Info("version: " + version)
@ -141,7 +153,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
}
case "/whitelist":
repo := me.repos.View.FindRepoByName(repoName)
repo := me.repos.View.FindByName(repoName)
if repo == nil {
log.Info("FindRepoByName() returned nil")
return