class documentation

Traditional Git client.

Method __init__ Initialize a TraditionalGitClient.
Method archive Request an archive of a specific commit.
Method fetch_pack Retrieve a pack from a git smart server.
Method get_refs Retrieve the current refs from a git smart server.
Method send_pack Upload a pack to a remote repository.
Constant DEFAULT_ENCODING Undocumented
Instance Variable protocol_version Undocumented
Method _connect Create a connection to the server.
Instance Variable _remote_path_encoding Undocumented
Instance Variable _report_status_parser Undocumented

Inherited from GitClient:

Class Method from_parsedurl Create an instance of this client from a urlparse.parsed object.
Method clone Clone a repository.
Method close Close the client and release any resources.
Method fetch Fetch into a target repository.
Method fetch_with_bundle_uri Fetch into a target repository, using bundle URIs for bootstrap.
Method get_url Retrieves full url to given path.
Static Method _should_send_pack Undocumented
Static Method _warn_filter_objects Undocumented
Method _handle_receive_pack_tail Handle the tail of a 'git-receive-pack' request.
Method _negotiate_receive_pack_capabilities Undocumented
Method _negotiate_upload_pack_capabilities Undocumented
Instance Variable _fetch_capabilities Undocumented
Instance Variable _report_activity Undocumented
Instance Variable _send_capabilities Undocumented
def __init__(self, path_encoding: str = DEFAULT_ENCODING, thin_packs: bool = True, report_activity: Callable[[int, str], None] | None = None, quiet: bool = False, include_tags: bool = False):

Initialize a TraditionalGitClient.

Parameters
path_encoding:strEncoding for paths (default: utf-8)
thin_packs:boolWhether or not thin packs should be retrieved
report_activity:Callable[[int, str], None] | NoneOptional callback for reporting transport activity
quiet:boolWhether to suppress progress output
include_tags:boolWhether to include tags
def archive(self, path: 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):

Request an archive of a specific commit.

Parameters
path:bytesRepository path
committish:bytesCommit ID or ref to archive
write_data:Callable[[bytes], None]Function to write archive data
progress:Callable[[bytes], None] | NoneOptional progress callback
write_error:Callable[[bytes], None] | NoneOptional error callback
format:bytes | NoneOptional archive format
subdirs:Sequence[bytes] | NoneOptional subdirectories to include
prefix:bytes | NoneOptional prefix for archived files
def fetch_pack(self, path: 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:

Retrieve a pack from a git smart server.

Parameters
path:bytes | strRemote path to fetch from
determine_wants:DetermineWantsFuncFunction determine what refs to fetch. Receives dictionary of name->sha, should return list of shas to fetch.
graph_walker:GraphWalkerObject with next() and ack().
pack_data:Callable[[bytes], int]Callback called for each bit of data in the pack
progress:Callable[[bytes], None] | NoneCallback for progress reports (strings)
depth:int | NoneShallow fetch depth
ref_prefix:Sequence[bytes] | NoneList of prefixes of desired references, as a list of bytestrings. Filtering is done by the server if supported, and client side otherwise.
filter_spec:bytes | NoneA git-rev-list-style object filter spec, as bytestring. Only used if the server supports the Git protocol-v2 'filter' feature, and ignored otherwise.
protocol_version:int | NoneDesired Git protocol version. By default the highest mutually supported protocol version will be used.
shallow_since:str | NoneDeepen the history to include commits after this date
shallow_exclude:list[str] | NoneDeepen the history to exclude commits reachable from these refs
Returns
FetchPackResultFetchPackResult object
def get_refs(self, path: bytes, protocol_version: int | None = None, ref_prefix: Sequence[bytes] | None = None) -> LsRemoteResult:

Retrieve the current refs from a git smart server.

def send_pack(self, path: 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:

Upload a pack to a remote repository.

Parameters
path:bytesRepository path (as bytestring)
update_refs:Callable[[dict[Ref, ObjectID]], dict[Ref, ObjectID]]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)
generate_pack_data:GeneratePackDataFuncFunction that can return a tuple with number of objects and pack data to upload.
progress:Callable[[bytes], None] | NoneOptional callback called with progress updates
push_options:Sequence[bytes] | NoneOptional list of push options to send to the server
atomic:boolIf True, request atomic push (all refs update or none do)
Returns
SendPackResultSendPackResult
Raises
SendPackErrorif server rejects the pack data
GitProtocolErrorif atomic push is requested but server doesn't support it
DEFAULT_ENCODING: str =

Undocumented

Value
'utf-8'
protocol_version =
def _connect(self, cmd: bytes, path: str | bytes, protocol_version: int | None = None) -> tuple[Protocol, Callable[[], bool], IO[bytes] | None]:

Create a connection to the server.

This method is abstract - concrete implementations should implement their own variant which connects to the server and returns an initialized Protocol object with the service ready for use and a can_read function which may be used to see if reads would block.

Parameters
cmd:bytesThe git service name to which we should connect.
path:str | bytesThe path we should pass to the service. (as bytestirng)
protocol_version:int | NoneDesired Git protocol version. By default the highest mutually supported protocol version will be used.
Returns
tuple[Protocol, Callable[[], bool], IO[bytes] | None]Undocumented
_remote_path_encoding =

Undocumented

_report_status_parser =