dulwich.protocol.Protocol(object)
class documentationdulwich.protocol
(View In Hierarchy)
Known subclasses: dulwich.protocol.ReceivableProtocol
Class for interacting with a remote git process over the wire.
Parts of the git wire protocol use 'pkt-lines' to communicate. A pkt-line consists of the length of the line as a 4-byte hex string, followed by the payload data. The length includes the 4-byte header. The special line '0000' indicates the end of a section of input and is called a 'flush-pkt'.
Method | __init__ | Undocumented |
Method | close | Undocumented |
Method | __enter__ | Undocumented |
Method | __exit__ | Undocumented |
Method | read_pkt_line | Reads a pkt-line from the remote git process. |
Method | eof | Test whether the protocol stream has reached EOF. |
Method | unread_pkt_line | Unread a single line of data into the readahead buffer. |
Method | read_pkt_seq | Read a sequence of pkt-lines from the remote git process. |
Method | write_pkt_line | Sends a pkt-line to the remote git process. |
Method | write_file | Return a writable file-like object for this protocol. |
Method | write_sideband | Write multiplexed data to the sideband. |
Method | send_cmd | Send a command and some arguments to a git server. |
Method | read_cmd | Read a command and some arguments from the git client |
Reads a pkt-line from the remote git process.
This method may read from the readahead buffer; see unread_pkt_line.
Returns | The next string from the stream, without the length prefix, or None for a flush-pkt ('0000'). |
Test whether the protocol stream has reached EOF.
Note that this refers to the actual stream EOF and not just a flush-pkt.
Returns | True if the stream is at EOF, False otherwise. |
Unread a single line of data into the readahead buffer.
This method can be used to unread a single pkt-line into a fixed readahead buffer.
Parameters | data | The data to unread, without the length prefix. |
Raises | ValueError | If more than one pkt-line is unread. |
Returns | Yields each line of data up to but not including the next flush-pkt. |
Parameters | line | A string containing the data to send, without the length prefix. |
Parameters | channel | An int specifying the channel to write to. |
blob | A blob of data (as a string) to send on this channel. |