dulwich.server(View In Hierarchy)
A graph walker that knows the git protocol.
As a graph walker, this class implements ack(), next(), and reset(). It also contains some base methods for interacting with the wire and walking the commit tree.
The work of determining which acks to send is passed on to the implementation instance stored in _impl. The reason for this is that we do not know at object creation time what ack level the protocol requires. A call to set_ack_type() is required to set up the implementation, before any calls to next() or ack() are made.
|Method||determine_wants||Determine the wants for a set of heads.|
|Method||read_proto_line||Read a line from the wire.|
|Method||all_wants_satisfied||Check whether all the current wants are satisfied by a set of haves.|
Determine the wants for a set of heads.
The given heads are advertised to the client, who then specifies which refs he wants using 'want' lines. This portion of the protocol is the same regardless of ack type, and in fact is used to set the ack type of the ProtocolGraphWalker.
If the client has the 'shallow' capability, this method also reads and responds to the 'shallow' and 'deepen' lines from the client. These are not part of the wants per se, but they set up necessary state for walking the graph. Additionally, later code depends on this method consuming everything up to the first 'have' line.
|Parameters||heads||a dict of refname->SHA1 to advertise|
|Returns||a list of SHA1s requested by the client|
|Parameters||allowed||An iterable of command names that should be allowed.|
|Returns||A tuple of (command, value); see _split_proto_line.|
|Raises||UnexpectedCommandError||If an error occurred reading the line.|
|Parameters||haves||A set of commits we know the client has.|
|Note||Wants are specified with set_wants rather than passed in since in the current interface they are determined outside this class.|