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"
|
||||
(list commit))
|
||||
(((id))
|
||||
id)))
|
||||
id)
|
||||
(() #f)))
|
||||
|
||||
(define (insert-guix-revision conn url commit store_path)
|
||||
(define insert
|
||||
|
|
|
|||
|
|
@ -65,12 +65,22 @@
|
|||
uri-query
|
||||
parse-query-string
|
||||
(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
|
||||
(((base-packages-vhash target-packages-vhash)
|
||||
(package-data->package-data-vhashes
|
||||
(package-differences-data conn
|
||||
(commit->revision-id conn base-commit)
|
||||
(commit->revision-id conn target-commit)))))
|
||||
base-revision-id
|
||||
target-revision-id))))
|
||||
(let* ((new-packages
|
||||
(package-data-vhashes->new-packages base-packages-vhash
|
||||
target-packages-vhash))
|
||||
|
|
@ -89,6 +99,6 @@
|
|||
new-packages
|
||||
removed-packages
|
||||
version-changes
|
||||
other-changes))))))
|
||||
other-changes)))))))))
|
||||
((GET path ...)
|
||||
(render-static-asset request))))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#:use-module (srfi srfi-19)
|
||||
#:export (index
|
||||
compare
|
||||
unknown
|
||||
compare-unknown-commit
|
||||
error-page))
|
||||
|
||||
(define* (header)
|
||||
|
|
@ -226,14 +226,13 @@
|
|||
(td ,version))))
|
||||
other-changes)))))))))
|
||||
|
||||
(define (unknown id)
|
||||
(define (compare-unknown-commit commit)
|
||||
(layout
|
||||
#:body
|
||||
`(,(header)
|
||||
(div (@ (class "container"))
|
||||
(h1 "Patch not found")
|
||||
(p "There is no submission with id " (strong ,id))
|
||||
(p (a (@ (href "/")) "Try another one?"))))))
|
||||
(h1 "Unknown commit")
|
||||
(p "No known revision with commit " (strong (samp ,commit)))))))
|
||||
|
||||
(define (error-page message)
|
||||
(layout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue