module documentation

Generates tarballs for Git trees.

Class ChunkedBytesIO Turn a list of bytestrings into a file-like object.
Function tar_stream Generate a tar stream for the contents of a Git tree.
Function _walk_tree Recursively walk a dulwich Tree, yielding tuples of (absolute path, TreeEntry) along the way.
def tar_stream(store: BaseObjectStore, tree: Tree, mtime: int, prefix: bytes = b'', format: str = '') -> Generator[bytes, None, None]:

Generate a tar stream for the contents of a Git tree.

Returns a generator that lazily assembles a .tar.gz archive, yielding it in pieces (bytestrings). To obtain the complete .tar.gz binary file, simply concatenate these chunks.

Parameters
store:BaseObjectStoreObject store to retrieve objects from
tree:TreeTree object for the tree root
mtime:intUNIX timestamp that is assigned as the modification time for all files, and the gzip header modification time if format='gz'
prefix:bytesOptional prefix to prepend to all paths in the archive
format:strOptional compression format for tarball
Returns
Generator[bytes, None, None]Bytestrings
def _walk_tree(store: BaseObjectStore, tree: Tree, root: bytes = b'') -> Generator[tuple[bytes, TreeEntry], None, None]:

Recursively walk a dulwich Tree, yielding tuples of (absolute path, TreeEntry) along the way.