class documentation

Object store that keeps all objects in memory.

Method __delitem__ Delete an object from this store, for testing only.
Method __getitem__ Retrieve an object by SHA.
Method __init__ Initialize a MemoryObjectStore.
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 add_pack Add a new pack to this object store.
Method add_pack_data Add pack data to this object store.
Method add_thin_pack Add a new thin pack to 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 get_raw Obtain the raw text for an object.
Instance Variable pack_compression_level Undocumented
Property packs List with pack objects.
Method _to_hexsha Undocumented
Instance Variable _data Undocumented

Inherited from PackCapableObjectStore:

Method get_unpacked_object Get a raw unresolved object.
Method iterobjects_subset Iterate over a subset of objects.

Inherited from BaseObjectStore (via PackCapableObjectStore):

Method __contains__ Check if a particular object is present by SHA1.
Method close Close any files opened by this object store.
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_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
Method _get_depth Return the current available depth for the given head.
def __delitem__(self, name: ObjectID):

Delete an object from this store, for testing only.

def __getitem__(self, name: ObjectID | RawObjectID) -> ShaFile:

Retrieve an object by SHA.

Parameters
name:ObjectID | RawObjectIDSHA of the object (as hex string or bytes)
Returns
ShaFileCopy of the ShaFile object
Raises
KeyErrorIf the object is not found
def __init__(self, *, object_format: ObjectFormat | None = None):

Initialize a MemoryObjectStore.

Creates an empty in-memory object store.

Parameters
object_format:ObjectFormat | NoneHash algorithm to use (defaults to SHA1)
def __iter__(self) -> Iterator[ObjectID]:

Iterate over the SHAs that are present in this store.

def add_object(self, obj: ShaFile):

Add a single object to this object store.

def add_objects(self, objects: Iterable[tuple[ShaFile, str | None]], progress: Callable[[str], None] | None = None):

Add a set of objects to this object store.

Parameters
objects:Iterable[tuple[ShaFile, str | None]]Iterable over a list of (object, path) tuples
progress:Callable[[str], None] | NoneOptional progress reporting function.
def add_pack(self) -> tuple[BinaryIO, Callable[[], None], Callable[[], None]]:

Add a new pack to this object store.

Because this object store doesn't support packs, we extract and add the individual objects.

Returns: Fileobject to write to and a commit function to
call when the pack is finished.
def add_pack_data(self, count: int, unpacked_objects: Iterator[UnpackedObject], progress: Callable[[str], None] | None = None):

Add pack data to this object store.

Parameters
count:intNumber of items to add
unpacked_objects:Iterator[UnpackedObject]Iterator of UnpackedObject instances
progress:Callable[[str], None] | NoneOptional progress reporting function.
def add_thin_pack(self, read_all: Callable[[int], bytes], read_some: Callable[[int], bytes] | None, progress: Callable[[str], None] | None = None):

Add a new thin pack to this object store.

Thin packs are packs that contain deltas with parents that exist outside the pack. Because this object store doesn't support packs, we extract and add the individual objects.

Parameters
read_all:Callable[[int], bytes]Read function that blocks until the number of requested bytes are read.
read_some:Callable[[int], bytes] | NoneRead function that returns at least one byte, but may not return the number of bytes requested.
progress:Callable[[str], None] | NoneOptional progress reporting function.
def contains_loose(self, sha: ObjectID | RawObjectID) -> bool:

Check if a particular object is present by SHA1 and is loose.

def contains_packed(self, sha: ObjectID | RawObjectID) -> bool:

Check if a particular object is present by SHA1 and is packed.

def get_raw(self, name: RawObjectID | ObjectID) -> tuple[int, bytes]:

Obtain the raw text for an object.

Returns: tuple with numeric type and object contents.

Parameters
name:RawObjectID | ObjectIDsha for the object.
Returns
tuple[int, bytes]Undocumented
pack_compression_level: int =

Undocumented

packs: list[Pack] =

List with pack objects.

def _to_hexsha(self, sha: ObjectID | RawObjectID) -> ObjectID:

Undocumented

Undocumented