diff options
author | Arun Isaac | 2022-03-17 17:00:08 +0530 |
---|---|---|
committer | Arun Isaac | 2022-03-18 16:24:01 +0530 |
commit | 15e9daaac9af2b2ed6dc34979dd43ab4e172bb72 (patch) | |
tree | fc7ea1637601cf20e35188a8b9856443931d2154 | |
parent | 50898532c81654d834b1070b49d05c46e378a455 (diff) | |
download | tissue-15e9daaac9af2b2ed6dc34979dd43ab4e172bb72.tar.gz tissue-15e9daaac9af2b2ed6dc34979dd43ab4e172bb72.tar.lz tissue-15e9daaac9af2b2ed6dc34979dd43ab4e172bb72.zip |
issue: Record all commits affecting a file, not just how many.
* tissue/issue.scm (<post>): New record type.
(file-details): Record all commits affecting a file, not just how
many.
* bin/tissue (print-issue, print-issue-to-gemtext): Apply length on
the output of issue-posts before use.
* tissue/web.scm (issue-list-item-markup-writer-action): Apply length
on posts before use.
-rwxr-xr-x | bin/tissue | 146 | ||||
-rw-r--r-- | tissue/issue.scm | 16 | ||||
-rw-r--r-- | tissue/web.scm | 3 |
3 files changed, 90 insertions, 75 deletions
@@ -150,81 +150,83 @@ List recent updates. (define (print-issue issue-number issue) "Print ISSUE with number ISSUE-NUMBER." - (display (magenta (issue-title issue))) - ;; Highlight keywords containing "bug" or "critical" as whole words - ;; in red. Else, highlight in blue. - (unless (null? (issue-keywords issue)) - (display " ") - (display (string-join - (map (lambda (keyword) - ((cond - ((not (null? (lset-intersection - string=? - (string-split keyword #\space) - (list "bug" "critical")))) - red-background) - (else blue-background)) - (string-append " " keyword " "))) - (issue-keywords issue)) - " "))) - (unless (null? (issue-assigned issue)) - (display (green (string-append " (assigned: " - (string-join (issue-assigned issue) - ", ") - ")")))) - (when (> (issue-posts issue) 1) - (display (string-append " [" - (number->string (issue-posts issue)) - " posts]"))) - (newline) - (display (string-append - (cyan (string-append "#" (number->string issue-number))) - " opened " - (cyan (issue-created-relative-date issue)) - " by " - (cyan (issue-creator issue)))) - (when (> (issue-posts issue) 1) - (display (string-append (cyan ",") - " last updated " - (cyan (issue-last-updated-relative-date issue)) - " by " - (cyan (issue-last-updater issue))))) - (unless (zero? (issue-tasks issue)) - (display (string-append (cyan "; ") - (number->string (issue-completed-tasks issue)) - "/" - (number->string (issue-tasks issue)) - " tasks done"))) - (newline)) + (let ((number-of-posts (length (issue-posts issue)))) + (display (magenta (issue-title issue))) + ;; Highlight keywords containing "bug" or "critical" as whole + ;; words in red. Else, highlight in blue. + (unless (null? (issue-keywords issue)) + (display " ") + (display (string-join + (map (lambda (keyword) + ((cond + ((not (null? (lset-intersection + string=? + (string-split keyword #\space) + (list "bug" "critical")))) + red-background) + (else blue-background)) + (string-append " " keyword " "))) + (issue-keywords issue)) + " "))) + (unless (null? (issue-assigned issue)) + (display (green (string-append " (assigned: " + (string-join (issue-assigned issue) + ", ") + ")")))) + (when (> number-of-posts 1) + (display (string-append " [" + (number->string number-of-posts) + " posts]"))) + (newline) + (display (string-append + (cyan (string-append "#" (number->string issue-number))) + " opened " + (cyan (issue-created-relative-date issue)) + " by " + (cyan (issue-creator issue)))) + (when (> number-of-posts 1) + (display (string-append (cyan ",") + " last updated " + (cyan (issue-last-updated-relative-date issue)) + " by " + (cyan (issue-last-updater issue))))) + (unless (zero? (issue-tasks issue)) + (display (string-append (cyan "; ") + (number->string (issue-completed-tasks issue)) + "/" + (number->string (issue-tasks issue)) + " tasks done"))) + (newline))) (define (print-issue-to-gemtext issue-number issue) "Print ISSUE with number ISSUE-NUMBER to gemtext." - (format #t "# ~a" (issue-title issue)) - (unless (null? (issue-keywords issue)) - (format #t " [~a]" - (string-join (issue-keywords issue) - ", "))) - (unless (null? (issue-assigned issue)) - (format #t " (assigned: ~a)" - (string-join (issue-assigned issue) - ", "))) - (when (> (issue-posts issue) 1) - (format #t " [~a posts]" (issue-posts issue))) - (newline) - (format #t "~a opened ~a by ~a" - issue-number - (issue-created-relative-date issue) - (issue-creator issue)) - (when (> (issue-posts issue) 1) - (format #t ", last updated ~a by ~a" - (issue-last-updated-relative-date issue) - (issue-last-updater issue))) - (unless (zero? (issue-tasks issue)) - (format #t "; ~a/~a tasks done" - (issue-completed-tasks issue) - (issue-tasks issue))) - (newline) - (newline)) + (let ((number-of-posts (length (issue-posts issue)))) + (format #t "# ~a" (issue-title issue)) + (unless (null? (issue-keywords issue)) + (format #t " [~a]" + (string-join (issue-keywords issue) + ", "))) + (unless (null? (issue-assigned issue)) + (format #t " (assigned: ~a)" + (string-join (issue-assigned issue) + ", "))) + (when (> number-of-posts 1) + (format #t " [~a posts]" number-of-posts)) + (newline) + (format #t "~a opened ~a by ~a" + issue-number + (issue-created-relative-date issue) + (issue-creator issue)) + (when (> number-of-posts 1) + (format #t ", last updated ~a by ~a" + (issue-last-updated-relative-date issue) + (issue-last-updater issue))) + (unless (zero? (issue-tasks issue)) + (format #t "; ~a/~a tasks done" + (issue-completed-tasks issue) + (issue-tasks issue))) + (newline) + (newline))) (define tissue-list (match-lambda* diff --git a/tissue/issue.scm b/tissue/issue.scm index 5b44cd3..7b43caa 100644 --- a/tissue/issue.scm +++ b/tissue/issue.scm @@ -43,6 +43,10 @@ issue-tasks issue-completed-tasks issue-posts + post + post-author + post-date + post-relative-date issues)) (define-record-type <issue> @@ -65,6 +69,13 @@ (completed-tasks issue-completed-tasks) (posts issue-posts)) +(define-record-type <post> + (post author date relative-date) + post? + (author post-author) + (date post-date) + (relative-date post-relative-date)) + (define (hashtable-append! hashtable key new-values) "Append NEW-VALUES to the list of values KEY is associated to in HASHTABLE. Deduplicate the resulting list if necessary. If KEY is not @@ -203,8 +214,9 @@ return #f." (hashtable-set! result 'last-updated-relative-date relative-date)) (hashtable-set! result 'creator author) (hashtable-set! result 'created-date (unix-time->date date)) - (hashtable-set! result 'created-relative-date relative-date)))))) - rcount get-line port))) + (hashtable-set! result 'created-relative-date relative-date) + (post author date relative-date)))))) + rcons get-line port))) "git" "log" "--follow" (string-append "--format=format:(" "(author . \"%an\")" diff --git a/tissue/web.scm b/tissue/web.scm index fa804a4..f06f58d 100644 --- a/tissue/web.scm +++ b/tissue/web.scm @@ -150,7 +150,8 @@ NEW-EXTENSION." (format " opened ~a by ~a" (markup-option markup #:created-relative-date) (markup-option markup #:creator)) - (if (> (markup-option markup #:posts) 1) + (if (> (length (markup-option markup #:posts)) + 1) (format ", last updated ~a by ~a" (markup-option markup #:last-updated-relative-date) (markup-option markup #:last-updater)) |