HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyo
�
1�3\c@@sddlmZddlZddlmZddlmZmZddlm	Z	m
ZmZm
Z
mZmZmZmZmZmZmZddlmZmZejZejZed�Zed	�Zd
eefZd�Zd�Zd
�Z d�Z!d�Z"ej#�Z$ddd�Z&e&dddd�d��Z'e&dddd�d��Z(e&ddd�d��Z)e&dddd�d��Z*e&dd dd�d!��Z+d"dd#d$d%d&gZ,d'�Z-e&d(dd�d)��Z.e&d*d+dd�d,��Z
e&d-d.dd�d/��Z/e&d0d1dd�d2��Z0d3�Z1e&d%d4dd�d5��Z2e&d6dd�d7��Z3e&d8dd�d9��Z4e&d:d;dd�d<��Z5e&d"d=dd�d>��Z6e&d$d?dd�d@��Z7e&dAdBdd�dC��Z8e&d#dDdd�dE��Ze&dFdd�dG��Z9e&dHd6dd�dI��Z:dS(Ji(tabsolute_importNi(t_(thextnullid(tbundle2tchangegroupt	discoverytencodingterrortexchangetpushkeytpycompattstreamclonetutiltwireprototypes(tprocutilt
stringutils/incompatible Mercurial client; bundle2 requireds9see https://www.mercurial-scm.org/wiki/IncompatibleClients%s
(%s)
cC@sAx4|j�D]&}|jd�r
|djd�Sq
WddgS(sReturns 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=it,tzlibtnone(tgetprotocapst
startswithtsplit(tprototcap((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytclientcompressionsupport-scC@s
|jd�S(s�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.
    tserved(tfiltered(trepoRtcommand((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytgetdispatchrepo;scC@sAt|||�}t|\}}|j|�}||||�S(N(Rtcommandstgetargs(RRRtfunctspectargs((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytdispatchDscC@ski}x2|D]*}||kr
||||<||=q
q
W|rgtjjd|dj|�f�n|S(Ns,warning: %s ignored unexpected arguments %s
R(Rtstderrtwritetjoin(tcmdtkeystotherstoptstk((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytoptionsLs
cC@s�|j}d|jk}|rG|jdd|�}|dk	rG|Sn|jdd|�}|dk	rm|S|r�|jdd�}|dk	r�|Sn|jdd�S(s�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
    tgeneraldeltatserversbundle1gd.%ss
bundle1.%st	bundle1gdtbundle1N(tuitrequirementst
configbooltNone(RtactionR2tgdtv((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytbundle1allowedWs
	tpushc@s�d�tjj�D���dkr8�jtj�n�d	krZtjd���n�d
krod�nt�t	�s�tjd��n����fd�}|S(s�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.
    cS@s,h|]"\}}|ddkr|�qS(tversioni((t.0R,R8((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys	<setcomp>�s		tbatchR:tpullsCinvalid wire protocol permission; got %s; expected "push" or "pull"ts:arguments for version 1 commands must be declared as bytesc@sK�tkr"tjd���ntj|d�d�d��t�<|S(Ns+%s command already registered for version 1R#t
transportst
permission(RRtProgrammingErrorRtcommandentry(R!(R#tnameRAR@(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytregister�s	
(R:R>N(
Rt
TRANSPORTStitemstaddtSSHV2RRBR5t
isinstancetbytes(RDR#RARE((R#RDRAR@sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytwireprotocommandvs	
	R=scmds *RAR>cC@s�tj}|jd�}g}x�|jd�D]�}|jdd�\}}i}	xK|jd�D]:}
|
rb|
jd�\}}||�|	||�<qbqbWt|\}
}t|j}|j|�|r�|j�}i}xo|D]g}|dkrBi}x1|	j�D]#}||kr|	|||<qqW||d<q�|	|||<q�W|
||g|D]}||^qd�}n|
||�}t|tj	�r�|St|tj
�r�|j}n|jtj
|��q.Wtj
dj|��S(NRt;t iRt=t*(RtunescapebatchargRRRRAt	checkpermR)RJtooberrort
bytesresponsetdatatappendtescapebatchargR'(RRtcmdsR*tunescapeargtrestpairtopR#tvalstatnR8R!R"tpermR)RUR,tstartkeytresult((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR=�s@	



,tbetweentpairscC@s~g|jd�D]}tj|d�^q}g}x1|j|�D] }|jtj|�d�qDWtjdj|��S(NRNt-s
R?(RRt
decodelistRdRVt
encodelistRTR'(RRRetptrtb((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRd�s
.t	branchmapcC@s�|j�}g}xX|j�D]J\}}tjtj|��}tj|�}|jd||f�qWtj	dj
|��S(Ns%s %ss
(Rlt	iteritemsturlreqtquoteRt	fromlocalRRhRVRTR'(RRRltheadstbranchtnodest
branchnametbranchnodes((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRl�stbranchesRscC@s_tj|�}g}x1|j|�D] }|jtj|�d�q%Wtjdj|��S(Ns
R?(RRgRvRVRhRTR'(RRRsRjRk((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRv�s
tclonebundlesR?cC@stj|jjd��S(sZServer 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.
    sclonebundles.manifest(RRTtvfsttryread(RR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRw�s
tlookupR
tknownt	getbundletunbundlehashcC@stt�}tjd|�r.|jd�ntj|�r�|jjdd�rb|jd�n|j	|j
@}|dhs�|jd�q�|jddjt|���n|jjd	d
�rt
jt
j|dd��}|jdtj|��n|jd
djt
j��|jjd	d�ro|jtj�|jjd	d�ro|jtj�qon|j||�S(s)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.
    tchangegroupsubsetR/tpreferuncompressedsstream-preferredtrevlogv1tstreams
streamreqs=%sRtexperimentalsbundle2-advertisetrolesbundle2=sunbundle=%stnarrowtnarrowservebrokenellipses(tlistt
wireprotocapsRtcommandavailableRVRtallowservergenerationR2R4R3tsupportedformatsR'tsortedRt
encodecapstgetrepocapsRnRotbundlepriorityRt	NARROWCAPtELLIPSESCAPtaddcapabilities(RRtcapstrequiredformatstcapsblob((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyt
_capabilitiess&
#tcapabilitiescC@s+t||�}tjdjt|���S(NRN(R�RRTR'R�(RRR�((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR�*sRtrootsc@sptj|�}tj|d|d|j��}tj||dd��t�fd�d�}tjd|�S(Ntmissingrootstmissingheadst01tservec@s
�jd�S(Ni�(tread((tcg(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyt<lambda>5R?R?tgen(	RRgRtoutgoingRqtchangegroupmodtmakechangegrouptitert	streamres(RRR�RsR�R�((R�sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR/sR~sbases headsc@sytj|�}tj|�}tj|d|d|�}tj||dd��t�fd�d�}tjd|�S(NR�R�R�R�c@s
�jd�S(Ni�(R�((R�(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR�@R?R?R�(RRgRR�R�R�R�R�(RRtbasesRqR�R�((R�sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR~8s	t
debugwireargss	one two *cC@s=tdddg|�}tj|j||tj|���S(NR�tthreetfour(R-RRTR�Rt	strkwargs(RRtonettwoR*R+((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR�Csc@sd�}|jjd�}|s%d
Stj||�}tj||�}|sSd
S|j��jg|D]}	�j|	�^qidt	���jg|D]}	�j|	�^q�dt	��t
|�}
x�|D]�}|jd�}tj
jj|�}
|r||
kr|
|
krq�nd|kr�y||d�}Wntk
rUq�nX|j|�rkq�nt��fd�|D��r�q�nt���fd�|D��r�q�q�nd|kry||d�}Wntk
r�q�nXt��fd	�|D��sq�qn|d
}|jjd|�y|jj|�SWq�tk
rv|jjd|�q�q�Xq�Wd
S(s�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.
    cS@s/tg|jd�D]}|jd�^q�S(NRMR(tsetRtdecode(tsth((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytdecodehexstringZsspullbundles.manifestt	inclusivetCOMPRESSIONRqc3@s$|]}�j|��kVqdS(N(trev(R<R�(tclt
common_anc(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys	<genexpr>wsc3@s9|]/}�j|��ko0�j|��kVqdS(N(R�(R<R�(R�R�t	heads_anc(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys	<genexpr>ysR�c3@s$|]}�j|��kVqdS(N(R�(R<R�(R�R�(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys	<genexpr>�stURLssending pullbundle "%s"
spullbundle "%s" not accessible
N(RxRyR5R	tparseclonebundlesmanifesttfilterclonebundleentriest	changelogt	ancestorsR�tTrueRtgetR
tcompenginest_bundlenamest	TypeErrortissubsettalltanyR2tdebugtopentIOError(RRR+tclheadsRqtcommonR�tmanifestRZR�tcompformatstentrytcomptaltcomptbundle_headstbundle_basestpath((R�R�R�sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytfind_pullbundleKsX		11


	
	

RPcC@s�tdtjj�|�}x�|j�D]�\}}tj|}|dkrctj|�||<q(|dkr�t|jd��||<q(|dkr�t|jd��||<q(|dkr�|dkr�t	||<q
t
|�||<q(|dkr(td	|��q(q(Wt|d
�slt
j|jd��sl|jdkrQtjt�Stjtd
t��qlnt}yct|jj��}t|jdt���}	t|jdt���}
|
jt�|jjdd�r7d|j�kr7t|||||	|
�}|r7tj dt!j"|�dt�Sn|jjdd�r�|jdt�}|r�|
r�||	kr�tjt#d�d
t#d���q�nt
j$|dt%j&|��\}
}|
jdt�}Wn�tjk
r�}t
j|jd��s1|jdkr+tjt%j'|�d�S�nt(j)|j�}dt%j'|�fg}g}|j*dk	r�|j,d
|j*f�n|j-t(j.d||��|j/�}t	}nXtj d|d|�S(NR|RstcsvRtscsvtbooleant0tplains unknown getbundle option type %sR>t
bundlecapsshttp-v1thintRqR�R/t
pullbundlespartial-pullR�tprefer_uncompressedtdisablefullbundleR�s%server has pull-based clones disableds/remove --pull if specified or upgrade MercurialR�tprefercompresseds
tmessageserror:abort(0R-RtGETBUNDLE_ARGUMENTSR)RmRgR�RR�tFalsetbooltKeyErrorR9R	tbundle2requestedR�RDRStbundle2requiredRtAborttbundle2requiredmaintbundle2requiredhintR�R�RqtdiscardRR2R4RR�R�R
t
filechunkiterRtgetbundlechunksRR�tbytestrRtbundle20R�R5RVtaddpartt
bundlepartt	getchunks(RRR*R+R,R8tkeytypeR�R�RqR�tbundleRtinfotchunkstexctbundlertmanargstadvargs((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR|�sx	






	RqcC@s&|j�}tjtj|�d�S(Ns
(RqRRTRh(RRR�((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRq�sthellocC@s#t||�j}tjd|�S(sfCalled 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�RURRT(RRR�((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR��stlistkeyst	namespacecC@s:t|jtj|��j��}tjtj|��S(N(	R�R�RttolocalRGRRTt
pushkeymodt
encodekeys(RRR�td((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR��s$RbcC@svy4tj|�}|j|�}t|�}d}Wn(tk
r^}tj|�}d}nXtjd||f�S(Niis%d %s
(	RR�RzRt	ExceptionRtforcebytestrRRT(RRRbR,R_Rjtsuccesstinst((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRz�s

snodes *cC@s8djd�|jtj|��D��}tj|�S(NR?cs@s!|]}|rdpdVqdS(t1R�N((R<Rk((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pys	<genexpr>s(R'R{RRgRT(RRRsR*R8((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR{�st	protocapsR�cC@s:|jtjkr-t|jd��|_ntjd�S(NRNtOK(RDRtSSHV1R�Rt
_protocapsRT(RRR�((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyRssnamespace key old newc	C@s�t|�dkr^tj|�|kr^y |jd�tj|�}Wqmtk
rZqmXntj|�}|j��@}|jtj|�tj|�tj|�|�p�t	}WdQX|r�|j
�nd}tjdt
|�|f�S(Nisutf-8R?s%d
%s(tlenRt	escapestrR�RR�tUnicodeDecodeErrortmayberedirectstdioR
R�tgetvalueRRTtint(RRR�RbtoldtnewtoutputRj((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR

s'

!t
stream_outcC@stjtj|��S(s�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.
    (RtstreamreslegacyRtgeneratev1wireproto(RR((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR�stunbundlec@s�tj|�}|j���}y�tj||d�d�}z�|j��|jjdd�r��fd�}tj	���n�d)\����fd�}tjdd�\}�|jj
d	��tj|tjd
���d}x�D]}�j|�q�W�jd�tj|j�d�}	t|	tj�r�t|d�r�|jd
krntjt�Stjtdt��ntj||	|d|j ��}tj!|d�r�tj"d|j#��Stj$||r�|j%�nd�SWd|�XWn�tj&tjtj'fk
r�}
t(|
dt)�s�y�Wq�tjk
r�t*j+jd|
�|
j,dk	r�t*j+jd|
j,�nt*j+j-�tj$d|r�|j%�nd�Stj'k
r�tj.tj/|
�|r�|j%�nd�SXnt0j1|j�}x't(|
dd*�D]}|j2|�qWyYy�WnKtj3k
r�}
t(|
dd�}
|
dk	r�d|
j4dd+�kr��n|j5d�}|j6d|
j7�|
j8dk	r�|j6d|
j8dt)�n|
j9dk	r|j6d|
j9dt)�n|
j:dk	r3|j6d|
j:dt)�n|
j;dk	r^|j6d |
j;dt)�n|
j<dk	r�|j6d!|
j<dt)�q�nXWn tj&k
r}
|j5d"�}|
j=dk	r�|j6d#|
j=�n|
j>r�|j6d$d%j?|
j>��q�n�tjk
ry}
d&t@jA|
�fg}g}|
j,dk	rZ|jBd|
j,f�n|j2t0jCd'||��n8tj'k
r�}
|j5d(d&t@jA|
�fg�nXtj"d|j#��SXWdQXdS(,Nspreparing changescS@sdS(N(R5(((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR�/R?R/tstreamunbundlec@sx�D]}qWdS(N((Ri(tpayload(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pytcleanup3s
c@s-�r�j�n�r)tj��ndS(N(tclosetostunlink((tfpttempname(sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR<s
tprefixshg-unbundle-s"redirecting incoming bundle to %s
swb+iR:shttp-v1R�R�R�R�R?tduringunbundle2s
abort: %s
s(%s)
t_bundle2salvagedoutputt
_replycapsR
Rs
error:pushkeysin-reply-toR�t	mandatoryRbRR
tretserror:unsupportedcontenttparttypetparamssR�serror:abortserror:pushraced(NN(((DRRgR
R	tcheck_headst
getpayloadR2R4R
tchunkbufferR5RtmkstempR�RtfdopentsysstrR&tseekt
readbundleRJR�tcg1unpackerR9RDRSR�RR�R�R�RtclienttsafehasattrRR�tpushresRtBundleValueErrort	PushRacedtgetattrR�RR%R�tflushtpusherrR�RR�R�t
PushkeyFailedR�tnewparttaddparamtpartidR�RbRR
R!R"R#R'RR�RVR�(RRRqttheir_headsRRtfdRjRiR�R�R�toutt
remotecapstpartterrpartR�R�((RRRsA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyR(s�	


 !

$	"	(;t
__future__RRti18nRtnodeRRR?RRR�RRRR	R
R�RRR
RtutilsRRturlerrRnR�R�R�RRR$R-R9tcommanddictRR5RLR=RdRlRvRwR�R�R�R~R�R�R|RqR�R�RzR{RR�R(((sA/usr/lib64/python2.7/site-packages/mercurial/wireprotov1server.pyt<module>sTL								/.		
		*	
	BL