module documentation

Client side support for the Git protocol.

The Dulwich client supports the following capabilities:

  • thin-pack
  • multi_ack_detailed
  • multi_ack
  • side-band-64k
  • ofs-delta
  • quiet
  • report-status
  • delete-refs
  • shallow

Known capabilities that are not supported:

  • no-progress
  • include-tag
Class AbstractHttpGitClient Abstract base class for HTTP Git Clients.
Class FetchPackResult Result of a fetch-pack operation.
Class GitClient Git smart server client.
Class LocalGitClient Git Client that just uses a local Repo.
Class PLinkSSHVendor SSH vendor that shells out to the local 'plink' command.
Class ReportStatusParser Handle status as reported by servers with 'report-status' capability.
Class SendPackResult Result of a upload-pack operation.
Class SSHGitClient Undocumented
Class SSHVendor A client side SSH implementation.
Class SubprocessGitClient Git client that talks to a server using a subprocess.
Class SubprocessSSHVendor SSH vendor that shells out to the local 'ssh' command.
Class SubprocessWrapper A socket-like object that talks to a subprocess via pipes.
Class TCPGitClient A Git Client that works over TCP directly (i.e. git://).
Class TraditionalGitClient Traditional Git client.
Class Urllib3HttpGitClient Undocumented
Exception HTTPProxyUnauthorized Raised when proxy authentication fails.
Exception HTTPUnauthorized Raised when authentication fails.
Exception InvalidWants Invalid wants.
Exception StrangeHostname Refusing to connect to strange SSH hostname.
Function check_for_proxy_bypass Undocumented
Function check_wants Check that a set of wants is valid.
Function default_urllib3_manager Return urllib3 connection pool manager.
Function default_user_agent_string Undocumented
Function find_git_command Find command to run for system Git (usually C Git).
Function get_credentials_from_store Undocumented
Function get_transport_and_path Obtain a git client from a URL.
Function get_transport_and_path_from_url Obtain a git client from a URL.
Function ParamikoSSHVendor Undocumented
Function parse_rsync_url Parse a rsync-style URL.
Function read_pkt_refs Undocumented
Constant COMMON_CAPABILITIES Undocumented
Constant DEFAULT_GIT_CREDENTIALS_PATHS Undocumented
Constant RECEIVE_CAPABILITIES Undocumented
Constant UPLOAD_CAPABILITIES Undocumented
Variable logger Undocumented
Variable url2pathname Undocumented
Class _v1ReceivePackHeader No class docstring; 0/4 instance variable, 1/3 method documented
Function _fileno_can_read Check if a file descriptor is readable.
Function _get_transport_and_path_from_url Undocumented
Function _handle_upload_pack_head Handle the head of a 'git-upload-pack' request.
Function _handle_upload_pack_tail Handle the tail of a 'git-upload-pack' request.
Function _read_shallow_updates Undocumented
Function _read_side_band64k_data Read per-channel data.
Function _remote_error_from_stderr Undocumented
Function _win32_peek_avail Wrapper around PeekNamedPipe to check how many bytes are available.
Function _win32_url_to_path Convert a file: URL to a path.
def check_for_proxy_bypass(base_url):

Undocumented

def check_wants(wants, refs):

Check that a set of wants is valid.

Returns:

Parameters
wantsSet of object SHAs to fetch
refsRefs dictionary to check against
def default_urllib3_manager(config, pool_manager_cls=None, proxy_manager_cls=None, base_url=None, **override_kwargs):

Return urllib3 connection pool manager.

Honour detected proxy configurations.

Parameters
configdulwich.config.ConfigDict instance with Git configuration.
pool_manager_clsUndocumented
proxy_manager_clsUndocumented
base_urlUndocumented
**override_kwargsAdditional arguments for urllib3.ProxyManager
Returns
Union[urllib3.ProxyManager, urllib3.PoolManager]Either pool_manager_cls (defaults to urllib3.ProxyManager) instance for proxy configurations, proxy_manager_cls (defaults to urllib3.PoolManager) instance otherwise
def default_user_agent_string():

Undocumented

def find_git_command():

Find command to run for system Git (usually C Git).

Returns
List[str]Undocumented
def get_credentials_from_store(scheme, hostname, username=None, fnames=DEFAULT_GIT_CREDENTIALS_PATHS):

Undocumented

def get_transport_and_path(location, config=None, operation=None, **kwargs):

Obtain a git client from a URL.

Parameters
location:strURL or path (a string)
config:Optional[Config]Optional config object
operation:Optional[str]Kind of operation that'll be performed; "pull" or "push"
**kwargs:AnyUndocumented
thin_packsWhether or not thin packs should be retrieved
report_activityOptional callback for reporting transport activity.
Returns
Tuple[GitClient, str]Tuple with client instance and relative path.
def get_transport_and_path_from_url(url, config=None, operation=None, **kwargs):

Obtain a git client from a URL.

Parameters
url:strURL to open (a unicode string)
config:Optional[Config]Optional config object
operation:Optional[str]Kind of operation that'll be performed; "pull" or "push"
**kwargsUndocumented
thin_packsWhether or not thin packs should be retrieved
report_activityOptional callback for reporting transport activity.
Returns
Tuple[GitClient, str]Tuple with client instance and relative path.
def ParamikoSSHVendor(**kwargs):

Undocumented

def parse_rsync_url(location):

Parse a rsync-style URL.

Parameters
location:strUndocumented
Returns
Tuple[Optional[str], str, str]Undocumented
def read_pkt_refs(pkt_seq):

Undocumented

COMMON_CAPABILITIES =
DEFAULT_GIT_CREDENTIALS_PATHS =

Undocumented

Value
[os.path.expanduser('~/.git-credentials'),
 get_xdg_config_home_path('git', 'credentials')]
logger =

Undocumented

url2pathname =

Undocumented

def _fileno_can_read(fileno):

Check if a file descriptor is readable.

def _get_transport_and_path_from_url(url, config, operation, **kwargs):

Undocumented

def _handle_upload_pack_head(proto, capabilities, graph_walker, wants, can_read, depth):

Handle the head of a 'git-upload-pack' request.

whether there is extra graph data to read on proto
depth: Depth for request

Returns:

Parameters
protoProtocol object to read from
capabilitiesList of negotiated capabilities
graph_walkerGraphWalker instance to call .ack() on
wantsList of commits to fetch
can_readfunction that returns a boolean that indicates
depthUndocumented
def _handle_upload_pack_tail(proto, capabilities, graph_walker, pack_data, progress=None, rbufsize=_RBUFSIZE):

Handle the tail of a 'git-upload-pack' request.

Returns:

Parameters
protoProtocol object to read from
capabilitiesList of negotiated capabilities
graph_walkerGraphWalker instance to call .ack() on
pack_dataFunction to call with pack data
progressOptional progress reporting function
rbufsizeRead buffer size
def _read_shallow_updates(pkt_seq):

Undocumented

def _read_side_band64k_data(pkt_seq, channel_callbacks):

Read per-channel data.

This requires the side-band-64k capability.

Parameters
pkt_seqSequence of packets to read
channel_callbacksDictionary mapping channels to packet handlers to use. None for a callback discards channel data.
def _remote_error_from_stderr(stderr):

Undocumented

def _win32_peek_avail(handle):

Wrapper around PeekNamedPipe to check how many bytes are available.

def _win32_url_to_path(parsed):

Convert a file: URL to a path.

https://datatracker.ietf.org/doc/html/rfc8089

Returns
strUndocumented