class documentation

class ObjectContainer(Protocol):

Known subclasses: dulwich.pack.PackedObjectContainer

View In Hierarchy

Protocol for objects that can contain git objects.

Method __contains__ Check if a hex sha is present.
Method __getitem__ Retrieve an object.
Method add_object Add a single object to this object store.
Method add_objects Add a set of objects to this object store.
Method get_commit_graph Get the commit graph for this object store.
def __contains__(self, sha1: ObjectID) -> bool:
def __getitem__(self, sha1: ObjectID | RawObjectID) -> ShaFile:

Retrieve an object.

def add_object(self, obj: ShaFile):
def add_objects(self, objects: Sequence[tuple[ShaFile, str | None]], progress: Callable[..., None] | None = None) -> Pack | None:

Add a set of objects to this object store.

Returns: Optional Pack object of the objects written.

Parameters
objects:Sequence[tuple[ShaFile, str | None]]Iterable over a list of (object, path) tuples
progress:Callable[..., None] | NoneProgress callback for object insertion
Returns
Pack | NoneUndocumented
def get_commit_graph(self) -> CommitGraph | None:

Get the commit graph for this object store.

Returns
CommitGraph | NoneCommitGraph object if available, None otherwise