ó
    ‘óýj-‰  ã            	       óV  • % S r / SQrSSKrSSKrSSKrSSKJrJrJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  SSKrSS	KJrJr  SS
KJrJr  \R0                  S:¼  a  SSKJr  OSSKJr  \R6                  " \5      r\(       a  SSKJr  SSK J!r!  Sr"/ SQr#Sr$Sr%Sr&\" S5      r'\\(S'   Sr)Sr*Sr+Sr,Sr-Sr.Sr/Sr0Sr1Sr2Sr3Sr4Sr5Sr6Sr7Sr8S r9S!r:S"r;S#r<S$r=S%r>S&r?S'r@S(rAS)rBS*rCS+rDS,rES-rFS.rGS/rHS0rI\9\=\>\@\8/rJ\K" / \JQ\?P\5P\6P\4P\0P\AP\<P\1P\2P\BP\CP\DP\EP\GP5      rL\K" / \JQ\;P\3P\:P\/P\HP5      rMS1rNS2rOS3\P4S4 jrQS3\P4S5 jrRS6\SS3\P4S7 jrTS8\PS9\PS3\P4S: jrUS;\\P   S3\K\P   4S< jrVS=\PS3\W\P\PS-  4   4S> jrXS?\\W\P\P4      S3\Y\P   4S@ jrZSAr[Sr\Sr]S#r^SBr_SCr`SDraSErbS,rcSF\PSG\PS3\P4SH jrdSI\PS3\W\P\Y\P   4   4SJ jreSK\PS-  S3\P4SL jrfSM\PS-  S3\P4SN jrg\h" SO5      riSP\PS3\j4SQ jrk " SR SS5      rlSTrm " SU SV\l5      rnSW\PS3\W\P\Y\P   4   4SX jroSW\PS3\W\P\Y\P   4   4SY jrpS;\\P   S3\j4SZ jrqS;\\P   S[\PS3\PS-  4S\ jrr " S] S^5      rs " S_ S`5      rtS;\\P   S3\P4Sa jru SmSb\PSc\PS;\
\P   S-  S3\P4Sd jjrvSc\PS3\P4Se jrwSc\PS3\P4Sf jrxSnSc\PSg\PS3\P4Sh jjry    SoSi jrz    SpSj jr{      SqSk jr|      SrSl jr}g)sz<Generic functions for talking the git smart server protocol.)QÚCAPABILITIES_REFÚCAPABILITY_AGENTÚ'CAPABILITY_ALLOW_REACHABLE_SHA1_IN_WANTÚ!CAPABILITY_ALLOW_TIP_SHA1_IN_WANTÚCAPABILITY_ATOMICÚCAPABILITY_DEEPEN_NOTÚCAPABILITY_DEEPEN_RELATIVEÚCAPABILITY_DEEPEN_SINCEÚCAPABILITY_DELETE_REFSÚCAPABILITY_FETCHÚCAPABILITY_FILTERÚCAPABILITY_INCLUDE_TAGÚCAPABILITY_MULTI_ACKÚCAPABILITY_MULTI_ACK_DETAILEDÚCAPABILITY_NO_DONEÚCAPABILITY_NO_PROGRESSÚCAPABILITY_OBJECT_FORMATÚCAPABILITY_OFS_DELTAÚCAPABILITY_PACKFILE_URISÚCAPABILITY_PUSH_OPTIONSÚCAPABILITY_QUIETÚCAPABILITY_REPORT_STATUSÚCAPABILITY_SHALLOWÚCAPABILITY_SIDE_BANDÚCAPABILITY_SIDE_BAND_64KÚCAPABILITY_SYMREFÚCAPABILITY_THIN_PACKÚCOMMAND_DEEPENÚCOMMAND_DEEPEN_NOTÚCOMMAND_DEEPEN_SINCEÚCOMMAND_DONEÚCOMMAND_FILTERÚCOMMAND_HAVEÚCOMMAND_SHALLOWÚCOMMAND_UNSHALLOWÚCOMMAND_WANTÚCOMMON_CAPABILITIESÚ"DEFAULT_GIT_PROTOCOL_VERSION_FETCHÚ!DEFAULT_GIT_PROTOCOL_VERSION_SENDÚDEPTH_INFINITEÚGIT_PROTOCOL_VERSIONSÚKNOWN_RECEIVE_CAPABILITIESÚKNOWN_UPLOAD_CAPABILITIESÚ	MULTI_ACKÚMULTI_ACK_DETAILEDÚNAK_LINEÚPEELED_TAG_SUFFIXÚSIDE_BAND_CHANNEL_DATAÚSIDE_BAND_CHANNEL_FATALÚSIDE_BAND_CHANNEL_PROGRESSÚ
SINGLE_ACKÚTCP_GIT_PORTÚZERO_SHAÚBufferedPktLineWriterÚPktLineParserÚProtocolÚReceivableProtocolÚack_typeÚagent_stringÚcapability_agentÚcapability_object_formatÚcapability_symrefÚextract_capabilitiesÚextract_capability_namesÚextract_want_line_capabilitiesÚfind_capabilityÚformat_ack_lineÚformat_capability_lineÚformat_cmd_pktÚformat_ref_lineÚformat_shallow_lineÚformat_unshallow_lineÚparse_capabilityÚparse_cmd_pktÚpkt_lineÚpkt_seqÚserialize_refsÚsplit_peeled_refsÚstrip_peeled_refsÚsymref_capabilitiesÚwrite_info_refsé    N)ÚCallableÚIterableÚIteratorÚMappingÚSequence)ÚBytesIO)ÚSEEK_END)ÚTYPE_CHECKINGé   )ÚGitProtocolErrorÚHangupException)ÚObjectIDÚTag)é   é   )ÚSelf)ÚObjectContainer©ÚRefiÊ$  )rS   r\   é   rg   s   ^{}s(   0000000000000000000000000000000000000000r6   ra   s   atomics   deepen-sinces
   deepen-nots   deepen-relatives   delete-refss   include-tagó	   multi_ackó   multi_ack_detaileds   no-dones   no-progresss	   ofs-deltas   quiets   report-statuss   shallows	   side-bands   side-band-64ks	   thin-packs   agents   symrefs   allow-tip-sha1-in-wants   allow-reachable-sha1-in-wants   fetchs   filters   object-formats   packfile-uriss   push-optionss   capabilities^{}iÿÿÿs   NAK
Úreturnc                  ó€   • SSR                  [        [        [        R                  5      5      -   R                  S5      $ )zIGenerate the agent string for dulwich.

Returns:
  Agent string as bytes
zdulwich/Ú.Úascii)ÚjoinÚmapÚstrÚdulwichÚ__version__Úencode© ó    Ú;/usr/local/lib/python3.13/site-packages/dulwich/protocol.pyr<   r<   ð   s0   € ð ˜Ÿ™¤#¤c¬7×+>Ñ+>Ó"?Ó@Ñ@×HÑHÈÓQÐQru   c                  ó*   • [         S-   [        5       -   $ )zXGenerate the agent capability string.

Returns:
  Agent capability with dulwich version
ó   =)r   r<   rt   ru   rv   r=   r=   ù   s   € ô ˜dÑ"¤\£^Ñ3Ð3ru   Úfmtc                 ó8   • [         S-   U R                  S5      -   $ )z Generate the object-format capability string.

Args:
  fmt: Object format name (e.g., "sha1" or "sha256")

Returns:
  Object-format capability with format name
rx   rm   )r   rs   )ry   s    rv   r>   r>     s   € ô $ dÑ*¨S¯Z©Z¸Ó-@Ñ@Ð@ru   Úfrom_refÚto_refc                 ó&   • [         S-   U -   S-   U-   $ )z“Generate a symref capability string.

Args:
  from_ref: Source reference name
  to_ref: Target reference name

Returns:
  Symref capability string
rx   ó   :)r   )r{   r|   s     rv   r?   r?     s   € ô ˜tÑ# hÑ.°Ñ5¸Ñ>Ð>ru   Úcapabilitiesc                 óJ   • U  Vs1 s H  n[        U5      S   iM     sn$ s  snf )zŒExtract capability names from a list of capabilities.

Args:
  capabilities: List of capability strings

Returns:
  Set of capability names
rS   )rJ   ©r   Úcs     rv   rA   rA     s'   € ñ -9Ó9ªL qÔ˜QÓ Ô"©LÑ9Ð9ùÒ9s   … Ú
capabilityc                 óf   • U R                  SS5      n[        U5      S:X  a  US   S4$ US   US   4$ )z�Parse a capability string into name and value.

Args:
  capability: Capability string

Returns:
  Tuple of (capability_name, capability_value)
rx   r\   rS   N)ÚsplitÚlen)rƒ   Úpartss     rv   rJ   rJ   '  sC   € ð ×Ñ˜T 1Ó%€EÜ
ˆ5ƒz�QƒØ�a‘˜$ÐÐØ�!‰H�e˜A‘hÐÐru   Úsymrefsc                 ó>   • U  Vs/ s H  n[        U6 PM     sn$ s  snf )zœGenerate symref capability strings from symref pairs.

Args:
  symrefs: Iterable of (from_ref, to_ref) tuples

Returns:
  List of symref capability strings
)r?   )rˆ   Úks     rv   rQ   rQ   6  s"   € ñ ,3Ó3ª7 aÔ˜qÓ!©7Ñ3Ð3ùÒ3s   …s   deepens	   unshallows   dones   wants   haveÚcmdÚargsc                 ó`   • U S-   SR                  U Vs/ s H  o"S-   PM	     sn5      -   $ s  snf )ztFormat a command packet.

Args:
  cmd: Command name
  *args: Command arguments

Returns:
  Formatted command packet
ó    ru   ó    ©rn   )r‹   rŒ   Úas      rv   rF   rF   M  s0   € ð �‰:˜Ÿ™±tÓ!<²t°! u¤9±tÑ!<Ó=Ñ=Ð=ùÒ!<s   ”+
Úlinec                 óz   • U R                  S5      nU SU XS-   S p2USS S:X  d   eX#SS R                  S5      4$ )ziParse a command packet.

Args:
  line: Command line to parse

Returns:
  Tuple of (command, [arguments])
rŽ   Nr\   éÿÿÿÿr�   )Úfindr…   )r’   Ú	splice_atr‹   rŒ   s       rv   rK   rK   Z  sT   € ð —	‘	˜$“€IØ�Z�iÐ  $°1¡} Ð"7ˆØ��ˆ9˜ÓÐÐØ�S�b�	—‘ Ó&Ð&Ð&ru   Údatac                 óN   • U c  g[        U 5      S-   S R                  S5      U -   $ )zÁWrap data in a pkt-line.

Args:
  data: The data to wrap, as a str or None.
Returns: The data prefixed with its length in pkt-line format; if data was
    None, returns the flush-pkt ('0000').
s   0000é   Ú04xrm   )r†   rs   )r—   s    rv   rL   rL   i  s/   € ð �|ØÜ�$‹i˜!‰m˜CÐ ×(Ñ(¨Ó1°DÑ8Ð8ru   Úseqc                  óz   • SR                  U  Vs/ s H  n[        U5      PM     sn5      [        S5      -   $ s  snf )zTWrap a sequence of data in pkt-lines.

Args:
  seq: An iterable of strings to wrap.
ru   N)rn   rL   )r›   Úss     rv   rM   rM   v  s2   € ð �8‰8©#Ó.ª# Q”X˜a–[©#Ñ.Ó/´(¸4³.Ñ@Ð@ùÒ.s   �8s   0123456789abcdefABCDEFÚsizestrc                 óŠ   • [        U 5      S:w  d  [        R                  U 5      (       d  [        SU < 35      e[	        U S5      $ )a  Parse the four-byte length prefix of a pkt-line.

Mirrors git's ``packet_length()``: the prefix must be exactly four
hexadecimal digits. ``int(sizestr, 16)`` on its own also accepts a leading
``+``/``-``, surrounding whitespace, an ``0x`` prefix and digit-group
underscores, none of which git allows. Accepting a ``-``-prefixed prefix is
the dangerous case: the resulting negative length turns the following
``read(size - 4)`` into a ``read()`` with a negative argument (which reads
the rest of the stream into memory) and makes the incremental
:class:`PktLineParser` loop without ever consuming its buffer.

Args:
  sizestr: The four raw length bytes read from the wire.
Returns: The length encoded by the prefix.

Raises:
  GitProtocolError: if the prefix is not four hexadecimal digits.
r™   z Invalid pkt-line length prefix: é   )r†   Ú_HEX_DIGITSÚ
issupersetr]   Úint)rž   s    rv   Ú_parse_pkt_line_lengthr¤   ‚  s@   € ô& ˆ7ƒ|�qÓ¤× 6Ñ 6°w× ?Ñ ?ÜÐ!AÀ'ÁÐMÓNÐNÜˆw˜ÓÐru   c                   ó¸  • \ rS rSrSr   S"S\\/\4   S\\/\S-  4   S\/ S4   S-  S\\\/S4   S-  S\/ S4   S-  S	S4S
 jjr	S#S jr
S#S jrS#S jrS	\4S jrS\\   S-  S\S-  S\R$                  S-  S	S4S jrS	\S-  4S jrS	\4S jrS\S-  S	S4S jrS	\\   4S jrS\S-  S	S4S jrS\S\S	S4S jrS\S\S	S4S jrS	\\\\   4   4S  jrS!r g)$r9   iš  a×  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
NÚreadÚwriteÚcloseÚreport_activityÚshutdown_writerj   c                 óN   • Xl         X l        X0l        X@l        XPl        SU l        g)ae  Initialize Protocol.

Args:
  read: Function to read bytes from the transport
  write: Function to write bytes to the transport
  close: Optional function to close the transport
  report_activity: Optional function to report activity
  shutdown_write: Optional function to half-close the write side of
    the transport once the request has been fully sent
N)r¦   r§   Ú_closer©   Ú_shutdown_writeÚ
_readahead)Úselfr¦   r§   r¨   r©   rª   s         rv   Ú__init__ÚProtocol.__init__¦  s&   € ð$ Œ	ØŒ
ØŒØ.ÔØ-ÔØ*.ˆ�ru   c                 óN   • U R                   b  U R                  5         SU l         gg)a  Half-close the write side of the transport, if supported.

Signals to the peer that no more data will be sent. On Windows a
server that closes a socket with client data still unread aborts with
an RST rather than a clean FIN; letting it read to EOF avoids that.
N)r­   ©r¯   s    rv   rª   ÚProtocol.shutdown_write¿  s)   € ð ×ÑÑ+Ø× Ñ Ô"Ø#'ˆDÕ ð ,ru   c                 óV   • U R                   (       a  U R                  5         SU l         gg)z@Close the underlying transport if a close function was provided.N)r¬   r³   s    rv   r¨   ÚProtocol.closeÊ  s   € à�;�;Ø�K‰KŒMØˆD�Kð ru   c                 óž   • U R                   b0  SSKnUR                  SU < 3[        SU S9   U R	                  5         gg! [
         a     gf = f)z>Ensure transport is closed when Protocol is garbage collected.NrS   zunclosed Protocol rg   )Ú
stacklevelÚsource)r¬   ÚwarningsÚwarnÚResourceWarningr¨   Ú	Exception)r¯   rº   s     rv   Ú__del__ÚProtocol.__del__Ð  sZ   € à�;‰;Ñ"Ûà�M‰MØ$ T¡HÐ-ÜØØð	 ñ ðØ—
‘
•ð #øô ó áðús   ­? ¿
AÁAc                 ó   • U $ )zEnter context manager.rt   r³   s    rv   Ú	__enter__ÚProtocol.__enter__á  s   € àˆru   Úexc_typeÚexc_valÚexc_tbc                 ó$   • U R                  5         g)z)Exit context manager and close transport.N)r¨   )r¯   rÃ   rÄ   rÅ   s       rv   Ú__exit__ÚProtocol.__exit__å  s   € ð 	�
‰
�ru   c                 óR  • U R                   c  U R                  nOU R                   R                  nSU l          U" S5      nU(       d  [        e[        U5      nUS:X  d  US:X  aI  U R                  (       a  U R	                  SS5        [
        R                  SUR                  S5      5        gUS:  a  [        SUS	 35      eU R                  (       a  U R	                  US5        U" US-
  5      n[        U5      S-   U:w  a  [        S
[        U5      S-   S	 SUS	 35      e[        U5      S:”  a%  [
        R                  SUSS [        U5      5        U$ [
        R                  SU5        U$ ! [         a  n[        UeSnAf[         a  n[        [        U5      5      UeSnAff = f)zö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') or delim-pkt ('0001').
Nr™   rS   r\   r¦   zgit< %srm   úInvalid pkt-line length: rš   zLength of pkt read z does not match length prefix éP   zgit< %s... (%d bytes))r®   r¦   r^   r¤   r©   ÚloggerÚdebugÚdecoder]   r†   ÚConnectionResetErrorÚOSErrorrp   )r¯   r¦   rž   ÚsizeÚpkt_contentsÚexcs         rv   Úread_pkt_lineÚProtocol.read_pkt_lineî  s”  € ð �?‰?Ñ"Ø—9‘9‰Dà—?‘?×'Ñ'ˆDØ"ˆDŒOð	 Ù˜1“gˆGÞÜ%Ð%Ü)¨'Ó2ˆDØ�q‹y˜D A›IØ×'×'Ø×(Ñ(¨¨FÔ3Ü—‘˜Y¨¯©°wÓ(?Ô@ØØ�a‹xÜ&Ð)BÀ4ÈÀ*Ð'MÓNÐNØ×#×#Ø×$Ñ$ T¨6Ô2Ù  q¡›>ˆLô �<Ó  1Ñ$¨Ó,Ü&Ø)¬#¨lÓ*;¸aÑ*?ÀÐ)DÐDbÐcgÐhkÐblÐmóð ô �<Ó  2Ó%Ü—‘Ø+¨\¸#¸2Ð->ÄÀLÓ@Qôð
  Ðô —‘˜Y¨Ô5ØÐøô! $ó 	+Ü! sÐ*ûÜó 	6Ü"¤3 s£8Ó,°#Ð5ûð	6ús+   ¹A4E. Â.AE. Å.
F&Å8E?Å?F&ÆF!Æ!F&c                 óh   •  U R                  5       nU R                  U5        g! [         a     gf = f)zµ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.
TF)rÔ   r^   Úunread_pkt_line)r¯   Ú	next_lines     rv   ÚeofÚProtocol.eof  s<   € ð	Ø×*Ñ*Ó,ˆIð 	×Ñ˜YÔ'Øøô ó 	Ùð	ús   ‚$ ¤
1°1r—   c                 óf   • U R                   b  [        S5      e[        [        U5      5      U l         g)a  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.

Args:
  data: The data to unread, without the length prefix.

Raises:
  ValueError: If more than one pkt-line is unread.
Nz'Attempted to unread multiple pkt-lines.)r®   Ú
ValueErrorrY   rL   ©r¯   r—   s     rv   r×   ÚProtocol.unread_pkt_line,  s*   € ð �?‰?Ñ&ÜÐFÓGÐGÜ!¤(¨4£.Ó1ˆ�ru   c              #   óv   #   • U R                  5       nU(       a  Uv •  U R                  5       nU(       a  M  gg7f)z�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.
N)rÔ   )r¯   Úpkts     rv   Úread_pkt_seqÚProtocol.read_pkt_seq<  s2   é € ð × Ñ Ó"ˆÞØŠIØ×$Ñ$Ó&ˆC÷ Šcùs   ‚39·9r’   c                 óª  •  Uc  [         R                  S5        OI[        U5      S:”  a$  [         R                  SUSS [        U5      5        O[         R                  SU5        [        U5      nU R	                  U5        U R
                  (       a  U R                  [        U5      S5        gg! [         a  n[        [        U5      5      UeSnAff = f)z€Sends a pkt-line to the remote git process.

Args:
  line: A string containing the data to send, without the length
    prefix.
Nz	git> 0000rË   zgit> %s... (%d bytes)zgit> %sr§   )	rÌ   rÍ   r†   rL   r§   r©   rÐ   r]   rp   )r¯   r’   rÓ   s      rv   Úwrite_pkt_lineÚProtocol.write_pkt_lineG  s¤   € ð	6à‰|Ü—‘˜[Õ)Ü�T“˜R“Ü—‘Ð4°d¸3¸B°iÄÀTÃÕKä—‘˜Y¨Ô-ä˜D“>ˆDØ�J‰J�tÔØ×#×#Ø×$Ñ$¤S¨£Y°Õ8ð $øäó 	6Ü"¤3 s£8Ó,°#Ð5ûð	6ús   ‚B*B. Â.
CÂ8CÃCÚchannelÚblobc                 ó„   • U(       a9  U R                  [        [        U/5      5      USS -   5        USS nU(       a  M8  gg)z£Write multiplexed data to the sideband.

Args:
  channel: An int specifying the channel to write to.
  blob: A blob of data (as a string) to send on this channel.
Néëÿ  )rä   ÚbytesÚ	bytearray)r¯   ræ   rç   s      rv   Úwrite_sidebandÚProtocol.write_sideband^  s>   € ö Ø×Ñ¤¤i°°	Ó&:Ó ;¸dÀ6ÀE¸lÑ JÔKØ˜˜�<ˆD÷ Šdru   r‹   rŒ   c                 ó:   • U R                  [        U/UQ76 5        g)zÂSend a command and some arguments to a git server.

Only used for the TCP git protocol (git://).

Args:
  cmd: The remote service to access.
  args: List of arguments to send to remove service.
N)rä   rF   )r¯   r‹   rŒ   s      rv   Úsend_cmdÚProtocol.send_cmdl  s   € ð 	×ÑœN¨3Ð6°Ò6Õ7ru   c                 óT   • U R                  5       nUc  [        S5      e[        U5      $ )zš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]).
z"Expected command, got flush packet)rÔ   r]   rK   )r¯   r’   s     rv   Úread_cmdÚProtocol.read_cmdw  s.   € ð ×!Ñ!Ó#ˆØ‰<Ü"Ð#GÓHÐHÜ˜TÓ"Ð"ru   )r¬   r®   r­   r¦   r©   r§   )NNN©rj   N)!Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rT   r£   rê   rp   r°   rª   r¨   r¾   rc   rÁ   ÚtypeÚBaseExceptionÚtypesÚTracebackTyperÇ   rÔ   ÚboolrÙ   r×   rU   rá   rä   rì   rï   ÚtupleÚlistrò   Ú__static_attributes__rt   ru   rv   r9   r9   š  s¤  † ñ	ð ,0Ø=AØ48ñ/à˜�u˜e�|Ñ$ð/ð ˜˜  t¡Ð+Ñ,ð/ð ˜˜D˜Ñ! DÑ(ð	/ð
 " 3¨ *¨dÐ"2Ñ3°dÑ:ð/ð !  T Ñ*¨TÑ1ð/ð 
õ/ô2	(ôôð"˜4ô ðà�}Ñ%¨Ñ,ðð  Ñ%ðð ×#Ñ# dÑ*ð	ð
 
ôð- ˜u t™|ô - ð^�Tô ð2 E¨D¡Lð 2°Tô 2ð 	'˜h u™oô 	'ð6 5¨4¡<ð 6°Dô 6ð.  cð  °ð  ¸4ô  ð	8˜Eð 	8¨%ð 	8°Dô 	8ð
#˜%  t¨E¡{Ð 2Ñ3÷ 
#ru   r9   i   c                   ó¸   ^ • \ rS rSrSrSS\4S\\/\4   S\\/\S-  4   S\/ S4   S-  S\\\	/S4   S-  S\S	S4U 4S
 jjjr
S\S	\4S jrS\S	\4S jrSrU =r$ )r:   i‡  aµ  Variant of Protocol that allows reading up to a size without blocking.

This class has a recv() method that behaves like socket.recv() in addition
to a read() method.

If you want to read n bytes from the wire and block until exactly n bytes
(or EOF) are read, use read(n). If you want to read at most n bytes from
the wire but don't care if you get less, use recv(n). Note that recv(n)
will still block until at least one byte is read.
NÚrecvr§   r¨   r©   Úrbufsizerj   c                 ón   >• [         TU ]  U R                  X#US9  Xl        [	        5       U l        XPl        g)a  Initialize ReceivableProtocol.

Args:
  recv: Function to receive bytes from the transport
  write: Function to write bytes to the transport
  close: Optional function to close the transport
  report_activity: Optional function to report activity
  rbufsize: Read buffer size
)r¨   r©   N)Úsuperr°   r¦   Ú_recvrY   Ú_rbufÚ	_rbufsize)r¯   r  r§   r¨   r©   r  Ú	__class__s         €rv   r°   ÚReceivableProtocol.__init__“  s0   ø€ ô" 	‰Ñ˜Ÿ™ EÈÐÑXØŒ
Ü“YˆŒ
Ø!�ru   rÑ   c                 óè  • US:”  d   eU R                   nUR                  5       nUR                  S[        5        UR                  5       U-
  nXA:¼  aw  UR                  U5        UR	                  U5      n[        5       U l         U R                   R                  UR	                  5       5        U R                   R                  S5        U$ [        5       U l          X-
  nU R                  U5      nU(       d  O\[        U5      nX�:X  a	  U(       d  U$ X†:X  a  UR                  U5        AO+X†::  d   SU SU S35       eUR                  U5        XH-  nAMy  UR                  U5        UR	                  5       $ )zfRead bytes from the socket.

Args:
  size: Number of bytes to read

Returns:
  Bytes read from socket
rS   z_recv(z) returned z bytes)	r  ÚtellÚseekrZ   r¦   rY   r§   r  r†   )	r¯   rÑ   ÚbufÚstartÚbuf_lenÚrvÚleftr—   Úns	            rv   r¦   ÚReceivableProtocol.read©  s=  € ð& �a‹xˆˆxð
 �j‰jˆØ—‘“
ˆØ�‰�”HÔà—(‘(“*˜uÑ$ˆØ‹?à�H‰H�UŒOØ—‘˜$“ˆBÜ ›ˆDŒJØ�J‰J×Ñ˜SŸX™X›ZÔ(Ø�J‰J�O‰O˜AÔØˆIä“YˆŒ
ØØ‘>ˆDð —:‘:˜dÓ#ˆDÞØÜ�D“	ˆAØ‹y¦ð �Ø‹yØ—	‘	˜$”ØØØ“9ÐA  t f¨K¸°s¸&ÐAÓA�9Ø�I‰I�dŒOØ‰LˆGØñ3 ð6 	�‰�ŒØ�x‰x‹zÐru   c                 ó®  • US:”  d   eU R                   nUR                  5       nUR                  S[        5        UR                  5       nUR                  U5        XC-
  nU(       d_  U R	                  U R
                  5      n[        U5      U:X  a  U$ [        5       nUR                  U5        UR                  S5        AX l         UR                  U5      $ )z‡Receive bytes from the socket with buffering.

Args:
  size: Maximum number of bytes to receive

Returns:
  Bytes received from socket
rS   )
r  r  r  rZ   r  r	  r†   rY   r§   r¦   )r¯   rÑ   r  r  r  r  r—   s          rv   r  ÚReceivableProtocol.recvî  s§   € ð �a‹xˆˆxà�j‰jˆØ—‘“
ˆØ�‰�”HÔØ—(‘(“*ˆØ�‰�Œà‰ˆÞà—:‘:˜dŸn™nÓ-ˆDÜ�4‹y˜DÓ à�Ü“)ˆCØ�I‰I�dŒOØ�H‰H�QŒKØØŒJØ�x‰x˜‹~Ðru   )r  r	  r  )rõ   rö   r÷   rø   rù   Ú	_RBUFSIZErT   r£   rê   rp   r°   r¦   r  r  Ú__classcell__)r
  s   @rv   r:   r:   ‡  sÂ   ø† ñ	ð ,0Ø=AØ!ñ"à˜�u˜e�|Ñ$ð"ð ˜˜  t¡Ð+Ñ,ð"ð ˜˜D˜Ñ! DÑ(ð	"ð
 " 3¨ *¨dÐ"2Ñ3°dÑ:ð"ð ð"ð 
÷"ð "ð,C˜ð C ô CðJ˜ð  ÷ ò ru   r:   Útextc                 ó˜   • SU ;  a  U / 4$ U R                  5       R                  S5      u  pXR                  5       R                  S5      4$ )z©Extract a capabilities list from a string, if present.

Args:
  text: String to extract from
Returns: Tuple with text with capabilities removed and list of capabilities
r�   rŽ   )Úrstripr…   Ústrip)r  r   s     rv   r@   r@     sK   € ð �DÓØ�RˆxˆØŸ™›×,Ñ,¨UÓ3Ñ€DØ×$Ñ$Ó&×,Ñ,¨TÓ2Ð3Ð3ru   c                 ó˜   • U R                  5       R                  S5      n[        U5      S:  a  U / 4$ SR                  USS 5      USS 4$ )a\  Extract a capabilities list from a want line, if present.

Note that want lines have capabilities separated from the rest of the line
by a space instead of a null byte. Thus want lines have the form:

    want obj-id cap1 cap2 ...

Args:
  text: Want line to extract from
Returns: Tuple with text with capabilities removed and list of capabilities
rŽ   ra   Nrg   )r  r…   r†   rn   )r  Ú
split_texts     rv   rB   rB     sO   € ð —‘“×$Ñ$ TÓ*€JÜ
ˆ:ƒ˜ÓØ�RˆxˆØ�I‰I�j  !�nÓ% z°!°" ~Ð6Ð6ru   c                 ó>   • SU ;   a  [         $ SU ;   a  [        $ [        $ )z.Extract the ack type from a capabilities list.ri   rh   )r.   r-   r4   )r   s    rv   r;   r;   -  s$   € à Ó,Ü!Ð!Ø	˜Ó	%ÜÐÜÐru   Úcapability_namesc                 óš   • U  HE  nU H<  nX#:X  a  Us  s  $ UR                  US-   5      (       d  M)  U[        U5      S-   S s  s  $    MG     g)a²  Find a capability value in a list of capabilities.

This function looks for capabilities that may include arguments after an equals sign
and returns only the value part (after the '='). For capabilities without values,
returns the capability name itself.

Args:
  capabilities: List of capability strings
  capability_names: Capability name(s) to search for

Returns:
  The value after '=' if found, or the capability name if no '=', or None if not found

Example:
  >>> caps = [b'filter=blob:none', b'agent=git/2.0', b'thin-pack']
  >>> find_capability(caps, b'filter')
  b'blob:none'
  >>> find_capability(caps, b'thin-pack')
  b'thin-pack'
  >>> find_capability(caps, b'missing')
  None
rx   r\   N)Ú
startswithr†   )r   r!  ÚcapÚnames       rv   rC   rC   6  sO   € ó2 ˆÛ$ˆDØ‹{Ø”
Ø—‘  t¡×,Ó,Øœ3˜t›9 q™=˜?Ð+Ô+ó	 %ñ ð ru   c                   ób   • \ rS rSrSr SS\\/\S-  4   S\SS4S jjrS\SS4S	 jr	SS
 jr
Srg)r7   iX  a  Writer that wraps its data in pkt-lines and has an independent buffer.

Consecutive calls to write() wrap the data in a pkt-line and then buffers
it until enough lines have been written such that their total length
(including length prefix) reach the buffer size.
r§   NÚbufsizerj   c                 óH   • Xl         X l        [        5       U l        SU l        g)z¢Initialize the BufferedPktLineWriter.

Args:
  write: A write callback for the underlying writer.
  bufsize: The internal buffer size, including length prefixes.
rS   N)Ú_writeÚ_bufsizerY   Ú_wbufÚ_buflen)r¯   r§   r'  s      rv   r°   ÚBufferedPktLineWriter.__init__`  s   € ð ŒØŒÜ“YˆŒ
Øˆ�ru   r—   c                 óX  • [        U5      n[        U5      nU R                  U-   U R                  -
  nUS:¼  a3  X4-
  nU R                  R                  USU 5        U R                  5         OSnX%S nU R                  R                  U5        U =R                  [        U5      -  sl        g)z&Write data, wrapping it in a pkt-line.rS   N)rL   r†   r,  r*  r+  r§   Úflush)r¯   r—   r’   Úline_lenÚoverr  Úsaveds          rv   r§   ÚBufferedPktLineWriter.writen  sŒ   € ä˜‹~ˆÜ�t“9ˆØ�|‰|˜hÑ&¨¯©Ñ6ˆØ�1‹9Ø‘OˆEØ�J‰J×Ñ˜T & 5˜\Ô*Ø�J‰J�LàˆEØ�V�ˆØ�
‰
×Ñ˜ÔØ�Šœ˜E›
Ñ"Žru   c                 ó”   • U R                   R                  5       nU(       a  U R                  U5        SU l        [	        5       U l         g)zFlush all data from the buffer.rS   N)r+  Úgetvaluer)  Ú_lenrY   rÝ   s     rv   r/  ÚBufferedPktLineWriter.flush}  s3   € à�z‰z×"Ñ"Ó$ˆÞØ�K‰K˜ÔØˆŒ	Ü“Yˆ�
ru   )r,  r*  r6  r+  r)  )ré   rô   )rõ   rö   r÷   rø   rù   rT   rê   r£   r°   r§   r/  r  rt   ru   rv   r7   r7   X  sS   † ñð DIñØ˜u˜g s¨T¡zÐ1Ñ2ðØ=@ðà	õð#˜%ð # Dô #÷ru   r7   c                   ó\   • \ rS rSrSrS\\S-  /S4   SS4S jrS\SS4S jrS\4S	 jr	S
r
g)r8   i†  zBPacket line parser that hands completed packets off to a callback.Ú
handle_pktNrj   c                 ó.   • Xl         [        5       U l        g)z]Initialize PktLineParser.

Args:
  handle_pkt: Callback function to handle completed packets
N)r9  rY   r®   )r¯   r9  s     rv   r°   ÚPktLineParser.__init__‰  s   € ð %ŒÜ!›)ˆ�ru   r—   c                 ó  • U R                   R                  U5        U R                   R                  5       n[        U5      S:  a  gSn[        U5      U-
  S:¼  a†  [	        X#US-    5      nUS:X  a  U R                  S5        US-  nOEUS:  a  [        SUS 35      eU[        U5      U-
  ::  a  U R                  X#S-   X4-    5        X4-  nOO[        U5      U-
  S:¼  a  M†  [        5       U l         U R                   R                  X#S 5        g)zAParse a fragment of data and call back for any completed packets.r™   NrS   rÊ   rš   )r®   r§   r5  r†   r¤   r9  r]   rY   )r¯   r—   r  ÚposrÑ   s        rv   ÚparseÚPktLineParser.parse’  sú   € à�‰×Ñ˜dÔ#Ø�o‰o×&Ñ&Ó(ˆÜˆs‹8�a‹<Øð ˆÜ�#‹h˜‰n Ó!Ü)¨#°C¸!±GÐ*<Ó=ˆDØ�q‹yØ—‘ Ô%Ø�q‘‘Ø˜“Ü&Ð)BÀ4ÈÀ*Ð'MÓNÐNØœ˜S› C™Ó'Ø—‘ ¨!¡G¨c©jÐ 9Ô:Ø‘‘àô �#‹h˜‰n Õ!ô "›)ˆŒØ�‰×Ñ˜c $˜iÕ(ru   c                 ó6   • U R                   R                  5       $ )zRead back any unused data.)r®   r5  r³   s    rv   Úget_tailÚPktLineParser.get_tail«  s   € à�‰×'Ñ'Ó)Ð)ru   )r®   r9  )rõ   rö   r÷   rø   rù   rT   rê   r°   r>  rA  r  rt   ru   rv   r8   r8   †  sG   † ÙLð$ 8¨U°T©\¨N¸DÐ,@Ñ#Að $Àdô $ð)˜%ð ) Dô )ð2*˜%÷ *ru   r8   c                 óV   • SR                  U  Vs/ s H  nSU-   PM
     sn5      $ s  snf )z–Format a capabilities list for the wire protocol.

Args:
  capabilities: List of capability strings

Returns:
  Space-separated capabilities as bytes
ru   rŽ   r�   r�   s     rv   rE   rE   °  s)   € ð �8‰8¡|Ó4¢| !�T˜A”X¡|Ñ4Ó5Ð5ùÒ4s   �&ÚrefÚshac                 óR   • Uc  US-   U -   S-   $ US-   U -   S-   [        U5      -   S-   $ )z›Format a ref advertisement line.

Args:
  ref: Reference name
  sha: SHA hash
  capabilities: Optional list of capabilities

Returns:
  Formatted ref line
rŽ   ó   
r�   )rE   )rD  rE  r   s      rv   rG   rG   ¼  sC   € ð ÑØ�T‰z˜CÑ %Ñ'Ð'à�T‰z˜CÑ %Ñ'Ô*@ÀÓ*NÑNÐQVÑVÐVru   c                 ó   • [         S-   U -   $ )z_Format a shallow line.

Args:
  sha: SHA to mark as shallow

Returns:
  Formatted shallow line
rŽ   )r#   ©rE  s    rv   rH   rH   Ï  s   € ô ˜TÑ! CÑ'Ð'ru   c                 ó   • [         S-   U -   $ )z^Format an unshallow line.

Args:
  sha: SHA to unshallow

Returns:
  Formatted unshallow line
rŽ   )r$   rI  s    rv   rI   rI   Û  s   € ô ˜tÑ# cÑ)Ð)ru   r;   c                 ó0   • U(       a  SU-   nSU -   U-   S-   $ )z…Format an ACK line.

Args:
  sha: SHA to acknowledge
  ack_type: Optional ACK type (e.g. b"continue")

Returns:
  Formatted ACK line
rŽ   s   ACK rG  rt   )rE  r;   s     rv   rD   rD   ç  s$   € ö Ø˜(‘?ˆØ�S‰=˜8Ñ# eÑ+Ð+ru   c                 ó�   • U R                  5        VVs0 s H#  u  pUR                  [        5      (       a  M!  X_M%     snn$ s  snnf )z«Remove all peeled refs from a refs dictionary.

Args:
  refs: Dictionary of refs (may include peeled refs with ^{} suffix)

Returns:
  Dictionary with peeled refs removed
)ÚitemsÚendswithr0   )ÚrefsrD  rE  s      rv   rP   rP   ö  s=   € ð $(§:¡:¤<ôÚ#/‘Z�c°s·|±|ÔDU×7V‹ˆŠ¡<òð ùó s
   ” A¸Ac           
      óD  • SSK Jn  0 nU R                  5        VVs0 s H#  u  p4UR                  [        5      (       a  M!  X4_M%     nnnU R                  5        H<  u  pgUR                  [        5      (       d  M!  XrU" US[        [        5      *  5      '   M>     XR4$ s  snnf )z×Split peeled refs from regular refs.

Args:
  refs: Dictionary of refs (may include peeled refs with ^{} suffix)

Returns:
  Tuple of (regular_refs, peeled_refs) where peeled_refs keys have
  the ^{} suffix removed
r\   re   N)rO  rf   rM  rN  r0   r†   )rO  rf   ÚpeeledrŠ   ÚvÚregularrD  rE  s           rv   rO   rO     sˆ   € õ à"$€FØ $§
¡
¤ÔR¢™˜°A·J±JÔ?P×4Q‹tˆqŠt¡€GÑRà—J‘J–L‰ˆØ�<‰<Ô)×*Ó*à:=‘3�sÐ4œcÔ"3Ó4Ð4Ð5Ó6Ó7ñ !ð
 ˆ?Ðùó Ss   œ BÁ Bc              #   ó^  #   • SSK Jn  [        U R                  5       5       Hu  u  p4X2:X  a  M   X   nUR                  U5      u  pgUR                  S-   U-   S-   v •  UR                  UR                  :w  d  MW  UR                  S-   U-   [        -   S-   v •  Mw     g! [         a     M‡  f = f7f)zÆGenerate info refs in the format used by the dumb HTTP protocol.

Args:
  refs: Dictionary of refs
  store: Object store to peel tags from

Yields:
  Lines in info/refs format (sha + tab + refname)
r\   )ÚHEADREFó   	rG  N)rO  rU  ÚsortedrM  ÚKeyErrorÚpeelÚidr0   )rO  ÚstorerU  r%  rE  ÚoÚ	_unpeeledrQ  s           rv   rR   rR     s£   é € õ ä˜DŸJ™J›LÖ)‰	ˆð ‹?Ùð	Ø‘
ˆAð "ŸJ™J s›OÑˆ	Ø�d‰d�U‰l˜TÑ! EÑ)Ò)Ø�4‰4�6—9‘9ÕØ—)‘)˜eÑ# dÑ*Ô->Ñ>ÀÑFÔFò *øô ó 	Úð	üs.   ‚,B-¯B³AB-Á9#B-Â
B*Â&B-Â)B*Â*B-c           
      óš  • SSK n0 nUR                  5        HZ  u  pE U R                  [        U5      5      u  pg[	        U[
        5      (       a  UR                  X4[        -   '   UR                  X4'   M\     U$ ! [         aI    UR                  SR                  UR                  SS5      UR                  S5      5      [        5         M²  f = f)ah  Serialize refs with peeled refs for Git protocol v0/v1.

This function is used to prepare refs for transmission over the Git protocol.
For tags, it includes both the tag object and the dereferenced object.

Args:
  store: Object store to peel refs from
  refs: Dictionary of ref names to SHAs

Returns:
  Dictionary with refs and peeled refs (marked with ^{})
rS   Nz#ref {} points at non-present sha {}zutf-8Úreplacerm   )rº   rM  rY  r_   Ú
isinstancer`   rZ  r0   rX  r»   ÚformatrÎ   ÚUserWarning)r[  rO  rº   ÚretrD  rE  ÚunpeeledrQ  s           rv   rN   rN   <  s¹   € ó à!#€CØ—J‘J–L‰ˆð	#Ø$Ÿz™z¬(°3«-Ó8ÑˆHô ˜(¤C×(Ñ(Ø/5¯y©y�Ô+Ñ+Ñ,Ø—{‘{ˆC‹Hñ !ð €Jøô ó 	Ø�M‰MØ5×<Ñ<Ø—J‘J˜w¨	Ó2°C·J±J¸wÓ4Góô ô	ò ð	ús   �A7Á7AC
Ã	C
)N)ru   )rO  zMapping[Ref, ObjectID | None]rj   zdict[Ref, ObjectID | None])rO  úMapping[Ref, ObjectID]rj   z/tuple[dict[Ref, ObjectID], dict[Ref, ObjectID]])rO  re  r[  rd   rj   zIterator[bytes])r[  rd   rO  re  rj   zdict[bytes, ObjectID])~rù   Ú__all__ÚloggingÚsysrü   Úcollections.abcrT   rU   rV   rW   rX   ÚiorY   ÚosrZ   Útypingr[   rq   Úerrorsr]   r^   Úobjectsr_   r`   Úversion_inforc   Útyping_extensionsÚ	getLoggerrõ   rÌ   Úpackrd   rO  rf   r5   r*   r'   r(   r0   r6   Ú__annotations__r4   r-   r.   r1   r3   r2   r   r	   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r&   Úsetr,   r+   r)   r/   rê   r<   r=   rp   r>   r?   rA   rÿ   rJ   r   rQ   r   r   r   r#   r$   r    r%   r"   r!   rF   rK   rL   rM   Ú	frozensetr¡   r£   r¤   r9   r  r:   r@   rB   r;   rC   r7   r8   rE   rG   rH   rI   rD   rP   rO   rR   rN   rt   ru   rv   Ú<module>rv     s‰  ðò. CòR€óh Û 
Û ß KÕ KÝ Ý Ý  ã ç 5ß "à×Ñ�wÓÞå&à	×	Ò	˜8Ó	$€æÝ%Ýà€ò "Ð Ø%&Ð "Ø$%Ð !ð Ð á˜iÓ(€ˆ(Ó (à€
Ø€	ØÐ ð Ð àÐ àÐ àÐ Ø)Ð Ø%Ð Ø/Ð Ø'Ð Ø'Ð Ø#Ð Ø 5Ð ØÐ Ø'Ð Ø#Ð ØÐ Ø+Ð ØÐ Ø#Ð Ø+Ð Ø#Ð ØÐ ØÐ Ø$=Ð !Ø*IÐ 'ØÐ ØÐ Ø+Ð Ø+Ð Ø)Ð ð &Ð ð ØØØØðÐ ñ  ðØ	ðàðð 	ðð 	&ð	ð
 	ðð 	 ðð 	ðð 	ðð 	ðð 	#ðð 	*ðð 	0ðð 	ðð 	ðð 	!ðóÐ ñ& !ðØ	ðà ðð 	ðð 	ð	ð
 	ðð 	 ðó	Ð ð €à€ðR�eô Rð4˜%ô 4ð	A #ð 	A¨%ô 	Að
? ð 
?¨uð 
?¸ô 
?ð	:¨8°E©?ð 	:¸sÀ5¹zô 	:ð  ð  ¨5°¸À¹Ð1DÑ+Eô  ð	4 ¨%°°u°Ñ*=Ñ!>ð 	4À4ÈÁ;ô 	4ð €Ø&Ð Ø"Ð Ø€Ø Ð Ø€Ø€Ø€Ø€ð
>˜ð 
> eð 
>°ô 
>ð'˜ð ' %¨¨t°E©{Ð(:Ñ";ô 'ð
9�5˜4‘<ð 
9 Eô 
9ðA�%˜$‘,ð A 5ô Añ Ð1Ó2€ð Eð ¨cô ÷0g#ñ g#ðT €	ôD˜ô DðN
4˜uð 
4¨¨u°d¸5±kÐ/AÑ)Bô 
4ð7¨ð 7°5¸ÀÀUÁÐ9KÑ3Lô 7ð$˜8 E™?ð ¨sô ðØ˜5‘/ðØ6;ðà
ˆT�\ô÷D+ñ +÷\'*ñ '*ðT	6¨°%©ð 	6¸Uô 	6ð DHñWØ	ðWØðWØ*2°5©/¸DÑ*@ðWà
õWð&	(˜Uð 	( uô 	(ð	*˜uð 	*¨ô 	*ñ,˜ð ,¨%ð ,¸%õ ,ðØ
)ðà!ôð Ø
"ðà6ôð2GØ
"ðGØ+<ðGàôGð:!Øð!Ø$<ð!àõ!ru   