class BaseObjectStore:
Known subclasses: dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackCapableObjectStore
Constructor: BaseObjectStore(object_format)
Object store interface.
| 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 |
Add a single object to this object store. |
| Method | add |
Add a set of objects to this object store. |
| Method | close |
Close any files opened by this object store. |
| Method | contains |
Check if a particular object is present by SHA1 and is loose. |
| Method | contains |
Check if a particular object is present by SHA1 and is packed. |
| Method | determine |
Determine which objects are wanted based on refs. |
| Method | find |
Find which revisions this store has in common using graphwalker. |
| Method | find |
Find the missing objects required for a set of revisions. |
| Method | generate |
Generate pack data objects for a set of wants/haves. |
| Method | get |
Get the commit graph for this object store. |
| Method | get |
Get the modification time of an object. |
| Method | get |
Obtain the raw text for an object. |
| Method | get |
Get a reachability provider for this object store. |
| Method | iter |
Iterate over all SHA1s that start with a given prefix. |
| Method | iter |
Iterate the contents of a tree and all subtrees. |
| Method | iter |
Iterate over unpacked objects for a subset of SHAs. |
| Method | iterobjects |
Iterate over a subset of objects in the store. |
| Method | peel |
Peel all tags from a SHA. |
| Method | prune |
Prune/clean up this object store. |
| Method | tree |
Find the differences between the contents of two trees. |
| Method | write |
Write a commit graph file for this object store. |
| Instance Variable | object |
Undocumented |
| Property | packs |
Iterable of pack objects. |
| Method | _get |
Return the current available depth for the given head. |
Check if a particular object is present by SHA1.
This method makes no distinction between loose and packed objects.
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreInitialize object store.
| Parameters | |
objectObjectFormat | None | Object format to use (defaults to DEFAULT_OBJECT_FORMAT) |
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreIterate over the SHAs that are present in this store.
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.DiskObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStoreAdd a single object to this object store.
Sequence[ tuple[ ShaFile, str | None]], progress: Callable[ ..., None] | None = None) -> Pack | None:
¶
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreCheck if a particular object is present by SHA1 and is loose.
dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreCheck if a particular object is present by SHA1 and is packed.
Mapping[ Ref, ObjectID], depth: int | None = None) -> list[ ObjectID]:
¶
Determine which objects are wanted based on refs.
Find which revisions this store has in common using graphwalker.
Returns: List of SHAs that are in common
| Parameters | |
graphwalker:GraphWalker | A graphwalker object. |
| Returns | |
list[ | Undocumented |
Iterable[ ObjectID], wants: Iterable[ ObjectID], shallow: Set[ ObjectID] | None = None, progress: Callable[ ..., None] | None = None, get_tagged: Callable[ [], dict[ ObjectID, ObjectID]] | None = None, get_parents: Callable[ ..., list[ ObjectID]] = lambda commit: commit.parents) -> Iterator[ tuple[ ObjectID, PackHint | None]]:
¶
Find the missing objects required for a set of revisions.
Returns: Iterator over (sha, path) pairs.
| Parameters | |
haves:Iterable[ | Iterable over SHAs already in common. |
wants:Iterable[ | Iterable over SHAs of objects to fetch. |
shallow:Set[ | Set of shallow commit SHA1s to skip |
progress:Callable[ | Simple progress function that will be called with updated progress strings. |
getCallable[ | Function that returns a dict of pointed-to sha -> tag sha for including tags. |
getCallable[ | Optional function for getting the parents of a commit. |
| Returns | |
Iterator[ | Undocumented |
Iterable[ ObjectID], want: Iterable[ ObjectID], *, shallow: Set[ ObjectID] | None = None, progress: Callable[ ..., None] | None = None, ofs_delta: bool = True) -> tuple[ int, Iterator[ UnpackedObject]]:
¶
dulwich.object_store.PackBasedObjectStoreGenerate pack data objects for a set of wants/haves.
| Parameters | |
have:Iterable[ | List of SHA1s of objects that should not be sent |
want:Iterable[ | List of SHA1s of objects that should be sent |
shallow:Set[ | Set of shallow commit SHA1s to skip |
progress:Callable[ | Optional progress reporting method |
ofsbool | Whether OFS deltas can be included |
| Returns | |
tuple[ | Undocumented |
dulwich.object_store.DiskObjectStoreGet the commit graph for this object store.
| Returns | |
CommitGraph | None | CommitGraph object if available, None otherwise |
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreObtain the raw text for an object.
Returns: tuple with numeric type and object contents.
| Parameters | |
name:RawObjectID | ObjectID | sha for the object. |
| Returns | |
tuple[ | Undocumented |
dulwich.object_store.PackBasedObjectStoreGet a reachability provider for this object store.
Returns an ObjectReachabilityProvider that can efficiently compute object reachability queries. Subclasses can override this to provide optimized implementations (e.g., using bitmap indexes).
| Parameters | |
preferbool | Whether to prefer bitmap-based reachability if available. |
| Returns | |
ObjectReachabilityProvider | ObjectReachabilityProvider instance |
dulwich.object_store.DiskObjectStoreIterate over all SHA1s that start with a given prefix.
The default implementation is a naive iteration over all objects. However, subclasses may override this method with more efficient implementations.
ObjectID, include_trees: bool = False) -> Iterator[ TreeEntry]:
¶
Iterate the contents of a tree and all subtrees.
Iteration is depth-first pre-order, as in e.g. os.walk.
- Returns: Iterator over TreeEntry namedtuples for all the objects in a
- tree.
| Parameters | |
treeObjectID | SHA1 of the tree. |
includebool | If True, include tree objects in the iteration. |
| Returns | |
Iterator[ | Undocumented |
Iterable[ ObjectID | RawObjectID], include_comp: bool = False, allow_missing: bool = False, convert_ofs_delta: bool = True) -> Iterator[ UnpackedObject]:
¶
Iterate over unpacked objects for a subset of SHAs.
Default implementation that converts ShaFile objects to UnpackedObject. Subclasses may override for more efficient unpacked access.
| Parameters | |
shas:Iterable[ | Iterable of object SHAs to retrieve |
includebool | Whether to include compressed data (ignored in base implementation) |
allowbool | If True, skip missing objects; if False, raise KeyError |
convertbool | Whether to convert OFS_DELTA objects (ignored in base implementation) |
| Returns | |
Iterator[ | Iterator of UnpackedObject instances |
| Raises | |
KeyError | If an object is missing and allow_missing is False |
Iterable[ ObjectID], *, allow_missing: bool = False) -> Iterator[ ShaFile]:
¶
Iterate over a subset of objects in the store.
| Parameters | |
shas:Iterable[ | Iterable of object SHAs to retrieve |
allowbool | If True, skip missing objects; if False, raise KeyError |
| Returns | |
Iterator[ | Iterator of ShaFile objects |
| Raises | |
KeyError | If an object is missing and allow_missing is False |
Peel all tags from a SHA.
- Returns: The fully-peeled SHA1 of a tag object, after peeling all
- intermediate tags; if the original ref does not point to a tag, this will equal the original SHA1.
| Parameters | |
sha:ObjectID | RawObjectID | The object SHA to peel. |
| Returns | |
ObjectID | Undocumented |
ObjectID | None, target: ObjectID | None, want_unchanged: bool = False, include_trees: bool = False, change_type_same: bool = False, rename_detector: RenameDetector | None = None, paths: Sequence[ bytes] | None = None) -> Iterator[ tuple[ tuple[ bytes | None, bytes | None], tuple[ int | None, int | None], tuple[ ObjectID | None, ObjectID | None]]]:
¶
Find the differences between the contents of two trees.
- Returns: Iterator over tuples with
- (oldpath, newpath), (oldmode, newmode), (oldsha, newsha)
| Parameters | |
source:ObjectID | None | SHA1 of the source tree |
target:ObjectID | None | SHA1 of the target tree |
wantbool | Whether unchanged files should be reported |
includebool | Whether to include trees |
changebool | Whether to report files changing type in the same entry. |
renameRenameDetector | None | RenameDetector object for detecting renames. |
paths:Sequence[ | Optional list of paths to filter to (as bytes). |
| Returns | |
Iterator[ | Undocumented |
dulwich.object_store.DiskObjectStoreWrite a commit graph file for this object store.
Note
Default implementation does nothing. Subclasses should override this method to provide commit graph writing functionality.
| Parameters | |
refs:Iterable[ | List of refs to include. If None, includes all refs from object store. |
reachable:bool | If True, includes all commits reachable from refs. If False, only includes the direct ref targets. |
dulwich.dumb.DumbHTTPObjectStore, dulwich.object_store.MemoryObjectStore, dulwich.object_store.OverlayObjectStore, dulwich.object_store.PackBasedObjectStoreIterable of pack objects.
ObjectID, get_parents: Callable[ ..., list[ ObjectID]] = lambda commit: commit.parents, max_depth: int | None = None) -> int:
¶
Return the current available depth for the given head.
For commits with multiple parents, the largest possible depth will be returned.
| Parameters | |
head:ObjectID | commit to start from |
getCallable[ | optional function for getting the parents of a commit |
maxint | None | maximum depth to search |
| Returns | |
int | Undocumented |