class documentation

Object store that supports pack operations.

This is a base class for object stores that can handle pack files, including both disk-based and memory-based stores.

Method add_pack Add a new pack to this object store.
Method add_pack_data Add pack data to this object store.
Method get_unpacked_object Get a raw unresolved object.
Method iterobjects_subset Iterate over a subset of objects.

Inherited from BaseObjectStore:

Method __contains__ Check if a particular object is present by SHA1.
Method __getitem__ Obtain an object by SHA1.
Method __init__ Initialize object store.
Method __iter__ Iterate over the SHAs that are present in this store.
Method add_object Add a single object to this object store.
Method add_objects Add a set of objects to this object store.
Method close Close any files opened by this object store.
Method contains_loose Check if a particular object is present by SHA1 and is loose.
Method contains_packed Check if a particular object is present by SHA1 and is packed.
Method determine_wants_all Determine which objects are wanted based on refs.
Method find_common_revisions Find which revisions this store has in common using graphwalker.
Method find_missing_objects Find the missing objects required for a set of revisions.
Method generate_pack_data Generate pack data objects for a set of wants/haves.
Method get_commit_graph Get the commit graph for this object store.
Method get_object_mtime Get the modification time of an object.
Method get_raw Obtain the raw text for an object.
Method get_reachability_provider Get a reachability provider for this object store.
Method iter_prefix Iterate over all SHA1s that start with a given prefix.
Method iter_tree_contents Iterate the contents of a tree and all subtrees.
Method iter_unpacked_subset Iterate over unpacked objects for a subset of SHAs.
Method peel_sha Peel all tags from a SHA.
Method prune Prune/clean up this object store.
Method tree_changes Find the differences between the contents of two trees.
Method write_commit_graph Write a commit graph file for this object store.
Instance Variable object_format Undocumented
Property packs Iterable of pack objects.
Method _get_depth Return the current available depth for the given head.
def add_pack(self) -> tuple[BinaryIO, Callable[[], None], Callable[[], None]]:

Add a new pack to this object store.

Returns: Tuple of (file, commit_func, abort_func)

def add_pack_data(self, count: int, unpacked_objects: Iterator[UnpackedObject], progress: Callable[..., None] | None = None) -> Pack | None:

Add pack data to this object store.

Parameters
count:intNumber of objects
unpacked_objects:Iterator[UnpackedObject]Iterator over unpacked objects
progress:Callable[..., None] | NoneOptional progress callback
Returns
Pack | NoneUndocumented
def get_unpacked_object(self, sha1: ObjectID | RawObjectID, *, include_comp: bool = False) -> UnpackedObject:

Get a raw unresolved object.

Parameters
sha1:ObjectID | RawObjectIDSHA-1 hash of the object
include_comp:boolWhether to include compressed data
Returns
UnpackedObjectUnpackedObject instance
def iterobjects_subset(self, shas: Iterable[ObjectID], *, allow_missing: bool = False) -> Iterator[ShaFile]:

Iterate over a subset of objects.

Parameters
shas:Iterable[ObjectID]Iterable of object SHAs to retrieve
allow_missing:boolIf True, skip missing objects
Returns
Iterator[ShaFile]Iterator of ShaFile objects