diff options
author | Arun Isaac | 2021-09-19 12:03:40 +0530 |
---|---|---|
committer | BonfaceKilz | 2021-09-20 10:31:42 +0300 |
commit | b7cbc9b95cc86439834fb4b1ca0a8ce8c141ddfd (patch) | |
tree | 7e6b5027f0b4fd4419cd58503785047fce56084f | |
parent | 972c58a10088dbac16809c09bc0e9192f1095eec (diff) | |
download | gn-gemtext-b7cbc9b95cc86439834fb4b1ca0a8ce8c141ddfd.tar.gz |
gnbug: Extract creator and created date.
* gnbug (<issue>): Add creator, created-date and created-relative-date
fields.
(issues): Initialize creator, created-date and created-relative-date
fields.
(creation-details): New function.
(main): Print creator and created-relative-date in issue listing.
-rwxr-xr-x | gnbug | 38 |
1 files changed, 30 insertions, 8 deletions
@@ -47,10 +47,13 @@ even if it exits non-locally. Return the value returned by PROC." directory)) (define-record-type <issue> - (issue file title assigned) + (issue file title creator created-date created-relative-date assigned) issue? (file issue-file) (title issue-title) + (creator issue-creator) + (created-date issue-created-date) + (created-relative-date issue-created-relative-date) (assigned issue-assigned)) (define (issues) @@ -59,12 +62,16 @@ even if it exits non-locally. Return the value returned by PROC." ;; editors tend to create hidden files while editing, and we want to ;; avoid them. (map (lambda (file) - (let ((file-details (file-details file))) + (let ((file-details (file-details file)) + (creation-details (creation-details file))) (issue file ;; Fallback to filename if title has no alphabetic ;; characters. (let ((title (hashtable-ref file-details 'title ""))) (if (string-any char-set:letter title) title file)) + (assq-ref creation-details 'creator) + (assq-ref creation-details 'created-date) + (assq-ref creation-details 'created-relative-date) (hashtable-ref file-details 'assigned '())))) (find-files "." (lambda (name _) @@ -97,6 +104,19 @@ even if it exits non-locally. Return the value returned by PROC." port))) result)) +(define (creation-details file) + "Return an association list of creation details about FILE extracted +from the git repository." + (call-with-input-pipe + read + "git" "log" "--diff-filter=A" + (string-append "--format=format:(" + "(creator . \"%an\")" + "(created-date . %at)" + "(created-relative-date . \"%ar\")" + ")") + "--" file)) + (define (git-updated-files transducer start-commit end-commit) "Use TRANSDUCER to transduce over the list of files updated between START-COMMIT and END-COMMIT." @@ -191,12 +211,14 @@ terminal." (member (assq-ref args 'assigned) (issue-assigned issue))))) (tlog (lambda (_ issue) - (match (issue-assigned issue) - (() (format #t "~a~%" (issue-title issue))) - (assignees - (format #t "~a ~a~%" - (issue-title issue) - (magenta (string-append "(assigned: " + (format #t "~a ~a ~a~a~%" + (issue-created-relative-date issue) + (cyan (issue-creator issue)) + (issue-title issue) + (match (issue-assigned issue) + (() "") + (assignees + (magenta (string-append " (assigned: " (string-join assignees ", ") ")")))))))) rcount |