swh.vault.cookers.revision_gitfast module

class swh.vault.cookers.revision_gitfast.RevisionGitfastCooker(swhid: swh.model.swhids.CoreSWHID, backend, storage: swh.storage.interface.StorageInterface, graph=None, objstorage=None, max_bundle_size: int = 536870912)[source]

Bases: swh.vault.cookers.base.BaseVaultCooker

Cooker to create a git fast-import bundle

Initialize the cooker.

The type of the object represented by the id depends on the concrete class. Very likely, each type of bundle will have its own cooker class.

  • swhid – id of the object to be cooked into a bundle.

  • backend – the vault backend (swh.vault.backend.VaultBackend).

BUNDLE_TYPE: ClassVar[str] = 'gitfast'
SUPPORTED_OBJECT_TYPES: ClassVar[Set[swh.model.swhids.ObjectType]] = {ObjectType.REVISION}

Checks that the requested object exists and can be cooked.

Override this in the cooker implementation.


Implementation of the cooker. Yields chunks of the bundle bytes.

Override this with the cooker implementation.


Generate all the git fast-import commands from a given log.


Get the mark ID as bytes of a git object.

If the object has not yet been marked, assign a new ID and add it to the mark dictionary.