Finally implement commit page.
gitile/handler.scm
98 | 98 | (show (style (project-commits project-name (get-repo project-name) ref) | |
99 | 99 | project-name ref))) | |
100 | 100 | ((project-name "commit" ref) | |
101 | - | (show (style not-yet-page project-name ref))) | |
101 | + | (show (style (project-commit project-name (get-repo project-name) ref) | |
102 | + | project-name ref))) | |
102 | 103 | ((project-name "tags") | |
103 | 104 | (show (style (project-tags project-name (get-repo project-name)) | |
104 | 105 | project-name "-"))) |
gitile/pages.scm
31 | 31 | project-files | |
32 | 32 | project-index | |
33 | 33 | project-commits | |
34 | + | project-commit | |
34 | 35 | project-tags)) | |
35 | 36 | ||
36 | 37 | (define not-yet-page | |
… | |||
127 | 128 | (commit (last-commit repo ref))) | |
128 | 129 | (commit-infobox repository-name commit))) | |
129 | 130 | ||
130 | - | (define* (commit-infobox repository-name commit #:key (open? #f)) | |
131 | + | (define* (commit-infobox repository-name commit #:key (open? #f) (detailed? #f)) | |
131 | 132 | `(div (@ (class "commit-info")) | |
132 | 133 | (p (img (@ (src ,(author-image (commit-author commit)))))) | |
133 | 134 | (div (@ (class "commit")) | |
… | |||
191 | 192 | (if (null? tags) | |
192 | 193 | `((p "This project has no tags yet.")) | |
193 | 194 | `((p "There are tags, but we don't know how to show them yet."))))) | |
195 | + | ||
196 | + | (define (project-commit repository-name repo ref) | |
197 | + | (let* ((commit (get-commit repo ref)) | |
198 | + | (parent (commit-parent commit))) | |
199 | + | `(div | |
200 | + | ,(commit-infobox repository-name commit #:open? #t) | |
201 | + | (p (@ (class "commit-summary")) ,(commit-summary commit)) | |
202 | + | (pre (@ (class "diff")) | |
203 | + | ,(diff->string (diff-tree-to-tree repo (commit-tree parent) | |
204 | + | (commit-tree commit))))))) |
gitile/repo.scm
26 | 26 | get-files | |
27 | 27 | get-file-content | |
28 | 28 | get-commits | |
29 | + | get-commit | |
29 | 30 | get-description | |
30 | 31 | last-commit | |
31 | 32 | ||
… | |||
142 | 143 | (let* ((config (repository-config repo)) | |
143 | 144 | (options (get-options config))) | |
144 | 145 | (assoc-ref options "gitweb.description"))) | |
146 | + | ||
147 | + | (define (get-commit repo hash) | |
148 | + | (let* ((oid (ref->oid repo hash)) | |
149 | + | (commit (commit-lookup repo oid))) | |
150 | + | commit)) |
guix.scm
18 | 18 | (use-modules (guix packages) | |
19 | 19 | (guix licenses) | |
20 | 20 | (guix build-system gnu) | |
21 | + | (guix git-download) | |
21 | 22 | (gnu packages autotools) | |
22 | 23 | (gnu packages gnupg) | |
23 | 24 | (gnu packages guile) | |
24 | 25 | (gnu packages guile-xyz) | |
25 | 26 | (gnu packages pkg-config) | |
27 | + | (gnu packages texinfo) | |
26 | 28 | (gnu packages tls)) | |
27 | 29 | ||
30 | + | (define my-guile-git | |
31 | + | (package | |
32 | + | (inherit guile-git) | |
33 | + | (source (origin | |
34 | + | (method git-fetch) | |
35 | + | (uri (git-reference | |
36 | + | (url "https://gitlab.com/roptat/guile-git") | |
37 | + | (commit "8b752feec04138429a973080cc0170a376b73cda"))) | |
38 | + | (file-name (git-file-name "guile-git" "0.4.0.8b752fe")) | |
39 | + | (sha256 | |
40 | + | (base32 | |
41 | + | "11k3h1spy2dlvc2lq9hpr0yypm9pav3y7d46dmwca31dlchj4jz8")))) | |
42 | + | (native-inputs | |
43 | + | `(("autoconf" ,autoconf) | |
44 | + | ("automake" ,automake) | |
45 | + | ("texinfo" ,texinfo) | |
46 | + | ,@(package-native-inputs guile-git))))) | |
47 | + | ||
28 | 48 | (package | |
29 | 49 | (name "gitile") | |
30 | 50 | (version "0.1") | |
31 | 51 | (source #f) | |
32 | 52 | (build-system gnu-build-system) | |
33 | - | (inputs | |
34 | - | `(("guile-git" ,guile-git) | |
53 | + | (propagated-inputs | |
54 | + | `(("guile-git" ,my-guile-git) | |
35 | 55 | ("guile-gcrypt" ,guile-gcrypt) | |
36 | 56 | ("gnutls" ,gnutls) | |
37 | 57 | ("guile-fibers" ,guile-fibers))) |