swh.loader.git.converters module#

Convert dulwich objects to dictionaries suitable for swh.storage

swh.loader.git.converters.COMMIT_MODE_MASK = 57344#

Mode/perms of tree entries that point to a commit. They are normally equal to this mask, but may have more bits set to 1.

swh.loader.git.converters.TREE_MODE_MASK = 16384#

Mode/perms of tree entries that point to a tree. They are normally equal to this mask, but may have more bits set to 1.

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

Bases: Exception

swh.loader.git.converters.check_id(obj: BaseHashableModel) None[source]#
swh.loader.git.converters.dulwich_blob_to_content_id(obj: ShaFile) Dict[str, Any][source]#

Convert a dulwich blob to a Software Heritage content id

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

Convert a dulwich blob to a Software Heritage content

swh.loader.git.converters.dulwich_tree_to_directory(obj: ShaFile) Directory[source]#

Format a tree as a directory

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

Parse an author line

swh.loader.git.converters.dulwich_tsinfo_to_timestamp(timestamp, timezone: int, timezone_neg_utc: bool, timezone_bytes: bytes | None) TimestampWithTimezone[source]#

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

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