class documentation
class AbstractHttpGitClient(GitClient):
Known subclasses: dulwich.client.Urllib3HttpGitClient
Constructors: AbstractHttpGitClient.from_parsedurl(parsedurl, thin_packs, report_activity, quiet, ...), AbstractHttpGitClient(base_url, dumb, thin_packs, report_activity, ...)
Abstract base class for HTTP Git Clients.
This is agonistic of the actual HTTP implementation.
Subclasses should provide an implementation of the _http_request method.
| Class Method | from |
Create an AbstractHttpGitClient from a parsed URL. |
| Method | __init__ |
Initialize AbstractHttpGitClient. |
| Method | __repr__ |
Return string representation of this client. |
| Method | fetch |
Retrieve a pack from a git smart server. |
| Method | get |
Retrieve the current refs from a git smart server. |
| Method | get |
Get the HTTP URL for a path. |
| Method | send |
Upload a pack to a remote repository. |
| Instance Variable | dumb |
Undocumented |
| Instance Variable | protocol |
Undocumented |
| Method | _discover |
Undocumented |
| Method | _get |
Undocumented |
| Method | _http |
Perform HTTP request. |
| Method | _smart |
Send a 'smart' HTTP request. |
| Instance Variable | _base |
Undocumented |
| Instance Variable | _password |
Undocumented |
| Instance Variable | _report |
Undocumented |
| Instance Variable | _url |
Undocumented |
| Instance Variable | _username |
Undocumented |
Inherited from GitClient:
| Method | archive |
Retrieve an archive of the specified tree. |
| Method | clone |
Clone a repository. |
| Method | close |
Close the client and release any resources. |
| Method | fetch |
Fetch into a target repository. |
| Method | fetch |
Fetch into a target repository, using bundle URIs for bootstrap. |
| Static Method | _should |
Undocumented |
| Static Method | _warn |
Undocumented |
| Method | _handle |
Handle the tail of a 'git-receive-pack' request. |
| Method | _negotiate |
Undocumented |
| Method | _negotiate |
Undocumented |
| Instance Variable | _fetch |
Undocumented |
| Instance Variable | _report |
Undocumented |
| Instance Variable | _send |
Undocumented |
def from_parsedurl(cls, parsedurl:
ParseResult, thin_packs: bool = True, report_activity: Callable[ [ int, str], None] | None = None, quiet: bool = False, include_tags: bool = False, dumb: bool = False, username: str | None = None, password: str | None = None, config: Config | None = None, pool_manager: urllib3.PoolManager | None = None) -> AbstractHttpGitClient:
¶
overrides
dulwich.client.GitClient.from_parsedurlCreate an AbstractHttpGitClient from a parsed URL.
| Parameters | |
parsedurl:ParseResult | Result of urlparse() |
thinbool | Whether or not thin packs should be retrieved |
reportCallable[ | Optional callback for reporting transport activity |
quiet:bool | Whether to suppress progress output |
includebool | Whether to include tags |
dumb:bool | Whether to use dumb HTTP transport |
username:str | None | Optional username for authentication |
password:str | None | Optional password for authentication |
config:Config | None | Configuration object |
poolurllib3.PoolManager | None | Optional urllib3 PoolManager for HTTP(S) connections |
| Returns | |
AbstractHttpGitClient | An AbstractHttpGitClient instance |
def __init__(self, base_url:
str, dumb: bool = False, thin_packs: bool = True, report_activity: Callable[ [ int, str], None] | None = None, quiet: bool = False, include_tags: bool = False, username: str | None = None, password: str | None = None):
¶
overrides
dulwich.client.GitClient.__init__overridden in
dulwich.client.Urllib3HttpGitClientInitialize AbstractHttpGitClient.
def fetch_pack(self, path:
str | bytes, determine_wants: DetermineWantsFunc, graph_walker: GraphWalker, pack_data: Callable[ [ bytes], int], progress: Callable[ [ bytes], None] | None = None, depth: int | None = None, ref_prefix: Sequence[ bytes] | None = None, filter_spec: bytes | None = None, protocol_version: int | None = None, shallow_since: str | None = None, shallow_exclude: list[ str] | None = None) -> FetchPackResult:
¶
overrides
dulwich.client.GitClient.fetch_packRetrieve a pack from a git smart server.
| Parameters | |
path:str | bytes | Path to fetch from |
determineDetermineWantsFunc | Callback that returns list of commits to fetch |
graphGraphWalker | Object with next() and ack(). |
packCallable[ | Callback called for each bit of data in the pack |
progress:Callable[ | Callback for progress reports (strings) |
depth:int | None | Depth for request |
refSequence[ | List of prefixes of desired references, as a list of bytestrings. Filtering is done by the server if supported, and client side otherwise. |
filterbytes | None | A git-rev-list-style object filter spec, as bytestring. Only used if the server supports the Git protocol-v2 'filter' feature, and ignored otherwise. |
protocolint | None | Desired Git protocol version. By default the highest mutually supported protocol version will be used. |
shallowstr | None | Deepen the history to include commits after this date |
shallowlist[ | Deepen the history to exclude commits reachable from these refs |
| Returns | |
FetchPackResult | FetchPackResult object |
def get_refs(self, path:
str | bytes, protocol_version: int | None = None, ref_prefix: Sequence[ bytes] | None = None) -> LsRemoteResult:
¶
overrides
dulwich.client.GitClient.get_refsRetrieve the current refs from a git smart server.
def send_pack(self, path:
str | bytes, update_refs: Callable[ [ dict[ Ref, ObjectID]], dict[ Ref, ObjectID]], generate_pack_data: GeneratePackDataFunc, progress: Callable[ [ bytes], None] | None = None, push_options: Sequence[ bytes] | None = None, atomic: bool = False) -> SendPackResult:
¶
overrides
dulwich.client.GitClient.send_packUpload a pack to a remote repository.
| Parameters | |
path:str | bytes | Repository path (as bytestring or string) |
updateCallable[ | Function to determine changes to remote refs. Receives dict with existing remote refs, returns dict with changed refs (name -> sha, where sha=ZERO_SHA for deletions) |
generateGeneratePackDataFunc | Function that can return a tuple with number of elements and pack data to upload. |
progress:Callable[ | Optional progress function |
pushSequence[ | Optional list of push options to send to the server |
atomic:bool | If True, request atomic push (all refs update or none do) |
| Returns | |
SendPackResult | SendPackResult |
| Raises | |
SendPackError | if server rejects the pack data |
GitProtocolError | if atomic push is requested but server doesn't support it |
def _discover_references(self, service:
bytes, base_url: str, protocol_version: int | None = None, ref_prefix: Sequence[ bytes] | None = None) -> tuple[ dict[ Ref, ObjectID | None], set[ bytes], str, dict[ Ref, Ref], dict[ Ref, ObjectID]]:
¶
Undocumented
def _http_request(self, url:
str, headers: dict[ str, str] | None = None, data: bytes | Iterator[ bytes] | None = None, raise_for_status: bool = True) -> tuple[ HTTPResponse, Callable[ [ int], bytes]]:
¶
overridden in
dulwich.client.Urllib3HttpGitClientPerform HTTP request.
| Parameters | |
url:str | Request URL. |
headers:dict[ | Optional custom headers to override defaults. |
data:bytes | Iterator[ | Request data. |
raisebool | Whether to raise an exception for HTTP errors. |
| Returns | |
tuple[ | Tuple (response, read), where response is an urllib3 response object with additional content_type and redirect_location properties, and read is a consumable read method for the response data. |
| Raises | |
GitProtocolError | |