class documentation

Git Client that just uses a local on-disk repository.

Class Method from_parsedurl Create an instance of LocalGitClient from a parsed URL.
Method __init__ Create a new LocalGitClient instance.
Method clone Clone a local repository.
Method fetch Fetch into a target repository.
Method fetch_pack Retrieve a pack from a local on-disk repository.
Method get_refs Retrieve the current refs from a local on-disk repository.
Method get_url Get the URL for a local file path.
Method send_pack Upload a pack to a local on-disk repository.
Class Method _open_repo Open a local repository.
Instance Variable _include_tags Undocumented
Instance Variable _quiet Undocumented
Instance Variable _report_activity Undocumented

Inherited from GitClient:

Method archive Retrieve an archive of the specified tree.
Method close Close the client and release any resources.
Method fetch_with_bundle_uri Fetch into a target repository, using bundle URIs for bootstrap.
Instance Variable protocol_version Undocumented
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_status_parser Undocumented
Instance Variable _send_capabilities 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) -> LocalGitClient:

Create an instance of LocalGitClient from a parsed URL.

Parameters
parsedurl:ParseResultResult of urlparse()
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
dumb:boolWhether to use dumb protocol (not used for LocalGitClient)
username:str | NoneUsername for authentication (not used for LocalGitClient)
password:str | NonePassword for authentication (not used for LocalGitClient)
config:Config | NoneOptional configuration object
Returns
LocalGitClientA LocalGitClient instance
def __init__(self, thin_packs: bool = True, report_activity: Callable[[int, str], None] | None = None, config: Config | None = None, quiet: bool = False, include_tags: bool = False):

Create a new LocalGitClient instance.

Parameters
thin_packs:boolWhether or not thin packs should be retrieved
report_activity:Callable[[int, str], None] | NoneOptional callback for reporting transport activity.
config:Config | NoneOptional configuration object
quiet:boolWhether to suppress progress output
include_tags:boolWhether to include tags
def clone(self, path: 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:

Clone a local repository.

For local clones, we can detect the object format before creating the target repository.

Note: bundle_uri is accepted for API compatibility but ignored for local clones since there's no benefit to using bundles for local operations.

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

Fetch into a target repository.

Parameters
path:bytes | strPath to fetch from (as bytestring)
target:BaseRepoTarget repository to fetch into
determine_wants:DetermineWantsFunc | NoneOptional function determine what refs to fetch. Receives dictionary of name->sha, should return list of shas to fetch. Defaults to all shas.
progress:Callable[[bytes], None] | NoneOptional progress function
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 | NoneOptional Git protocol version
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 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:

Retrieve a pack from a local on-disk repository.

Parameters
path:str | bytesRemote 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 | NoneOptional Git protocol version
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: str | bytes, protocol_version: int | None = None, ref_prefix: Sequence[bytes] | None = None) -> LsRemoteResult:

Retrieve the current refs from a local on-disk repository.

def get_url(self, path: str) -> str:

Get the URL for a local file path.

Parameters
path:strLocal file path
Returns
file// URL for the path
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:

Upload a pack to a local on-disk repository.

Parameters
path:str | 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) with number of items and pack data to upload.
generate_pack_data:GeneratePackDataFuncFunction that generates pack data given have and want object sets
progress:Callable[[bytes], None] | NoneOptional progress function
push_options:Sequence[bytes] | NoneOptional list of push options (not used for local repos)
atomic:boolIf True, use atomic ref updates (all succeed or all fail)
Returns
SendPackResultSendPackResult
Raises
SendPackErrorif server rejects the pack data
def _open_repo(cls, path: str | bytes) -> closing[Repo]:

Open a local repository.

Parameters
path:str | bytesRepository path (as bytes or str)
Returns
closing[Repo]Repo instance wrapped in a closing context manager
_include_tags =

Undocumented

_quiet =

Undocumented

_report_activity =