[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/08: swh: <revisions> accept null 'date' fields.
From: |
guix-commits |
Subject: |
02/08: swh: <revisions> accept null 'date' fields. |
Date: |
Mon, 6 Sep 2021 17:36:55 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 63ed618e337a466772aadd6ef3b919b7f04b666d
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Sep 6 14:03:28 2021 +0200
swh: <revisions> accept null 'date' fields.
* guix/swh.scm (maybe-null): New procedure.
(<revision>)[date]: Use it.
---
guix/swh.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/guix/swh.scm b/guix/swh.scm
index 7b14a70..4d0a647 100644
--- a/guix/swh.scm
+++ b/guix/swh.scm
@@ -186,6 +186,12 @@ Software Heritage."
(ref 10))))))
str)) ;oops!
+(define (maybe-null proc)
+ (match-lambda
+ ((? null?) #f)
+ ('null #f)
+ (obj (proc obj))))
+
(define string*
;; Converts "string or #nil" coming from JSON to "string or #f".
(match-lambda
@@ -319,10 +325,13 @@ FALSE-IF-404? is true, return #f upon 404 responses."
(target-url release-target-url "target_url"))
;;
<https://archive.softwareheritage.org/api/1/revision/359fdda40f754bbf1b5dc261e7427b75463b59be/>
+;; Note: Some revisions, such as those for "nixguix" origins (e.g.,
+;;
<https://archive.softwareheritage.org/api/1/revision/b8dbc65475bbedde8e015d4730ade8864c38fad3/>),
+;; have their 'date' field set to null.
(define-json-mapping <revision> make-revision revision?
json->revision
(id revision-id)
- (date revision-date "date" string->date*)
+ (date revision-date "date" (maybe-null string->date*))
(directory revision-directory)
(directory-url revision-directory-url "directory_url"))
- branch master updated (b0ea618 -> 49922ef), guix-commits, 2021/09/06
- 03/08: swh: Add 'lookup-snapshot-branch'., guix-commits, 2021/09/06
- 01/08: swh: Export <snapshot> accessors., guix-commits, 2021/09/06
- 02/08: swh: <revisions> accept null 'date' fields.,
guix-commits <=
- 04/08: gnu: ocaml-markup@0.8.0: Use 'ocaml-ounit', not 'ocaml-ounit2'., guix-commits, 2021/09/06
- 05/08: gnu: ocaml-ppx-optcomp: Update to 0.14.3., guix-commits, 2021/09/06
- 06/08: gnu: ocamlformat: Update to 0.19.0., guix-commits, 2021/09/06
- 08/08: gnu: ocaml-ppxlib: Update to 0.23.0., guix-commits, 2021/09/06
- 07/08: gnu: ocaml-ppx-variants-conv: Patch for building with ocaml-ppxlib., guix-commits, 2021/09/06