From 1f977f6c125e10061610dd62c7287e6e9448dea5 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 19 Jul 2019 21:22:15 +0100 Subject: Improve how repositories and branches are handled Make the link between repositories and branches clearer, replacing the /branches and /branch pages by /repository/ and /repository/*/branch/* pages. --- guix-data-service/web/controller.scm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'guix-data-service/web/controller.scm') diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 8923da8..e49e0a7 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -682,11 +682,22 @@ (render-unknown-revision mime-types conn commit-hash))) - (('GET "branches") - (render-html - #:sxml (view-branches - (all-branches-with-most-recent-commit conn)))) - (('GET "branch" branch-name) + (('GET "repository" id) + (match (select-git-repository conn id) + ((label url cgit-url-base) + (render-html + #:sxml + (view-git-repository + id + label url cgit-url-base + (all-branches-with-most-recent-commit conn id)))) + (#f + (render-html + #:sxml (general-not-found + "Repository not found" + "") + #:code 404)))) + (('GET "repository" repository-id "branch" branch-name) (let ((parsed-query-parameters (parse-query-parameters request @@ -695,12 +706,15 @@ (limit_results ,parse-result-limit #:default 100))))) (render-html #:sxml (if (any-invalid-query-parameters? parsed-query-parameters) - (view-branch branch-name parsed-query-parameters '()) + (view-branch repository-id + branch-name parsed-query-parameters '()) (view-branch + repository-id branch-name parsed-query-parameters (most-recent-commits-for-branch conn + repository-id branch-name #:limit (assq-ref parsed-query-parameters 'limit_results) #:after-date (assq-ref parsed-query-parameters -- cgit v1.2.3