diff options
author | Christopher Baines <mail@cbaines.net> | 2019-05-18 12:35:17 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-05-18 12:35:17 +0100 |
commit | eb80905f0fbfd6fea20c6403c77e2460a700f9ad (patch) | |
tree | 6bb270c95250a3228b544e27e489ad59f7044f18 | |
parent | 5124fbc471e860120f0ca1aa6cef7b50b03c0ece (diff) | |
download | data-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.scm | 17 |
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) |