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: //proc/self/root/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyo
�
1�3\c@@s|ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZed�Zd�Zd�Zdd	�Zd
�Zd�Zdd
�Zd�Zd�Zd�Zdefd��YZdZdZ dZ!dZ"d�Z#d�Z$ej%d��Z&d�Z'd�Z(d�Z)ej%d��Z*d�Z+d�Z,dS(i(tabsolute_importNi(t_(	t	branchmapt	cacheutilterrort
narrowspectphasestpycompatt
repositorytstoretutilc	C@s�|j}|j}t}|jrHd|jjdg�krHt}qHn|r_|r_tdfS|rv|rvtdfSt|�r�tdfS|j	r�tdfS|j
}|dkr�|jd�}n|s�tdfSt�}|jd�r�|j
d�n�|jd�}|s6|jjjtd��tdfSt|jd��}||j}|r�|jjjtd�d	jt|���|jjjtd
��tdfS|}t|fS(s�Whether it is possible to perform a streaming clone as part of pull.

    ``bundle2`` will cause the function to consider stream clone through
    bundle2 and only through bundle2.

    Returns a tuple of (supported, requirements). ``supported`` is True if
    streaming clone is supported and False otherwise. ``requirements`` is
    a set of repo requirements from the remote, or ``None`` if stream clone
    isn't supported.
    tv2tstreamsstream-preferredtrevlogv1t
streamreqss=warning: stream clone requested but server has them disabled
t,sGwarning: stream clone requested but client is missing requirements: %s
s, sQ(see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
N(trepotremotetFalset
canusebundle2tremotebundle2capstgettTruetNonetlentheadststreamclonerequestedtcapabletsettaddtuitwarnRtsplittsupportedformatstjointsorted(	tpulloptbundle2RRtbundle2supportedtstreamrequestedtrequirementsRtmissingreqs((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytcanperformstreamclonesL			




	
	
		




c
C@soddlm}t|�\}}|s,dS|j}|j}d}|jd�r�|j��}|jdi�j	�}WdQXn|j
jtd��|j��}|jdi�j	�}WdQX|j
�}	yt|	�}
Wn)tk
r
tjtd�|	��nX|
dkr2tjtd���nH|
d	krVtjtd
���n$|
dkrztjtd���n|j
�}	y%tt|	jd
d��\}}Wn/ttfk
r�tjtd�|	��nX|j���t||||�||j|jB|_|j|j
|j|j�|j_|j�|r[tj ||�n|j!�WdQXdS(s�Possibly perform a legacy stream clone operation.

    Legacy stream clones are performed as part of pull but before all other
    operations.

    A legacy stream clone will not be performed if a bundle2 stream clone is
    supported.
    i(t	localrepoNRsstreaming all changes
t
stream_outs'unexpected response from remote server:soperation forbidden by serveris$locking the remote repository failedis%the server sent an unknown error codet ("tR+R*RRRRtcommandexecutortcallcommandtresultRtstatusRtreadlinetintt
ValueErrorRt
ResponseErrortAborttmapR t	TypeErrortlockt	consumev1R(R!tresolvestorevfsoptionstfeaturestsvfstoptionst_writerequirementsRtreplacecachet
invalidate(
R$R+t	supportedR(RRt
rbranchmaptetfptltrespt	filecountt	bytecount((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytmaybeperformlegacystreamclonemsR			!
%

cC@satj|jkrtS|jjdddt�s5tStj|�}|r]|jjdd�StS(s5Whether streaming clones are allowed from the server.tservertuncompressedt	untrustedtuncompressedallowsecret(	RtREPO_FEATURE_STREAM_CLONER=RRt
configboolRRt	hassecret(Rtsecret((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytallowservergeneration�scC@s|jj|�S(N(R	twalk(Rtmatcher((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt_walkstreamfiles�sc@s�g�d}�j��[�jjd�xCt��D]5\}}}|r6�j||f�||7}q6q6WWdQX�jjdt��|f��j��jj�����fd�}t��||�fS(s�Emit content for version 1 of a streaming clone.

    This returns a 3-tuple of (file count, byte size, data iterator).

    The data iterator consists of N entries for each file being transferred.
    Each file entry starts as a line with the file name and integer size
    delimited by a null byte.

    The raw file data follows. Following the raw file data is the next file
    entry, or EOF.

    When used on the wire protocol, an additional line indicating protocol
    success will be prepended to the stream. This function is not responsible
    for adding it.

    This function will obtain a repository lock to ensure a consistent view of
    the store is captured. It therefore may raise LockError.
    is	scanning
Ns%d files, %d bytes to transfer
c	3@s�x��D]�\}}�r6�jjd||f�ndtj|�|fV�|ddt��I}|dkr�|j|�Vn%x"tj|d|�D]}|Vq�WWdQXqWdS(Nssending %s (%d bytes)
s%s%d
trbt	auditpathitlimit(RtdebugR	t	encodedirRtreadR
t
filechunkiter(tnametsizeRFtchunk(t	debugflagtentriesRR>(s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytemitrevlogdata�s(R:RR[RWtappendRR>Rb(Rttotal_bytesR_tenameR`Rd((RbRcRR>s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt
generatev1�s
	cc@syt|�sdVdSyt|�\}}}Wntjk
rJdVdSXdVd||fVx|D]}|VqfWdS(s�Emit content for version 1 of streaming clone suitable for the wire.

    This is the data output from ``generatev1()`` with 2 header lines. The
    first line indicates overall success. The 2nd contains the file count and
    byte size of payload.

    The success line contains "0" for success, "1" for stream generation not
    allowed, and "2" for error locking the repository (possibly indicating
    a permissions error for the server process).
    s1
Ns2
s0
s%d %d
(RTRhRt	LockError(RRIRJtitRa((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytgeneratev1wireproto�s
tUNc@sb�dkrtd��n�j�j@}djt|������fd�}||�fS(s@Emit content for version 1 of a stream clone bundle.

    The first 4 bytes of the output ("HGS1") denote this as stream clone
    bundle version 1.

    The next 2 bytes indicate the compression type. Only "UN" is currently
    supported.

    The next 16 bytes are two 64-bit big endian unsigned integers indicating
    file count and byte count, respectively.

    The next 2 bytes is a 16-bit big endian unsigned short declaring the length
    of the requirements string, including a trailing . The following N bytes
    are the requirements string, which is ASCII containing a comma-delimited
    list of repo requirements that are needed to support the data.

    The remaining content is the output of ``generatev1()`` (which may be
    compressed in the future).

    Returns a tuple of (requirements, data generator).
    Rls.we do not support the compression argument yetRc3@s�dV�Vt��\}}}�jjtd�||f�tjd||�Vtjdt��d�V�dV�jjtd�d|d	td
��}|jd�x)|D]!}|j	dt|��|Vq�W|j
�dS(
NtHGS1swriting %d bytes for %d files
s>QQs>Histbundlettotaltunittbytesitstep(RhRR2RtstructtpackRtmakeprogresstupdatet	incrementtcomplete(RIRJRjtprogressRa(tcompressionRtrequires(s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytgen4s	

	(R5R(R!R"R#(RRzR(R|((RzRR{s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytgeneratebundlev1scC@sX|j��F|jjtd�|tj|�f�|jjtd�d|dtd��}|jd�tj�}|j	d��\|j
j|jd|��*x"tj
|�D]}|j�}y(|jdd	�\}}	t|	�}	Wn/ttfk
r tjtd
�|��nX|jjrS|jjd|tj|	�f�ntj|�}
|j
|
dd
t��J}x@tj|d|	�D])}|jdt|��|j|�q�WWdQXq�WWdQX|jdt�WdQXtj�|}
|
dkrd}
n|j�|jjtd�tj|�|
tj||
�f�WdQXdS(s
Apply the contents from version 1 of a streaming clone file handle.

    This takes the output from "stream_out" and applies it to the specified
    repository.

    Like "stream_out," the status line added by the wire protocol is not
    handled by this function.
    s!%d files to transfer, %s of data
tcloneRoRpRqit
expectedcountsis'unexpected response from remote server:sadding %s (%s)
twtbackgroundcloseRZRrNtclearfilecacheg����MbP?s(transferred %s in %.1f seconds (%s/sec)
( R:RR2RR
RJRuRvttimerttransactionR>tbackgroundclosingRtxrangeR3R R4R5R9RR6RbR[R	t	decodedirRR^RwRtwriteRBRx(RRFRIRJRytstarttiRGR_R`tpathtofpRatelapsed((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyR;OsB	

!	
cC@s�|jd�}|dkr7tjtd�|��ntjd|jd��\}}tjd|jd��d}|j|�}|jd�s�tjtd	���nt|jd�j	d
��}|||fS(NiRls<only uncompressed stream clone bundles are supported; got %ss>QQis>Hiss@malformed stream clone bundle: requirements not properly encodedR(
R]RR7RRstunpacktendswithRtrstripR (RFRzRIRJtrequireslenR{R(((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytreadbundle1header�s
!cC@s�t|�r$tjtd���nt|�\}}}||j}|rwtjtd�djt|����nt||||�dS(s�Apply the content from a stream clone bundle version 1.

    We assume the 4 byte header has been read and validated and the file handle
    is at the 2 byte compression identifier.
    s2cannot apply stream clone bundle on non-empty repos4unable to apply stream clone: unsupported format: %ss, N(	RRR7RR�R!R"R#R;(RRFRIRJR(R)((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt
applybundlev1�s
tstreamcloneappliercB@s eZdZd�Zd�ZRS(s�Class to manage applying streaming clone bundles.

    We need to wrap ``applybundlev1()`` in a dedicated type to enable bundle
    readers to perform bundle type-specific functionality.
    cC@s
||_dS(N(t_fh(tselftfh((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt__init__�scC@st||j�S(N(R�R�(R�R((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytapply�s(t__name__t
__module__t__doc__R�R�(((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyR��s	tstccC@s&g}|j�s"|jd�n|S(s!list snapshot file from the storet
phaseroots(t
publishingRe(Rtfnames((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt_walkstreamfullstorefiles�scC@sE|\}}}}|tkr"|S||||||j|��fS(s actually copy the snapshot files(t	_filefullR"(tentrytcopytvfsmaptsrcR_tftypetdata((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt_filterfull�sc#@sDg�z�fd�}|VWdx�D]}tj|�q(WXdS(s(return a function to temporary copy filec@sFtj�\}}tj|��j|�tj||dt�|S(Nthardlink(RtmkstemptostcloseReR
t	copyfilesR(R�tfdtdst(tfiles(s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyR��s


N(R
t	tryunlink(R�ttmp((R�s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pytmaketempcopies�s	
cC@si|jt6|jt6}|S(s$make a (src -> vfs) map for the repo(R>t	_srcstoretcachevfst	_srccache(RR�((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt_makemap�s

cc@s�t|�}|jjtd�d|dtd��}|jd�t��c}|�Tg|D]}t|||�^q]}d	Vd}x|D]\}}	}
}||}|Vtj	t
|	��V|
tkr�||	�}
|}n0|
tkrt
|d�}
tj|
�j}nz�tj	|�V|	V|dkrJ|
j|�f}ntj|
d|�}x0|D](}|t
|�7}|j|�|VqfWWd	|
j�Xq�WWd	QXWd	QXd	S(
sactually emit the stream bundleRnRoRpRqiRXiRZN(R�RRuRRvR�R�RR
t
uvarintencodeRt_fileappendR�topentfstattst_sizeR]R^R�(RRct
totalfilesizeR�RyR�REtseenR�R_R�R�tvfsRFR`tchunksRa((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt_emit2�s<
%
	


c
C@s|s|r$tjtd���n|j���g}d}d}|sO|rjtj|j||�}n|jj	d�xLt
||�D];\}}}	|	r�|jt|t
|	f�||	7}q�q�Wx[t|�D]M}|jj|�r�||jj|�j7}|jt|tdf�q�q�W|rt|jjd�rt||jjd�j7}|jtdtdf�nx^tj|�D]M}|jj|�r�||jj|�j7}|jt|tdf�q�q�Wt|||�}
t|
�}WdQXt|�||
fS(s�Emit content for version 2 of a streaming clone.

    the data stream consists the following entries:
    1) A char representing the file destination (eg: store or cache)
    2) A varint containing the length of the filename
    3) A varint containing the length of file data
    4) N bytes containing the filename (the internal, store-agnostic form)
    5) N bytes containing the file data

    Returns a 3-tuple of (file count, file size, data iterator).
    s,server does not support narrow stream clonesis	scanning
tobsstoreN(RR7RR:RRtmatchtrootRR[RWReR�R�R�R>texiststlstatR�R�RtcachetocopyR�R�R�tnextR(RtincludestexcludestincludeobsmarkersRcR�RVR_RgR`R�tfirst((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt
generatev2s8
  c	g@sK|d}|d}|�+|r<t|��
dVWdQXndVWdQXdS(Nii(tnested(tctxstthistrest((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyR�Hs


c@sE�j��3�jjtd�|tj|�f�tj�}�jjtd�d|dtd��}|jd�t	��}�j
d��7�fd�|j�D�}t|���x�t
|�D]�}tj|d�}	||	}
tj|�}tj|�}tj||�}
�jjrR�jjd	|	|
tj|�f�n|
|
d
��J}x@tj|d|�D])}|jdt|��|j|�qzWWd
QXq�WWd
QX�jdt�Wd
QXtj�|}|dkr�d}n�jjtd�tj|j�|tj|j|�f�|j�Wd
QXd
S(s�Apply the contents from a version 2 streaming clone.

    Data is read from an object that only needs to provide a ``read(size)``
    method.
    s!%d files to transfer, %s of data
R~RoRpRqic3@s!|]}|j�j�VqdS(N(R�R(t.0R�(R(s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pys	<genexpr>esisadding [%s] %s (%s)
R�RZRrNR�g����MbP?s(transferred %s in %.1f seconds (%s/sec)
(R:RR2RR
RJR�RuRvR�R�tvaluesR�trangetreadexactlytuvarintdecodestreamRbR[R^RwRR�RBRtposRx(RRFRItfilesizeR�RyR�R�R�R�R�tnamelentdatalenR_R�RaR�((Rs;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt	consumev2SsB



!	cC@s�ddlm}g|D]}||jkr|^q}|ritjtd�djt|����nt||||�t	|�|j
|jB|_
|j|j
|j
|j�|j_|j�dS(Ni(R+s4unable to apply stream clone: unsupported format: %ss, (R.R+RCRR7RR"R#R�RR(R!R<RR=R>R?R@(RRFRIR�R(R+trR)((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt
applybundlev2�s(	(-t
__future__Rt
contextlibR�Rsti18nRR.RRRRRRRR	R
RR*RKRTRRWRhRkR}R;R�R�tobjectR�R�R�R�R�R�R�tcontextmanagerR�R�R�R�R�R�R�(((s;/usr/lib64/python2.7/site-packages/mercurial/streamclone.pyt<module>s:@R	H		4	7	@		
				$	1	2