aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-18 12:35:17 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-18 12:35:17 +0100
commiteb80905f0fbfd6fea20c6403c77e2460a700f9ad (patch)
tree6bb270c95250a3228b544e27e489ad59f7044f18
parent5124fbc471e860120f0ca1aa6cef7b50b03c0ece (diff)
downloaddata-service-eb80905f0fbfd6fea20c6403c77e2460a700f9ad.tar
data-service-eb80905f0fbfd6fea20c6403c77e2460a700f9ad.tar.gz
Add git-branches-with-repository-details-for-commit
To get git repository and git branch information suitable for the revision page.
-rw-r--r--guix-data-service/model/git-branch.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/guix-data-service/model/git-branch.scm b/guix-data-service/model/git-branch.scm
index 5af7218..64f07c4 100644
--- a/guix-data-service/model/git-branch.scm
+++ b/guix-data-service/model/git-branch.scm
@@ -1,8 +1,10 @@
(define-module (guix-data-service model git-branch)
#:use-module (squee)
#:use-module (srfi srfi-19)
+ #:use-module (guix-data-service model utils)
#:export (insert-git-branch-entry
git-branches-for-commit
+ git-branches-with-repository-details-for-commit
most-recent-commits-for-branch
all-branches-with-most-recent-commit))
@@ -28,6 +30,21 @@ ORDER BY datetime DESC")
(exec-query conn query (list commit)))
+(define (git-branches-with-repository-details-for-commit conn commit)
+ (define query
+ "
+SELECT git_repositories.label, git_repositories.url,
+ git_repositories.cgit_url_base,
+ git_branches.name, git_branches.datetime
+FROM git_branches
+INNER JOIN git_repositories
+ ON git_branches.git_repository_id = git_repositories.id
+WHERE git_branches.commit = $1")
+
+ (group-list-by-first-n-fields
+ 3
+ (exec-query conn query (list commit))))
+
(define* (most-recent-commits-for-branch conn branch-name
#:key
(limit 100)