class GitClient:
Known subclasses: dulwich.client.AbstractHttpGitClient, dulwich.client.BundleClient, dulwich.client.LocalGitClient, dulwich.client.TraditionalGitClient
Constructors: GitClient.from_parsedurl(parsedurl, thin_packs, report_activity, quiet, ...), GitClient(thin_packs, report_activity, quiet, include_tags)
Git smart server client.
| Class Method | from |
Create an instance of this client from a urlparse.parsed object. |
| Method | __init__ |
Create a new GitClient instance. |
| 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 |
Retrieve a pack from a git smart server. |
| Method | fetch |
Fetch into a target repository, using bundle URIs for bootstrap. |
| Method | get |
Retrieve the current refs from a git smart server. |
| Method | get |
Retrieves full url to given path. |
| Method | send |
Upload a pack to a remote repository. |
| Instance Variable | protocol |
Undocumented |
| 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 | _report |
Undocumented |
| Instance Variable | _send |
Undocumented |
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) -> GitClient:
¶
dulwich.client.AbstractHttpGitClient, dulwich.client.BundleClient, dulwich.client.LocalGitClient, dulwich.client.SSHGitClient, dulwich.client.SubprocessGitClient, dulwich.client.TCPGitClientCreate an instance of this client from a urlparse.parsed object.
| 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 (only for HTTP) |
username:str | None | Optional username for authentication (only for HTTP) |
password:str | None | Optional password for authentication (only for HTTP) |
config:Config | None | Optional configuration object |
| Returns | |
GitClient | A GitClient object |
bool = True, report_activity: Callable[ [ int, str], None] | None = None, quiet: bool = False, include_tags: bool = False):
¶
dulwich.client.AbstractHttpGitClient, dulwich.client.BundleClient, dulwich.client.LocalGitClient, dulwich.client.TraditionalGitClientCreate a new GitClient instance.
| Parameters | |
thinbool | Whether or not thin packs should be retrieved |
reportCallable[ | Optional callback for reporting transport activity. |
quiet:bool | Whether to suppress output |
includebool | send annotated tags when sending the objects they point to |
bytes, committish: bytes, write_data: Callable[ [ bytes], None], progress: Callable[ [ bytes], None] | None = None, write_error: Callable[ [ bytes], None] | None = None, format: bytes | None = None, subdirs: Sequence[ bytes] | None = None, prefix: bytes | None = None):
¶
dulwich.client.TraditionalGitClientRetrieve an archive of the specified tree.
str, target_path: str, mkdir: bool = True, bare: bool = False, origin: str | None = 'origin', checkout: bool | None = None, branch: str | None = None, 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, bundle_uri: str | None = None) -> Repo:
¶
dulwich.client.LocalGitClientClone a repository.
| Parameters | |
path:str | Path to clone from |
targetstr | Local path to clone to |
mkdir:bool | Whether to create the target directory |
bare:bool | Whether to create a bare repository |
origin:str | None | Name for the origin remote (default: "origin") |
checkout:bool | None | Whether to checkout HEAD after cloning |
branch:str | None | Branch to checkout (default: remote HEAD) |
progress:Callable[ | Optional callback for progress reporting |
depth:int | None | Shallow clone depth |
refSequence[ | List of ref prefixes to fetch |
filterbytes | None | Partial clone filter specification |
protocolint | None | Git protocol version to use |
bundlestr | None | Optional bundle URI to bootstrap the clone from. This can be a URL to a bundle file or a bundle list. Using a bundle URI can speed up the clone by downloading pre-computed pack data. |
| Returns | |
Repo | The newly created Repo object |
Close the client and release any resources.
Default implementation does nothing as most clients don't maintain persistent connections. Subclasses that hold resources should override this method to properly clean them up.
bytes | str, target: BaseRepo, determine_wants: DetermineWantsFunc | None = None, 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:
¶
dulwich.client.BundleClient, dulwich.client.LocalGitClientFetch into a target repository.
| Parameters | |
path:bytes | str | Path to fetch from (as bytestring) |
target:BaseRepo | Target repository to fetch into |
determineDetermineWantsFunc | None | Optional function to determine what refs to fetch. Receives dictionary of name->sha, should return list of shas to fetch. Defaults to all shas. |
progress:Callable[ | Optional progress function |
depth:int | None | Depth to fetch at |
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 | Dictionary with all remote refs (not just those fetched) |
bytes | str, 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:
¶
dulwich.client.AbstractHttpGitClient, dulwich.client.BundleClient, dulwich.client.LocalGitClient, dulwich.client.TraditionalGitClientRetrieve a pack from a git smart server.
| Parameters | |
path:bytes | str | Remote path to fetch from |
determineDetermineWantsFunc | Function determine what refs to fetch. Receives dictionary of name->sha, should return list of shas 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 | Shallow fetch depth |
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 |
bytes | str, target: BaseRepo, bundle_uri: str, determine_wants: DetermineWantsFunc | None = None, 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, stored_creation_token: int | None = None) -> tuple[ FetchPackResult, int | None]:
¶
Fetch into a target repository, using bundle URIs for bootstrap.
This method first applies any available bundles from the bundle URI, then fetches remaining objects from the remote server. This can significantly speed up clones and fetches for large repositories.
If bundle URI fetch fails (e.g., network error, invalid bundle), the error is reported via the progress callback and the method continues with a regular fetch from the remote. The fetch will still succeed as long as the remote fetch completes successfully.
| Parameters | |
path:bytes | str | Path to fetch from (as bytestring) |
target:BaseRepo | Target repository to fetch into |
bundlestr | Bundle URI to fetch from (URL to bundle or bundle list) |
determineDetermineWantsFunc | None | Optional function to determine what refs to fetch. Receives dictionary of name->sha, should return list of shas to fetch. Defaults to all shas. |
progress:Callable[ | Optional progress function |
depth:int | None | Depth to fetch at |
refSequence[ | List of prefixes of desired references |
filterbytes | None | A git-rev-list-style object filter spec |
protocolint | None | Desired Git protocol version |
shallowstr | None | Deepen the history to include commits after this date |
shallowlist[ | Deepen the history to exclude commits reachable from these refs |
storedint | None | Previously stored creation token to skip already-applied bundles (for incremental fetches) |
| Returns | |
A tuple of (FetchPackResult, creation_token) where |
|
bytes, protocol_version: int | None = None, ref_prefix: Sequence[ bytes] | None = None) -> LsRemoteResult:
¶
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:
¶
dulwich.client.AbstractHttpGitClient, dulwich.client.BundleClient, dulwich.client.LocalGitClient, dulwich.client.TraditionalGitClientUpload a pack to a remote repository.
| Parameters | |
path:bytes | Repository path (as bytestring) |
updateCallable[ | Function to determine changes to remote refs. Receive 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 objects and list of pack data to include |
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 object |
| Raises | |
SendPackError | if server rejects the pack data |
GitProtocolError | if atomic push is requested but server doesn't support it |
Protocol, capabilities: Set[ bytes], progress: Callable[ [ bytes], None] | None = None) -> dict[ bytes, str | None] | None:
¶
Handle the tail of a 'git-receive-pack' request.
| Parameters | |
proto:Protocol | Protocol object to read from |
capabilities:Set[ | List of negotiated capabilities |
progress:Callable[ | Optional progress reporting function |
| Returns | |
dict mapping ref name to | error message if the ref failed to update None if it was updated successfully |
set[ bytes]) -> tuple[ set[ bytes], bytes | None]:
¶
Undocumented
set[ bytes]) -> tuple[ set[ bytes], dict[ Ref, Ref], bytes | None]:
¶
Undocumented
dulwich.client.BundleClient, dulwich.client.LocalGitClientUndocumented