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: //lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyc
�
1�3\c@@sNddlmZddlZddlZddlZddlmZddlmZddl	m
Z
mZm
Z
mZmZmZmZmZmZddlmZejZd�Zd	efd
��YZd�Zdejjfd
��YZejej �defd��Y�Z!ejej"ej#�dej$fd��Y�Z%dS(i(tabsolute_importNi(t_(tbin(	tbundle2tchangegrouptencodingterrortpushkeytpycompatt
repositorytutiltwireprototypes(t
interfaceutilc@s6�fd�}t|d��t|d�j�|S(sUannotation for batchable methods

    Such methods must implement a coroutine as follows:

    @batchable
    def sample(self, one, two=None):
        # Build list of encoded arguments suitable for your wire protocol:
        encargs = [('one', encode(one),), ('two', encode(two),)]
        # Create future for injection of encoded result:
        encresref = future()
        # Return encoded arguments and future:
        yield encargs, encresref
        # Assuming the future to be filled with the result from the batched
        # request now. Decode it:
        yield decode(encresref.value)

    The decorator returns a function which wraps this coroutine as a plain
    method, but adds the original method as an attribute called "batchable",
    which is used by remotebatch to split the call into separate encoding and
    decoding phases.
    c@sj�||�}t|�\}}|s+|S|d}tj�j�}|j|j||��t|�S(Ni(tnextRtbytesurlt__name__tsett
_submitone(targstoptst	batchabletencargsorrest	encresreftselftcmd(tf(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytplain9s
RR(tsetattrR(RR((Rs?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR#s	tfuturecB@seZdZd�ZRS(s'placeholder for a value to be set latercC@s1tj|d�r$tjd��n||_dS(Ntvaluesfuture is already set(R
tsafehasattrRt	RepoErrorR(RR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRHs(Rt
__module__t__doc__R(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRFsc@s�tj�g}xr|D]j\}}t�fd�|D��sDt�dj�fd�|j�D��}|jd||f�qWdj|�S(s;Return a ``cmds`` argument value for the ``batch`` command.c3@s!|]}�|�|kVqdS(N((t.0tk(t	escapearg(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys	<genexpr>Vst,c3@s1|]'\}}d�|��|�fVqdS(s%s=%sN((R"R#tv(R$(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys	<genexpr>Xss%s %st;(RtescapebatchargtalltAssertionErrortjoint	iteritemstappend(treqtcmdstoptargsdictR((R$s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytencodebatchcmdsMs	"tunsentfuturecB@seZdZdd�ZRS(s0A Future variation to represent an unsent command.

    Because we buffer commands and don't submit them immediately, calling
    ``result()`` on an unsent future could deadlock. Futures for buffered
    commands are represented by this type, which wraps ``result()`` to
    call ``sendcommands()``.
    cC@s<|j�r"tjjj||�S|jj�|j|�S(N(tdoneRtfuturestFuturetresultt
_peerexecutortsendcommands(Rttimeout((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR7gs
N(RR R!tNoneR7(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR3^stpeerexecutorcB@sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@sI||_t|_t|_g|_tj�|_d|_	d|_
dS(N(t_peertFalset_sentt_closedt_callstweakreftWeakSett_futuresR;t_responseexecutort
_responsef(Rtpeer((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt__init__ts					cC@s|S(N((R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt	__enter__}scC@s|j�dS(N(tclose(Rtexctypetexcvaleetexctb((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt__exit__�sc@s��jrtjd��n�jr6tjd��nt�jtj��d���sptjd���n����fd�}t�dt	�r�|�}t
|_�|_n2�j
r�tjd���n|�}�j�|S(Ns4callcommand() cannot be used after commands are sents*callcommand() cannot be used after close()sAcannot call command %s: method of same name not available on peerc@s?tjj�}�jj|��jj���|f�|S(N(RR5R6RDtaddRAR-(R(RtcommandtfnR(s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytaddcall�sRsX%s is not batchable and cannot be called on a command executor along with other commands(R?RtProgrammingErrorR@tgetattrR=RtsysstrR;R>R3t	__class__R8RAR9(RRPRRRR((RRPRQRs?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytcallcommand�s*		
				
	
c
C@sS|jr
dS|jsdSt|_x;|jD]0}t|t�r-tjj|_	d|_q-q-W|j}d|_t|�dkr|d\}}}}|j
�s�dSy|tj|��}Wn+tk
r�tj|tj�d�nX|j|�dSg}g}x�|D]�\}}}}|j
�s:qny"|j|jtj|��}	Wn,tk
r�tj|tj�d�dSXyt|	�\}
}Wn,tk
r�tj|tj�d�dSX|j||
f�|j|||	|f�qW|s
dS|jj|�}tjjd�|_|jj|j||�|_dS(Nii(R?RAtTrueRDt
isinstanceR3RR5R6RVR;R8tlentset_running_or_notify_cancelt	strkwargst	Exceptiontfuture_set_exception_infotsystexc_infot
set_resultRt__self__R
R-R=t_submitbatchtThreadPoolExecutorREtsubmitt_readbatchresponseRF(
RRtcallsRPRRQR7trequestststatesRtencodedargstfremotetwireresults((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR9�sZ					

	

cC@s�|j�|jrdSt|_|js-dSz|jj�Wd|jjdt�d|_d|_x<|jD]1}|j	�sp|j
tjt
d���qpqpWd|_XdS(Ntwaits"unfulfilled batch command response(R9R@RXRFR7REtshutdownR;RDR4t
set_exceptionRt
ResponseErrorR(RR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRJ
s 
					c	C@s�x~|D]v\}}}}t|�}|j|�yt|�}Wn+tk
rotj|tj�d�qX|j|�qWdS(Ni(R
RR]RR^R_R`Ra(	RRiRlRPRRRktremoteresultR7((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRf's

(	RR RHRIRNRWR9RJRf(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR<rs					3	T	twirepeercB@seZdZd�Zd�Zed��Zed��Zed��Zed��Z	ed��Z
ed��Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zdddd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s�Client-side interface for communicating with a peer repository.

    Methods commonly call wire protocol commands of the same name.

    See also httppeer.py and sshpeer.py for protocol-specific
    implementations of this interface.
    cC@s
t|�S(N(R<(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytcommandexecutorBscC@s#|jdtd��|jd�S(Ntclonebundless
clone bundles(t
requirecapRt_call(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRtGscc@s�|jdtd��t�}itj|�d6|fV|j}|d jdd�\}}t|�ryt|�Vn|j	t
j|��dS(Ntlookupslook up remote revisiontkeyi����t i(RuRRRt	fromlocalRtsplittintRt_abortRR(RRxRtdtsuccesstdata((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRwKs		cc@sjt�}i|fV|j}ytj|d �VWn0tk
re|jtjtd�|��nXdS(Ni����sunexpected response:(	RRRt
decodelistt
ValueErrorR}RRpR(RRR~((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytheadsWs		
cc@s�t�}itj|�d6|fV|j}y1gtj|�D]}tt|��^q@VWn0tk
r�|j	t
jtd�|��nXdS(Ntnodessunexpected response:(
RRt
encodelistRRtiterbytestrtboolR|R�R}RRpR(RR�RR~tb((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytknownas		1
cc@s�t�}i|fV|j}yoi}x]|j�D]O}|jdd�\}}tjtj|��}tj	|�}|||<q3W|VWn0t
k
r�|jtj
td�|��nXdS(NRyisunexpected response:(RRt
splitlinesR{RttolocalturlreqtunquoteRR�t	TypeErrorR}RRpR(RRR~t	branchmapt
branchpartt
branchnametbranchheads((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�ks			
cc@s�|jd�sidfVnt�}|jjd|�itj|�d6|fV|j}|jjd|t|�f�t	j
|�VdS(NRspreparing listkeys for "%s"
t	namespaces$received listkey for "%s": %i bytes
(tcapableR;RtuitdebugRRzRRZt
pushkeymodt
decodekeys(RR�RR~((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pytlistkeys{s		c	c@s*|jd�stdfVnt�}|jjd||f�itj|�d6tj|�d6tj|�d6tj|�d6|fV|j}|j	dd�\}}yt
t|��}Wn)tk
r�t
jtd	�|��nXx0|jt�D]}|jjtd
�|�q�W|VdS(NRspreparing pushkey for "%s:%s"
R�Rxtoldtnews
is"push failed (unexpected response):sremote: (R�R>R;RR�R�RRzRR{R�R|R�RRpRR�RXtstatus(	RR�RxR�R�RR~toutputtl((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�s$		
cC@s
|jd�S(Nt
stream_out(t_callstream(R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR��sc	K@s�tj|�}|jdtd��i}|jd�p@t�}x|j�D]�\}}|dkrnqPntj	j|�}|dkr�t
jd|��n�|dkr�tj|�}n�|dkr�dj
|�}nb|dkrdj
t|��}n>|d	kr!d
t|�}n|dkr@td|��n|||<qPW|jdtj|��}td
�|D��r�tj|j|�Stj|d�SdS(Nt	getbundleslook up remote changest
bundlecapss$Unexpectedly None keytype for key %sR�tcsvR%tscsvtbooleans%iRs unknown getbundle option type %scs@s|]}|jd�VqdS(tHG2N(t
startswith(R"tcap((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys	<genexpr>�stUN(RtbyteskwargsRuRtgetRR,R;RtGETBUNDLE_ARGUMENTSRRSR�R+tsortedR�tKeyErrort_callcompressableR\tanyRtgetunbundlerR�tchangegroupmodtcg1unpacker(	RtsourcetkwargsRR�RxRtkeytypeR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR��s6
cC@s]|dgkrT|jd�rTtjdtjdjt|���j�g�}ntj|�}tj	|d�r,|j
d|d|�\}}|dkr�tjt
d�|��nyt|�}Wn)tk
r�tjt
d	�|��nXx`|jt�D]}|jjt
d
�|�qWn-|jd|d|�}tj|j|�}|S(s�Send cg (a readable file-like object representing the
        changegroup to push, typically a chunkbuffer object) to the
        remote server as a bundle.

        When pushing a bundle10 stream, return an integer indicating the
        result of the push (see changegroup.apply()).

        When pushing a bundle20 stream, return a bundle20 stream.

        `url` is the url the client thinks it's pushing to, which is
        visible to hooks.
        tforcetunbundlehashthashedttdeltaheadertunbundleR�spush failed:s"push failed (unexpected response):sremote: (R�RR�thashlibtsha1R+R�tdigestR
Rt	_callpushRRpRR|R�R�RXR�R�t_calltwowaystreamRR�(RtbundleR�turltretR�R�tstream((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR��s&0
 cC@s�tj|�}|jdd|�}y6g|j�D]}ttj|��^q4}|SWn0tk
r�|jtj	t
d�|��nXdS(NtbranchesR�sunexpected response:(RR�RvR�ttupleR�R�R}RRpR(RR�tnR~R�tbr((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR��s.
cC@s�d}g}x�tjdt|�|�D]�}djg||||!D]}tj|d�^qF�}|jdd|�}y!|jd�|j�D��Wq(t	k
r�|j
tjt
d�|��q(Xq(W|S(	NiiRyt-tbetweentpairscs@s*|] }|rtj|�p!gVqdS(N(RR�(R"R�((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pys	<genexpr>�ssunexpected response:(RtxrangeRZR+RR�RvtextendR�R�R}RRpR(RR�tbatchtrtitpR�R~((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR��s"	0
'cC@s4tj|�}|jdd|�}tj|d�S(NRtrootsR�(RR�R�R�R�(RR�R�R�R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRscC@s_|jdtd��tj|�}tj|�}|jdd|d|�}tj|d�S(Ntchangegroupsubsetslook up remote changestbasesR�R�(RuRRR�R�R�R�(RR�R�R�R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�scc@sd|j}|jrn|jdd�rn|jd�x:|D]/\}}d}|j||t|�f�q8Wntj}|jddt|��}|j	d�}|g}	x�|rKx2d|kr�|r�|j	d�}|	j
|�q�Wd	j|	�}
x3d|
kr,|
jdd
�\}}
||�Vq�W|j	d�}|
|g}	q�W|d	j|	��VdS(sqrun batch request <req> on the server

        Returns an iterator of the raw responses from the server.
        tdevelsdebug.peer-requests$devel-peer-request: batched-content
s+devel-peer-request:    - %s (%d arguments)
R�R/iR'R�iN(
R�t	debugflagt
configboolR�RZRtunescapebatchargR�R2treadR-R+R{(RR.R�R0Rtmsgtunescapeargtrsptchunktworktmergedtone((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRcs*	
$			cC@s|j|tj|��S(N(RvRR\(RR0R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR,scC@sTi}|dk	r||d<n|dk	r8||d<n|jdd|d||�S(Ntthreetfourt
debugwireargsR�ttwo(R;Rv(RR�R�R�R�tfiveR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�/s

cK@s
t��dS(s�execute <cmd> on the server

        The command is expected to return a simple string.

        returns the server reply as a string.N(tNotImplementedError(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRv8scK@s
t��dS(sexecute <cmd> on the server

        The command is expected to return a stream. Note that if the
        command doesn't return a stream, _callstream behaves
        differently for ssh and http peers.

        returns the server reply as a file like object.
        N(R�(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�@s	cK@s
t��dS(sEexecute <cmd> on the server

        The command is expected to return a stream.

        The stream may have been compressed in some implementations. This
        function takes care of the decompression. This is the only difference
        with _callstream.

        returns the server reply as a file like object.
        N(R�(RRR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�KscK@s
t��dS(s�execute a <cmd> on server

        The command is expected to be related to a push. Push has a special
        return method.

        returns the server reply as a (ret, output) tuple. ret is either
        empty (error) or a stringified int.
        N(R�(RRtfpR((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�Xs	cK@s
t��dS(sqexecute <cmd> on server

        The command will send a stream to the server and get a stream in reply.
        N(R�(RRR�R((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR�cscC@s
t��dS(sKclearly abort the wire protocol connection and raise the exception
        N(R�(Rt	exception((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyR}jsN(RR R!RsRtRRwR�R�R�R�RR�R�R�R�R�RR�RcRR;R�RvR�R�R�R�R}(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyRr8s2			

			,					
						
		(&t
__future__RR�R_RBti18nRtnodeRR�RRR�RRRR�RR	R
RtutilsRR�RtobjectRR2R5R6R3timplementertipeercommandexecutorR<t
ipeercommandstipeerlegacycommandsRGRr(((s?/usr/lib64/python2.7/site-packages/mercurial/wireprotov1peer.pyt<module>s"@		#	�