Git object store interfaces and implementation.
| Class | |
Object store interface. |
| Class | |
Bitmap-accelerated implementation of ObjectReachabilityProvider. |
| Class | |
Object store implementation that uses a bucket store like S3 as backend. |
| Class | |
Git-style object store that exists on disk. |
| Class | |
Naive graph traversal implementation of ObjectReachabilityProvider. |
| Class | |
Protocol for graph walker objects. |
| Class | |
Object store that keeps all objects in memory. |
| Class | |
Find the objects missing from another object store. |
| Class | |
Interface for iterating over objects. |
| Class | |
Protocol for computing object reachability queries. |
| Class | |
Graph walker that finds what commits are missing from an object store. |
| Class | |
Object store that can overlay multiple object stores. |
| Class | |
Object store that uses pack files for storage. |
| Class | |
Object store that supports pack operations. |
| Class | |
Protocol for containers that can accept pack files. |
| Function | commit |
Commit a specified set of changes to a tree structure. |
| Function | find |
Find shallow commits according to a given depth. |
| Function | get |
Return the current available depth for the given head. |
| Function | iter |
Iterate the contents of the repository at the specified commit. |
| Function | iter |
Iterate the contents of a tree and all subtrees. |
| Function | peel |
Peel all tags from a SHA. |
| Function | read |
Yield the packs listed in a packs file. |
| Function | tree |
Look up an object in a Git tree. |
| Constant | DEFAULT |
Undocumented |
| Constant | INFODIR |
Undocumented |
| Constant | PACK |
Undocumented |
| Constant | PACKDIR |
Undocumented |
| Function | _collect |
Collect all ancestors of heads up to (excluding) those in common. |
| Function | _collect |
Collect SHA1s of files and directories for specified tree. |
| Function | _split |
Split object id list into three lists with commit, tag, and other SHAs. |
BaseObjectStore, tree: ObjectID | Tree, changes: Sequence[ tuple[ bytes, int | None, ObjectID | None]]) -> ObjectID:
¶
Commit a specified set of changes to a tree structure.
This will apply a set of changes on top of an existing tree, storing new objects in object_store.
changes are a list of tuples with (path, mode, object_sha). Paths can be both blobs and trees. See the mode and object sha to None deletes the path.
This method works especially well if there are only a small number of changes to a big tree. For a large number of changes to a large tree, use e.g. commit_tree.
Returns: New tree root object
| Parameters | |
objectBaseObjectStore | Object store to store new objects in and retrieve old ones from. |
tree:ObjectID | Tree | Original tree root (SHA or Tree object) |
changes:Sequence[ | changes to apply |
| Returns | |
ObjectID | Undocumented |
ObjectContainer, heads: Iterable[ ObjectID], depth: int) -> tuple[ set[ ObjectID], set[ ObjectID]]:
¶
Find shallow commits according to a given depth.
- Returns: A tuple of (shallow, not_shallow), sets of SHAs that should be
- considered shallow and unshallow according to the arguments. Note that these sets may overlap if a commit is reachable along multiple paths.
| Parameters | |
store:ObjectContainer | An ObjectStore for looking up objects. |
heads:Iterable[ | Iterable of head SHAs to start walking from. |
depth:int | The depth of ancestors to include. A depth of one includes only the heads themselves. |
| Returns | |
tuple[ | Undocumented |
ObjectContainer, head: 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 | |
store:ObjectContainer | Object store to search in |
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 |
ObjectContainer, commit: Commit | ObjectID | RawObjectID, *, include: Sequence[ str | bytes | Path] | None = None) -> Iterator[ TreeEntry]:
¶
Iterate the contents of the repository at the specified commit.
This is a wrapper around iter_tree_contents() and tree_lookup_path() to simplify the common task of getting the contest of a repo at a particular commit. See also dulwich.index.build_file_from_blob() for writing individual files to disk.
Yields: TreeEntry namedtuples for all matching files in a commit.
| Parameters | |
store:ObjectContainer | Object store to get trees from |
commit:Commit | ObjectID | RawObjectID | Commit object, or SHA1 of a commit |
include:Sequence[ | if provided, only the entries whose paths are in the list, or whose parent tree is in the list, will be included. Note that duplicate or overlapping paths (e.g. ["foo", "foo/bar"]) may result in duplicate entries |
| Returns | |
Iterator[ | Undocumented |
ObjectContainer, tree_id: ObjectID | None, *, 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.
Yields: TreeEntry namedtuples for all the objects in a tree.
| Parameters | |
store:ObjectContainer | Object store to get trees from |
treeObjectID | None | SHA1 of the tree. |
includebool | If True, include tree objects in the iteration. |
| Returns | |
Iterator[ | Undocumented |
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 | |
store:ObjectContainer | Object store to get objects from |
sha:ObjectID | RawObjectID | The object SHA to peel. |
| Returns | |
tuple[ | Undocumented |
Callable[ [ (ObjectID | RawObjectID)], ShaFile], root_sha: ObjectID | RawObjectID, path: bytes) -> tuple[ int, ObjectID]:
¶
Look up an object in a Git tree.
Returns: A tuple of (mode, SHA) of the resulting path.
| Parameters | |
lookupCallable[ | Callback for retrieving object by SHA1 |
rootObjectID | RawObjectID | SHA1 of the root tree |
path:bytes | Path to lookup |
| Returns | |
tuple[ | Undocumented |
ObjectContainer, heads: Iterable[ ObjectID], common: frozenset[ ObjectID] = frozenset(), shallow: frozenset[ ObjectID] = frozenset(), get_parents: Callable[ [ Commit], list[ ObjectID]] = lambda commit: commit.parents) -> tuple[ set[ ObjectID], set[ ObjectID]]:
¶
Collect all ancestors of heads up to (excluding) those in common.
- Returns: a tuple (A, B) where A - all commits reachable
- from heads but not present in common, B - common (shared) elements that are directly reachable from heads
| Parameters | |
store:ObjectContainer | Object store to get commits from |
heads:Iterable[ | commits to start from |
common:frozenset[ | commits to end at, or empty set to walk repository completely |
shallow:frozenset[ | Set of shallow commits |
getCallable[ | Optional function for getting the parents of a commit. |
| Returns | |
tuple[ | Undocumented |
Collect SHA1s of files and directories for specified tree.
| Parameters | |
objObjectContainer | Object store to get objects by SHA from |
treeObjectID | tree reference to walk |
kset:set[ | set to fill with references to files and directories |
ObjectContainer, lst: Iterable[ ObjectID], *, unknown: str = 'error') -> tuple[ set[ ObjectID], set[ ObjectID], set[ ObjectID]]:
¶
Split object id list into three lists with commit, tag, and other SHAs.
Commits referenced by tags are included into commits list as well. Only SHA1s known in this repository will get through, controlled by the unknown parameter.
Returns: A tuple of (commits, tags, others) SHA1s
| Parameters | |
objObjectContainer | Object store to get objects by SHA1 from |
lst:Iterable[ | Collection of commit and tag SHAs |
unknown:str | How to handle unknown objects: "error", "warn", or "ignore" |
| Returns | |
tuple[ | Undocumented |