
    6h4                    \   S SK Jr  S SKrS SKrS SKJr  SSKJrJr  SSKJ	r	  SSK
Jr  \R                  (       a  S SKrSSKJrJr  SS	KJr  S
rSrSrSr\\4r\SSS.SSSS.0r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      rS4S jrS4S jrS  r S! r!S"S#S"S#S#S$S%S#S#S#S%S%S&.r" " S' S(\5      r# " S) S*5      r$ " S+ S,\%5      r&S- r'\RP                   " S. S/5      5       r)\RP                   " S0 S15      5       r*\RP                   " S2 S35      5       r+g)5    )annotationsN)Protocol   )binhex)_)attr)errorutil)compressions   ssh-v1s   exp-narrow-1s   exp-ellipses-1s   exp-ellipses-2s   ssh)s	   transports   versions   http-v1s   httpc                      \ rS rSrSrS rSrg)bytesresponse6   z1A wire protocol response consisting of raw bytes.c                    Xl         g Ndata)selfr   s     :/usr/lib/python3/dist-packages/mercurial/wireprototypes.py__init__bytesresponse.__init__9   s    	    r   N__name__
__module____qualname____firstlineno____doc__r   __static_attributes__ r   r   r   r   6   s
    ;r   r   c                      \ rS rSrSrS rSrg)ooberror=   zwireproto reply: failure of a batch of operation

Something failed during a batch call. The error message is stored in
`self.message`.
c                    Xl         g r   message)r   r&   s     r   r   ooberror.__init__D   s    r   r%   Nr   r    r   r   r"   r"   =   s    r   r"   c                      \ rS rSrSrS rSrg)pushresH   z~wireproto reply: success with simple integer return

The call was successful and returned an integer contained in `self.res`.
c                    Xl         X l        g r   resoutputr   r-   r.   s      r   r   pushres.__init__N       r   r.   r-   Nr   r    r   r   r)   r)   H       
r   r)   c                      \ rS rSrSrS rSrg)pusherrS   z`wireproto reply: failure

The call failed. The `self.res` attribute contains the error message.
c                    Xl         X l        g r   r,   r/   s      r   r   pusherr.__init__Y   r1   r   r2   Nr   r    r   r   r5   r5   S   r3   r   r5   c                  "    \ rS rSrSrSS jrSrg)	streamres^   a-  wireproto reply: binary stream

The call was successful and the result is a stream.

Accepts a generator containing chunks of data to be sent to the client.

``prefer_uncompressed`` indicates that the data is expected to be
uncompressable and that the stream should therefore use the ``none``
engine.
Nc                    Xl         X l        g r   genprefer_uncompressed)r   r>   r?   s      r   r   streamres.__init__j   s    #6 r   r=   )NFr   r    r   r   r:   r:   ^   s    	7r   r:   c                  "    \ rS rSrSrSS jrSrg)streamreslegacyo   a&  wireproto reply: uncompressed binary stream

The call was successful and the result is a stream.

Accepts a generator containing chunks of data to be sent to the client.

Like ``streamres``, but sends an uncompressed data for "version 1" clients
using the application/mercurial-0.1 media type.
Nc                    Xl         g r   r>   )r   r>   s     r   r   streamreslegacy.__init__z   s    r   rE   r   r   r    r   r   rB   rB   o   s    r   rB   c                t    U (       a+  U R                  U5       Vs/ s H  n[        U5      PM     sn$ / $ s  snf r   )splitr   )lsepvs      r   
decodelistrL      s0     !-1A--I .s   5c                `     UR                  [        [        U 5      5      $ ! [         a    e f = fr   )joinmapr   	TypeError)rI   rJ   s     r   
encodelistrQ      s.    xxC$$ s   ! -c                    U R                  SS5      R                  SS5      R                  SS5      R                  SS5      $ )	N   :   :c   ,   :o   ;   :s   =   :ereplace)plains    r   escapebatchargr^      s9    dE"	u		u		u		r   c                    U R                  SS5      R                  SS5      R                  SS5      R                  SS5      $ )	NrZ   rY   rX   rW   rV   rU   rT   rS   r[   )escapeds    r   unescapebatchargra      s9    t$							r   s   nodess   booleans   scsvs   csv)s   headss	   bookmarkss   commons
   obsmarkerss   phasess
   bundlecapss   listkeyss   cgs   cbattempteds   streams   includepatss   excludepatsc                  F   \ rS rSrSr\\R                  SS j5       5       r\R                  S 5       r	\R                  S 5       r
\R                  S 5       r\R                  S 5       r\R                  S 5       r\R                  S	 5       r\R                  S
 5       rSrg)baseprotocolhandler   a2  Abstract base class for wire protocol handlers.

A wire protocol handler serves as an interface between protocol command
handlers and the wire protocol transport layer. Protocol handlers provide
methods to read command arguments, redirect stdio for the duration of
the request, handle response types, etc.
c                    g)z\The name of the protocol implementation.

Used for uniquely identifying the transport type.
Nr    r   s    r   namebaseprotocolhandler.name       r   c                    g)zreturn the value for arguments in <args>

For version 1 transports, returns a list of values in the same
order they appear in ``args``. For version 2 transports, returns
a dict mapping argument name to value.
Nr    )r   argss     r   getargsbaseprotocolhandler.getargs   ri   r   c                    g)zReturns the list of protocol-level capabilities of client

Returns a list of capabilities as declared by the client for
the current request (or connection for stateful protocol handlers).Nr    rf   s    r   getprotocaps baseprotocolhandler.getprotocaps   ri   r   c                    g)zuProvide a generator for the raw payload.

The caller is responsible for ensuring that the full payload is
processed.
Nr    rf   s    r   
getpayloadbaseprotocolhandler.getpayload   ri   r   c                    g)a  Context manager to possibly redirect stdio.

The context manager yields a file-object like object that receives
stdout and stderr output when the context manager is active. Or it
yields ``None`` if no I/O redirection occurs.

The intent of this context manager is to capture stdio output
so it may be sent in the response. Some transports support streaming
stdio to the client in real time. For these transports, stdio output
won't be captured.
Nr    rf   s    r   mayberedirectstdio&baseprotocolhandler.mayberedirectstdio   ri   r   c                    g)z:Returns a string representation of this client (as bytes).Nr    rf   s    r   clientbaseprotocolhandler.client   ri   r   c                    g)zAdds advertised capabilities specific to this protocol.

Receives the list of capabilities collected so far.

Returns a list of capabilities. The passed in argument can be returned.
Nr    )r   repocapss      r   addcapabilities#baseprotocolhandler.addcapabilities   ri   r   c                    g)zValidate that the client has permissions to perform a request.

The argument is the permission required to proceed. If the client
doesn't have that permission, the exception should raise or abort
in a protocol specific manner.
Nr    )r   perms     r   	checkpermbaseprotocolhandler.checkperm   ri   r   r    N)returnbytes)r   r   r   r   r   propertyabcabstractmethodrg   rl   ro   rr   ru   rx   r}   r   r   r    r   r   rc   rc      s        	  	O O 	  	  	I I 	  	 r   rc   c                  >    \ rS rSrSr     S	S jrS rS rS rSr	g)
commandentryi
  z,Represents a declared wire protocol command.Nc                p    Xl         X l        U=(       d
    [        5       U l        X@l        XPl        X`l        g r   )funcrk   set
transports
permission
cachekeyfnextracapabilitiesfn)r   r   rk   r   r   r   r   s          r   r   commandentry.__init__  s,     		$-$$#6 r   c                T    [        UU[        U R                  5      U R                  S9$ )a  Merge this instance with an incoming 2-tuple.

This is called when a caller using the old 2-tuple API attempts
to replace an instance. The incoming values are merged with
data not captured by the 2-tuple and a new instance containing
the union of the two objects is returned.
rk   r   r   )r   r   r   r   )r   r   rk   s      r   _mergecommandentry._merge  s*     4??+	
 	
r   c              #  D   #    U R                   v   U R                  v   g 7fr   )r   rk   rf   s    r   __iter__commandentry.__iter__-  s     iiiis    c                `    US:X  a  U R                   $ US:X  a  U R                  $ [        S5      e)Nr   r   s    can only access elements 0 and 1)r   rk   
IndexError)r   is     r   __getitem__commandentry.__getitem__1  s0    699!V99@AAr   )rk   r   r   r   r   r   )r   N   pushNN)
r   r   r   r   r   r   r   r   r   r   r    r   r   r   r   
  s+    6
  7 
 Br   r   c                  2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )commanddicti:  zContainer for registered wire protocol commands.

It behaves like a dict. But __setitem__ is overwritten to allow silent
coercion of values from 2-tuples for API compatibility.
c                B  > [        U[        5      (       a  Oz[        U[        5      (       aZ  [        U5      S:w  a  [	        S5      eX;   a  X   R                  US   US   5      nO+[        US   US   [        [        5      SS9nO[	        S5      e[        TU ]%  X5      $ )N   s+   command tuples must have exactly 2 elementsr   r   r   r   s:   command entries must be commandentry instances or 2-tuples)

isinstancer   tuplelen
ValueErrorr   r   
TRANSPORTSsuper__setitem__)r   krK   	__class__s      r   r   commanddict.__setitem__A  s    a&&5!!1v{ !OPP yGNN1Q41. !aD1":&	  
 w"1((r   c                    UR                   [        ;   d   eU R                  U5      nU(       d  gUR                   UR                  ;  a  gg)z?Determine if a command is available for the requested protocol.FT)rg   r   getr   )r   commandprotoentrys       r   commandavailablecommanddict.commandavailable_  s@    zzZ'''!::U---r   r    )	r   r   r   r   r   r   r   r   __classcell__)r   s   @r   r   r   :  s    )< r   r   c           	       ^ U[         R                  [         R                  4;   d   e[         R                  R	                  U5      nU[         R                  :X  a  U R                  SS5      mSnOU R                  SS5      mSnT(       dK  U[        R                  :X  a  SOSnU Vs/ s H%  n[        UR                  5       U5      S	:  d  M#  UPM'     sn$ U Vs1 s H  oUR                  5       iM     nnT Vs1 s H  oUU;  d  M
  UiM     nnU(       a<  [        R                  " [        S
5      USR                  [        U5      5      4-  5      eU Vs/ s H  oUR                  5       T;   d  M  UPM     nn[        UU4S jS9nU(       dE  [        R                  " [        S5      U-  [        S5      SR                  [        U5      5      -  S9eU$ s  snf s  snf s  snf s  snf )z?Obtain the list of supported compression engines for a request.s   servers   compressionenginess   server.compressionenginess   experimentals   clientcompressionenginess%   experimental.clientcompressionenginesserverpriorityclientpriorityr   s,   invalid compression engine defined in %s: %ss   , c                B   > TR                  U R                  5       5      $ r   )indexrg   )econfigenginess    r   <lambda>&supportedcompengines.<locals>.<lambda>  s    =#6#6qvvx#@r   )keys?   %s config option does not specify any known compression enginess   usable compression engines: %s)hint)r   
CLIENTROLE
SERVERROLEcompenginessupportedwireengines
configlistr   getattrwireprotosupportrg   r
   Abortr   rN   sorted)	uiroler   configr	   r   
validnamesinvalidnamesr   s	           @r   supportedcompenginesr   n  s   K**K,B,BCCCC))>>tDK {%%%i1FG- 8
 : #'4??#:@P"
"!ga.@.@.BD&IA&MA{
 	
 %00Kq&&(KJ0,D}!0CA}LDkk=>uzz&"6789
 	

 *GkVVX-F1kKG@K kk' 	
 45jj
+,-
 	
 A
 1D Hs*   '"GGG9	GGG#0G#c                  :    \ rS rSrSr\R                  " 5       rSrg)encodedresponsei  a#  Represents response data that is already content encoded.

Wire protocol version 2 only.

Commands typically emit Python objects that are encoded and sent over the
wire. If commands emit an object of this type, the encoding step is bypassed
and the content from this object is used instead.
r    N)	r   r   r   r   r   r	   ibr   r   r    r   r   r   r     s     779Dr   r   c                      \ rS rSrSr\R                  " 5       r\R                  " 5       r\R                  " SS9r	\R                  " SS9r
\R                  " SS9r\R                  " SS9r\R                  " SS9rSrg)alternatelocationresponsei  zRepresents a response available at an alternate location.

Instances are sent in place of actual response objects when the server
is sending a "content redirect" response.

Only compatible with wire protocol version 2.
N)defaultr    )r   r   r   r   r   r	   r   url	mediatypesize
fullhashesfullhashseedserverdercertsservercadercertsr   r    r   r   r   r     sf     '')C	I774 D&J774(LWWT*Nwwt,r   r   c                  :    \ rS rSrSr\R                  " 5       rSrg)indefinitebytestringresponsei  zRepresents an object to be encoded to an indefinite length bytestring.

Instances are initialized from an iterable of chunks, with each chunk being
a bytes instance.
r    N)	r   r   r   r   r   r	   r   chunksr   r    r   r   r   r     s     WWYFr   r   )    ),
__future__r   r   typingr   noder   r   i18nr   
thirdpartyr	   TYPE_CHECKING r
   r   utilsr   SSHV1	NARROWCAPELLIPSESCAP1ELLIPSESCAPSUPPORTED_ELLIPSESCAPr   r   r"   r)   r5   r:   rB   rL   rQ   r^   ra   GETBUNDLE_ARGUMENTSrc   r   dictr   r   sr   r   r   r    r   r   <module>r      s   # 
    
  		 %{3  
 	
    7 7"  *   K( K\-B -B`1$ 1h9x 
 
 
 - - -$   r   