Page MenuHomeSoftware Heritage

D2744.diff
No OneTemporary

D2744.diff

diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,5 +1,5 @@
swh.core >= 0.0.7
swh.loader.core >= 0.0.78
-swh.model >= 0.0.27
+swh.model >= 0.0.60
swh.scheduler >= 0.0.39
swh.storage >= 0.0.108
diff --git a/swh/loader/git/converters.py b/swh/loader/git/converters.py
--- a/swh/loader/git/converters.py
+++ b/swh/loader/git/converters.py
@@ -85,36 +85,7 @@
def parse_author(name_email: bytes) -> Person:
"""Parse an author line"""
- if name_email is None:
- raise ValueError('fullname is None')
-
- try:
- open_bracket = name_email.index(b'<')
- except ValueError:
- name = email = None
- else:
- raw_name = name_email[:open_bracket]
- raw_email = name_email[open_bracket+1:]
-
- if not raw_name:
- name = None
- elif raw_name.endswith(b' '):
- name = raw_name[:-1]
- else:
- name = raw_name
-
- try:
- close_bracket = raw_email.index(b'>')
- except ValueError:
- email = None
- else:
- email = raw_email[:close_bracket]
-
- return Person(
- name=name,
- email=email,
- fullname=name_email,
- )
+ return Person.from_fullname(name_email)
def dulwich_tsinfo_to_timestamp(
diff --git a/swh/loader/git/tests/test_converters.py b/swh/loader/git/tests/test_converters.py
--- a/swh/loader/git/tests/test_converters.py
+++ b/swh/loader/git/tests/test_converters.py
@@ -166,7 +166,7 @@
def test_author_line_to_author(self):
# edge case out of the way
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
converters.parse_author(None)
tests = {
@@ -182,7 +182,7 @@
),
b'malformed <email': Person(
name=b'malformed',
- email=None,
+ email=b'email',
fullname=b'malformed <email'
),
b'trailing <sp@c.e> ': Person(
@@ -196,12 +196,12 @@
fullname=b'no<sp@c.e>',
),
b' <>': Person(
- name=b'',
- email=b'',
+ name=None,
+ email=None,
fullname=b' <>',
),
b'something': Person(
- name=None,
+ name=b'something',
email=None,
fullname=b'something'
)

File Metadata

Mime Type
text/plain
Expires
Sun, Aug 24, 4:53 PM (6 d, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3222620

Event Timeline