aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-07-27 09:12:25 +0100
committerChristopher Baines <mail@cbaines.net>2019-07-27 09:12:25 +0100
commit75226a1499117d551e859491cc7abcf634d09a98 (patch)
tree87e3bab32e239641411950ba74983cff5ebd7f9a
parent7f8ffb4beaf25b02bea601b2a42cea1dc8720e0a (diff)
downloaddata-service-75226a1499117d551e859491cc7abcf634d09a98.tar
data-service-75226a1499117d551e859491cc7abcf634d09a98.tar.gz
Fix the latest-processed-revision pages
-rw-r--r--guix-data-service/model/git-branch.scm7
-rw-r--r--guix-data-service/web/controller.scm14
2 files changed, 12 insertions, 9 deletions
diff --git a/guix-data-service/model/git-branch.scm b/guix-data-service/model/git-branch.scm
index 5fe1bb5..37c83d6 100644
--- a/guix-data-service/model/git-branch.scm
+++ b/guix-data-service/model/git-branch.scm
@@ -96,20 +96,21 @@ WHERE git_branches.commit = $1")
query
(list branch-name git-repository-id))))
-(define* (latest-processed-commit-for-branch conn branch-name)
+(define* (latest-processed-commit-for-branch conn repository-id branch-name)
(define query
(string-append
"SELECT git_branches.commit "
"FROM git_branches "
"INNER JOIN guix_revisions ON git_branches.commit = guix_revisions.commit "
- "WHERE git_branches.name = $1 "
+ "WHERE guix_revisions.git_repository_id = $1 AND "
+ "git_branches.git_repository_id = $1 AND git_branches.name = $2 "
"ORDER BY datetime DESC "
"LIMIT 1"))
(match (exec-query
conn
query
- (list branch-name))
+ (list repository-id branch-name))
(((commit-hash))
commit-hash)
('()
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 3dec210..929d6e3 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -716,9 +716,9 @@
'after_date)
#:before-date (assq-ref parsed-query-parameters
'before_date)))))))
- (('GET "branch" branch-name "latest-processed-revision")
+ (('GET "repository" repository-id "branch" branch-name "latest-processed-revision")
(let ((commit-hash
- (latest-processed-commit-for-branch conn branch-name)))
+ (latest-processed-commit-for-branch conn repository-id branch-name)))
(if commit-hash
(render-view-revision mime-types
conn
@@ -730,9 +730,9 @@
(render-unknown-revision mime-types
conn
commit-hash))))
- (('GET "branch" branch-name "latest-processed-revision" "packages")
+ (('GET "repository" repository-id "branch" branch-name "latest-processed-revision" "packages")
(let ((commit-hash
- (latest-processed-commit-for-branch conn branch-name)))
+ (latest-processed-commit-for-branch conn repository-id branch-name)))
(if commit-hash
(let ((parsed-query-parameters
(guard-against-mutually-exclusive-query-parameters
@@ -761,14 +761,15 @@
(samp ,branch-name))
#:header-link
(string-append
+ "/repository/" repository-id
"/branch/" branch-name
"/latest-processed-revision")))
(render-unknown-revision mime-types
conn
commit-hash))))
- (('GET "branch" branch-name "latest-processed-revision" "package" name version)
+ (('GET "repository" repository-id "branch" branch-name "latest-processed-revision" "package" name version)
(let ((commit-hash
- (latest-processed-commit-for-branch conn branch-name)))
+ (latest-processed-commit-for-branch conn repository-id branch-name)))
(if commit-hash
(render-revision-package mime-types
conn
@@ -780,6 +781,7 @@
(samp ,branch-name))
#:header-link
(string-append
+ "/repository/" repository-id
"/branch/" branch-name
"/latest-processed-revision"))
(render-unknown-revision mime-types