From f723eb12af67f3a2f5613ac6650ff2480282e0ef Mon Sep 17 00:00:00 2001
From: David Douard <david.douard@sdfa3.org>
Date: Tue, 16 Jun 2020 10:04:58 +0200
Subject: [PATCH] Fix the model: Revision.message can be None

And adapt the revisions_d() strategy accordingly.
---
 swh/model/hypothesis_strategies.py | 2 +-
 swh/model/model.py                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py
index 18d46ba1..3e8198bd 100644
--- a/swh/model/hypothesis_strategies.py
+++ b/swh/model/hypothesis_strategies.py
@@ -234,7 +234,7 @@ revision_metadata = metadata_dicts
 def revisions_d():
     return builds(
         dict,
-        message=binary(),
+        message=optional(binary()),
         synthetic=booleans(),
         author=persons_d(),
         committer=persons_d(),
diff --git a/swh/model/model.py b/swh/model/model.py
index c9ade626..efb9039b 100644
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -407,7 +407,7 @@ class RevisionType(Enum):
 
 @attr.s(frozen=True)
 class Revision(BaseModel, HashableObject):
-    message = attr.ib(type=bytes, validator=type_validator())
+    message = attr.ib(type=Optional[bytes], validator=type_validator())
     author = attr.ib(type=Person, validator=type_validator())
     committer = attr.ib(type=Person, validator=type_validator())
     date = attr.ib(type=Optional[TimestampWithTimezone], validator=type_validator())
-- 
GitLab