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'.
- For details on the pkt-line format, see the cgit distribution:
- Documentation/technical/protocol-common.txt
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | close |
Undocumented |
Method | eof |
Test whether the protocol stream has reached EOF. |
Method | read |
Read a command and some arguments from the git client |
Method | read |
Reads a pkt-line from the remote git process. |
Method | read |
Read a sequence of pkt-lines from the remote git process. |
Method | send |
Send a command and some arguments to a git server. |
Method | unread |
Unread a single line of data into the readahead buffer. |
Method | write |
Sends a pkt-line to the remote git process. |
Method | write |
Write multiplexed data to the sideband. |
Instance Variable | read |
Undocumented |
Instance Variable | report |
Undocumented |
Instance Variable | write |
Undocumented |
Instance Variable | _close |
Undocumented |
Instance Variable | _readahead |
Undocumented |
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.
Read a command and some arguments from the git client
Only used for the TCP git protocol (git://).
Returns: A tuple of (command, [list of arguments]).
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').
Read a sequence of pkt-lines from the remote git process.
- Returns: Yields each line of data up to but not including the next
- flush-pkt.
Send a command and some arguments to a git server.
Only used for the TCP git protocol (git://).
Parameters | |
cmd | The remote service to access. |
*args | List of arguments to send to remove service. |
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. |
Sends a pkt-line to the remote git process.
Parameters | |
line | A string containing the data to send, without the length prefix. |