swh.loader.git.converters module

Convert dulwich objects to dictionaries suitable for swh.storage

exception swh.loader.git.converters.HashMismatch[source]

Bases: Exception

swh.loader.git.converters.check_id(obj: swh.model.model.HashableObject) None[source]
swh.loader.git.converters.dulwich_blob_to_content_id(obj: dulwich.objects.ShaFile) Dict[str, Any][source]

Convert a dulwich blob to a Software Heritage content id

swh.loader.git.converters.dulwich_blob_to_content(obj: dulwich.objects.ShaFile, max_content_size=None) swh.model.model.BaseContent[source]

Convert a dulwich blob to a Software Heritage content

swh.loader.git.converters.dulwich_tree_to_directory(obj: dulwich.objects.ShaFile) swh.model.model.Directory[source]

Format a tree as a directory

swh.loader.git.converters.parse_author(name_email: bytes) swh.model.model.Person[source]

Parse an author line

swh.loader.git.converters.dulwich_tsinfo_to_timestamp(timestamp, timezone, timezone_neg_utc) swh.model.model.TimestampWithTimezone[source]

Convert the dulwich timestamp information to a structure compatible with Software Heritage

swh.loader.git.converters.dulwich_commit_to_revision(obj: dulwich.objects.ShaFile) swh.model.model.Revision[source]
swh.loader.git.converters.dulwich_tag_to_release(obj: dulwich.objects.ShaFile) swh.model.model.Release[source]