Git smart network protocol server implementation.

For more detailed implementation on the network protocol, see the Documentation/technical directory in the cgit distribution, and in particular:

  • Documentation/technical/protocol-capabilities.txt
  • Documentation/technical/pack-protocol.txt

Currently supported capabilities:

  • include-tag
  • thin-pack
  • multi_ack_detailed
  • multi_ack
  • side-band-64k
  • ofs-delta
  • no-progress
  • report-status
  • delete-refs
  • shallow
  • symref
Class Backend A backend for the Git smart server implementation.
Class BackendRepo Repository abstraction used by the Git server.
Class DictBackend Trivial backend that looks up Git repositories in a dictionary.
Class FileSystemBackend Simple backend looking up Git repositories in the local file system.
Class Handler Smart protocol command handler base class.
Class PackHandler Protocol handler for packs.
Class UploadPackHandler Protocol handler for uploading a pack to the client.
Class SingleAckGraphWalkerImpl Graph walker implementation that speaks the single-ack protocol.
Class MultiAckGraphWalkerImpl Graph walker implementation that speaks the multi-ack protocol.
Class MultiAckDetailedGraphWalkerImpl Graph walker implementation speaking the multi-ack-detailed protocol.
Class ReceivePackHandler Protocol handler for downloading a pack from the client.
Class UploadArchiveHandler Undocumented
Class TCPGitRequestHandler Undocumented
Class TCPGitServer Undocumented
Function main Entry point for starting a TCP git server.
Function serve_command Serve a single command.
Function generate_info_refs Generate an info refs file.
Function generate_objects_info_packs Generate an index for for packs.
Function update_server_info Generate server info for dumb file access.
Function _split_proto_line Split a line read from the wire.
Function _find_shallow Find shallow commits according to a given depth.
Function _want_satisfied Undocumented
Function _all_wants_satisfied Check whether all the current wants are satisfied by a set of haves.
Class _ProtocolGraphWalker A graph walker that knows the git protocol.
def _split_proto_line(line, allowed):
Split a line read from the wire.
ParameterslineThe line read from the wire.
allowedAn iterable of command names that should be allowed. Command names not listed below as possible return values will be ignored. If None, any commands from the possible return values are allowed.
Returnsa tuple having one of the following forms: ('want', obj_id) ('have', obj_id) ('done', None) (None, None) (for a flush-pkt)
RaisesUnexpectedCommandErrorif the line cannot be parsed into one of the allowed return values.
def _find_shallow(store, heads, depth):
Find shallow commits according to a given depth.
ParametersstoreAn ObjectStore for looking up objects.
headsIterable of head SHAs to start walking from.
depthThe depth of ancestors to include. A depth of one includes only the heads themselves.
ReturnsA tuple of (shallow, not_shallow), sets of SHAs that should be considered shallow and unshallow according to the arguments. Note that these sets may overlap if a commit is reachable along multiple paths.
def _want_satisfied(store, haves, want, earliest):
Undocumented
def _all_wants_satisfied(store, haves, wants):
Check whether all the current wants are satisfied by a set of haves.
ParametersstoreObject store to retrieve objects from
havesA set of commits we know the client has.
wantsA set of commits the client wants
NoteWants are specified with set_wants rather than passed in since in the current interface they are determined outside this class.
def main(argv=sys.argv):
Entry point for starting a TCP git server.
def serve_command(handler_cls, argv=sys.argv, backend=None, inf=sys.stdin, outf=sys.stdout):

Serve a single command.

This is mostly useful for the implementation of commands used by e.g. git+ssh.

Parametershandler_clsHandler class to use for the request
argvexecv-style command-line arguments. Defaults to sys.argv.
backendBackend to use
infFile-like object to read from, defaults to standard input.
outfFile-like object to write to, defaults to standard output.
ReturnsExit code for use with sys.exit. 0 on success, 1 on failure.
def generate_info_refs(repo):
Generate an info refs file.
def generate_objects_info_packs(repo):
Generate an index for for packs.
def update_server_info(repo):

Generate server info for dumb file access.

This generates info/refs and objects/info/packs, similar to "git update-server-info".

API Documentation for Dulwich, generated by pydoctor at 2018-11-17 19:05:54.