class documentation

Object store implementation that fetches objects over dumb HTTP.

Method __contains__ Check if a particular object is present by SHA1.
Method __del__ Warn if the object store is being deleted without closing.
Method __init__ Initialize a DumbHTTPObjectStore.
Method __iter__ Iterate over all SHAs in the 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 the object store and release resources.
Method contains_loose Check if a particular object is present by SHA1 and is loose.
Method get_raw Obtain the raw text for an object.
Instance Variable base_url Undocumented
Property packs Iterable of pack objects.
Method _ensure_temp_pack_dir Ensure we have a temporary directory for storing pack files.
Method _fetch_from_pack Try to fetch an object from pack files.
Method _fetch_loose_object Fetch a loose object by SHA.
Method _fetch_url Fetch content from a URL path relative to base_url.
Method _get_pack_index Get or fetch a pack index.
Method _load_packs Load the list of available packs from the remote.
Instance Variable _cached_objects Undocumented
Instance Variable _http_request Undocumented
Instance Variable _packs Undocumented
Instance Variable _temp_pack_dir Undocumented

Inherited from BaseObjectStore:

Method __getitem__ Obtain an object by SHA1.
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_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 iterobjects_subset Iterate over a subset of objects in the store.
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 __contains__(self, sha: RawObjectID | ObjectID) -> bool:

Check if a particular object is present by SHA1.

def __del__(self):

Warn if the object store is being deleted without closing.

def __init__(self, base_url: str, http_request_func: Callable[[str, dict[str, str]], tuple[Any, Callable[..., bytes]]], object_format: ObjectFormat | None = None):

Initialize a DumbHTTPObjectStore.

Parameters
base_url:strBase URL of the remote repository (e.g. "https://example.com/repo.git/")
http_request_func:Callable[[str, dict[str, str]], tuple[Any, Callable[..., bytes]]]Function to make HTTP requests, should accept (url, headers) and return (response, read_func).
object_format:ObjectFormat | NoneObject format to use (defaults to DEFAULT_OBJECT_FORMAT)
def __iter__(self) -> Iterator[ObjectID]:

Iterate over all SHAs in the store.

Note: This is inefficient for dumb HTTP as it requires downloading all pack indices.

def add_object(self, obj: ShaFile):

Add a single object to this object store.

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

Add a set of objects to this object store.

def close(self):

Close the object store and release resources.

This method cleans up the temporary pack directory. Can be called multiple times safely.

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

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

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

Obtain the raw text for an object.

Parameters
sha:RawObjectID | ObjectIDSHA1 of the object
Returns
tuple[int, bytes]Tuple with numeric type and object contents
base_url =

Undocumented

packs: list[Any] =

Iterable of pack objects.

Note: Returns empty list as we don't have actual Pack objects.

def _ensure_temp_pack_dir(self):

Ensure we have a temporary directory for storing pack files.

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

Try to fetch an object from pack files.

Parameters
sha:RawObjectID | ObjectIDSHA1 of the object (hex string as bytes)
Returns
tuple[int, bytes]Tuple of (type_num, content)
Raises
KeyErrorIf object not found in any pack
def _fetch_loose_object(self, sha: bytes) -> tuple[int, bytes]:

Fetch a loose object by SHA.

Parameters
sha:bytesSHA1 of the object (hex string as bytes)
Returns
tuple[int, bytes]Tuple of (type_num, content)
Raises
KeyErrorIf object not found
def _fetch_url(self, path: str) -> bytes:

Fetch content from a URL path relative to base_url.

Parameters
path:strPath relative to base URL
Returns
bytesContent as bytes
Raises
IOErrorIf the URL cannot be fetched
def _get_pack_index(self, pack_name: str) -> PackIndex:

Get or fetch a pack index.

Parameters
pack_name:strName of the pack (without .idx extension)
Returns
PackIndexPackIndex object
def _load_packs(self):

Load the list of available packs from the remote.

_cached_objects: dict[bytes, tuple[int, bytes]] =

Undocumented

_http_request =

Undocumented

_packs: list[tuple[str, PackIndex | None]] | None =

Undocumented

_temp_pack_dir: str | None =

Undocumented