Add an error page for unknown commits
This commit is contained in:
parent
0a49c0a84a
commit
552723cef1
3 changed files with 40 additions and 30 deletions
|
|
@ -14,7 +14,8 @@
|
||||||
conn "SELECT id FROM guix_revisions WHERE commit = $1 LIMIT 1"
|
conn "SELECT id FROM guix_revisions WHERE commit = $1 LIMIT 1"
|
||||||
(list commit))
|
(list commit))
|
||||||
(((id))
|
(((id))
|
||||||
id)))
|
id)
|
||||||
|
(() #f)))
|
||||||
|
|
||||||
(define (insert-guix-revision conn url commit store_path)
|
(define (insert-guix-revision conn url commit store_path)
|
||||||
(define insert
|
(define insert
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,22 @@
|
||||||
uri-query
|
uri-query
|
||||||
parse-query-string
|
parse-query-string
|
||||||
(cut assoc-ref <> "target_commit"))))
|
(cut assoc-ref <> "target_commit"))))
|
||||||
|
(let ((base-revision-id (commit->revision-id conn base-commit))
|
||||||
|
(target-revision-id (commit->revision-id conn target-commit)))
|
||||||
|
(cond
|
||||||
|
((eq? base-revision-id #f)
|
||||||
|
(apply render-html
|
||||||
|
(compare-unknown-commit base-commit)))
|
||||||
|
((eq? target-revision-id #f)
|
||||||
|
(apply render-html
|
||||||
|
(compare-unknown-commit target-commit)))
|
||||||
|
(else
|
||||||
(let-values
|
(let-values
|
||||||
(((base-packages-vhash target-packages-vhash)
|
(((base-packages-vhash target-packages-vhash)
|
||||||
(package-data->package-data-vhashes
|
(package-data->package-data-vhashes
|
||||||
(package-differences-data conn
|
(package-differences-data conn
|
||||||
(commit->revision-id conn base-commit)
|
base-revision-id
|
||||||
(commit->revision-id conn target-commit)))))
|
target-revision-id))))
|
||||||
(let* ((new-packages
|
(let* ((new-packages
|
||||||
(package-data-vhashes->new-packages base-packages-vhash
|
(package-data-vhashes->new-packages base-packages-vhash
|
||||||
target-packages-vhash))
|
target-packages-vhash))
|
||||||
|
|
@ -89,6 +99,6 @@
|
||||||
new-packages
|
new-packages
|
||||||
removed-packages
|
removed-packages
|
||||||
version-changes
|
version-changes
|
||||||
other-changes))))))
|
other-changes)))))))))
|
||||||
((GET path ...)
|
((GET path ...)
|
||||||
(render-static-asset request))))
|
(render-static-asset request))))
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#:use-module (srfi srfi-19)
|
#:use-module (srfi srfi-19)
|
||||||
#:export (index
|
#:export (index
|
||||||
compare
|
compare
|
||||||
unknown
|
compare-unknown-commit
|
||||||
error-page))
|
error-page))
|
||||||
|
|
||||||
(define* (header)
|
(define* (header)
|
||||||
|
|
@ -226,14 +226,13 @@
|
||||||
(td ,version))))
|
(td ,version))))
|
||||||
other-changes)))))))))
|
other-changes)))))))))
|
||||||
|
|
||||||
(define (unknown id)
|
(define (compare-unknown-commit commit)
|
||||||
(layout
|
(layout
|
||||||
#:body
|
#:body
|
||||||
`(,(header)
|
`(,(header)
|
||||||
(div (@ (class "container"))
|
(div (@ (class "container"))
|
||||||
(h1 "Patch not found")
|
(h1 "Unknown commit")
|
||||||
(p "There is no submission with id " (strong ,id))
|
(p "No known revision with commit " (strong (samp ,commit)))))))
|
||||||
(p (a (@ (href "/")) "Try another one?"))))))
|
|
||||||
|
|
||||||
(define (error-page message)
|
(define (error-page message)
|
||||||
(layout
|
(layout
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue