Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/git/converters.py
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | |||||
def dulwich_commit_to_revision(obj: ShaFile) -> Revision: | def dulwich_commit_to_revision(obj: ShaFile) -> Revision: | ||||
if obj.type_name != b"commit": | if obj.type_name != b"commit": | ||||
raise ValueError("Argument is not a commit.") | raise ValueError("Argument is not a commit.") | ||||
commit = cast(Commit, obj) | commit = cast(Commit, obj) | ||||
author_timezone = None | author_timezone = None | ||||
committer_timezone = None | committer_timezone = None | ||||
assert commit._chunked_text is not None # to keep mypy happy | |||||
for (field, value) in _parse_message(commit._chunked_text): | for (field, value) in _parse_message(commit._chunked_text): | ||||
if field == b"author": | if field == b"author": | ||||
m = AUTHORSHIP_LINE_RE.match(value) | m = AUTHORSHIP_LINE_RE.match(value) | ||||
if m: | if m: | ||||
author_timezone = m.group("timezone") | author_timezone = m.group("timezone") | ||||
elif field == b"committer": | elif field == b"committer": | ||||
m = AUTHORSHIP_LINE_RE.match(value) | m = AUTHORSHIP_LINE_RE.match(value) | ||||
if m: | if m: | ||||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |