Improve select-job-for-commit
It now returns #f or a list, rather than the empty list or a nested list.
This commit is contained in:
parent
51204aefca
commit
6023aa8caf
4 changed files with 44 additions and 43 deletions
|
|
@ -1388,7 +1388,9 @@ GROUP BY 1, 2")
|
||||||
"SELECT id, commit, source, git_repository_id "
|
"SELECT id, commit, source, git_repository_id "
|
||||||
"FROM load_new_guix_revision_jobs WHERE commit = $1")
|
"FROM load_new_guix_revision_jobs WHERE commit = $1")
|
||||||
(list commit))))
|
(list commit))))
|
||||||
result))
|
(match result
|
||||||
|
(() #f)
|
||||||
|
((job) job))))
|
||||||
|
|
||||||
(define* (select-recent-job-events conn
|
(define* (select-recent-job-events conn
|
||||||
#:key (limit 8))
|
#:key (limit 8))
|
||||||
|
|
|
||||||
|
|
@ -1034,26 +1034,26 @@
|
||||||
(div (@ (class "container"))
|
(div (@ (class "container"))
|
||||||
(h1 "Unknown commit")
|
(h1 "Unknown commit")
|
||||||
,(if (invalid-query-parameter? base-commit)
|
,(if (invalid-query-parameter? base-commit)
|
||||||
(if (null? base-job)
|
(if base-job
|
||||||
`(p "No known revision with commit "
|
|
||||||
(strong (samp ,(invalid-query-parameter-value base-commit)))
|
|
||||||
".")
|
|
||||||
`(p "Revision "
|
`(p "Revision "
|
||||||
(a (@ (href
|
(a (@ (href
|
||||||
,(string-append "/revision/"
|
,(string-append "/revision/"
|
||||||
(invalid-query-parameter-value base-commit))))
|
(invalid-query-parameter-value base-commit))))
|
||||||
(strong (samp ,(invalid-query-parameter-value base-commit))))
|
(strong (samp ,(invalid-query-parameter-value base-commit))))
|
||||||
" is queued for processing."))
|
" is queued for processing.")
|
||||||
|
`(p "No known revision with commit "
|
||||||
|
(strong (samp ,(invalid-query-parameter-value base-commit)))
|
||||||
|
"."))
|
||||||
'())
|
'())
|
||||||
,(if (invalid-query-parameter? target-commit)
|
,(if (invalid-query-parameter? target-commit)
|
||||||
(if (null? target-job)
|
(if target-job
|
||||||
`(p "No known revision with commit "
|
|
||||||
(strong (samp ,(invalid-query-parameter-value target-commit)))
|
|
||||||
".")
|
|
||||||
`(p "Revision "
|
`(p "Revision "
|
||||||
(a (@ (href
|
(a (@ (href
|
||||||
,(string-append "/revision/"
|
,(string-append "/revision/"
|
||||||
(invalid-query-parameter-value target-commit))))
|
(invalid-query-parameter-value target-commit))))
|
||||||
(strong (samp ,(invalid-query-parameter-value target-commit))))
|
(strong (samp ,(invalid-query-parameter-value target-commit))))
|
||||||
" is queued for processing."))
|
" is queued for processing.")
|
||||||
|
`(p "No known revision with commit "
|
||||||
|
(strong (samp ,(invalid-query-parameter-value target-commit)))
|
||||||
|
"."))
|
||||||
'())))))
|
'())))))
|
||||||
|
|
|
||||||
|
|
@ -2147,36 +2147,35 @@ figure {
|
||||||
`(,(header)
|
`(,(header)
|
||||||
(div
|
(div
|
||||||
(@ (class "container"))
|
(@ (class "container"))
|
||||||
,@(match job
|
,@(if job
|
||||||
(()
|
`((div
|
||||||
`((h1 "Unknown revision")
|
(@ (class "row"))
|
||||||
(p "No known revision with commit "
|
(div
|
||||||
(strong (samp ,commit-hash)))))
|
(@ (class "col-md-12"))
|
||||||
((jobs ...)
|
(h1 (@ (style "white-space: nowrap;"))
|
||||||
`((div
|
"Revision " (samp ,commit-hash))))
|
||||||
(@ (class "row"))
|
|
||||||
(div
|
(div
|
||||||
(@ (class "col-md-12"))
|
(@ (class "row"))
|
||||||
(h1 (@ (style "white-space: nowrap;"))
|
(div
|
||||||
"Revision " (samp ,commit-hash))))
|
(@ (class "col-md-6"))
|
||||||
(div
|
(h2 "Packages")
|
||||||
(@ (class "row"))
|
(strong (@ (class "text-center")
|
||||||
(div
|
(style "font-size: 2em; display: block;"))
|
||||||
(@ (class "col-md-6"))
|
"Unknown")
|
||||||
(h2 "Packages")
|
|
||||||
(strong (@ (class "text-center")
|
,@(if (null? git-repositories-and-branches)
|
||||||
(style "font-size: 2em; display: block;"))
|
'()
|
||||||
"Unknown")
|
(view-revision/git-repositories
|
||||||
|
git-repositories-and-branches
|
||||||
|
commit-hash))
|
||||||
|
,@(view-revision/jobs-and-events jobs-and-events))
|
||||||
|
(div
|
||||||
|
(@ (class "col-md-6"))
|
||||||
|
(h3 "Derivations")
|
||||||
|
(strong (@ (class "text-center")
|
||||||
|
(style "font-size: 2em; display: block;"))
|
||||||
|
"Unknown"))))
|
||||||
|
`((h1 "Unknown revision")
|
||||||
|
(p "No known revision with commit "
|
||||||
|
(strong (samp ,commit-hash)))))))))
|
||||||
|
|
||||||
,@(if (null? git-repositories-and-branches)
|
|
||||||
'()
|
|
||||||
(view-revision/git-repositories
|
|
||||||
git-repositories-and-branches
|
|
||||||
commit-hash))
|
|
||||||
,@(view-revision/jobs-and-events jobs-and-events))
|
|
||||||
(div
|
|
||||||
(@ (class "col-md-6"))
|
|
||||||
(h3 "Derivations")
|
|
||||||
(strong (@ (class "text-center")
|
|
||||||
(style "font-size: 2em; display: block;"))
|
|
||||||
"Unknown"))))))))))
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
(exec-query conn "TRUNCATE guix_revisions CASCADE")
|
(exec-query conn "TRUNCATE guix_revisions CASCADE")
|
||||||
|
|
||||||
(test-equal "select-job-for-commit works"
|
(test-equal "select-job-for-commit works"
|
||||||
'()
|
#f
|
||||||
(select-job-for-commit conn "does not exist"))
|
(select-job-for-commit conn "does not exist"))
|
||||||
|
|
||||||
(exec-query conn "TRUNCATE guix_revisions CASCADE")
|
(exec-query conn "TRUNCATE guix_revisions CASCADE")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue