403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/streamclone.cpython-39.opt-1.pyc
a

�+�b�z�@s�ddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZmZmZddlmZdd	lmZd
d�Zdd
�ZdDdd�Zdd�Zdd�ZdEdd�Z dd�Z!dd�Z"dFdd�Z#dd�Z$d d!�Z%d"d#�Z&Gd$d%�d%e'�Z(dZ)dZ*d&Z+d'Z,d(d)�Z-d*d+�Z.ej/d,d-��Z0d.d/�Z1d0d1�Z2d2d3�Z3d4d5�Z4d6d7�Z5d8d9�Z6ej/d:d;��Z7d<d=�Z8d>d?�Z9d@dA�Z:dBdC�Z;dS)G�)�absolute_importN�)�_)�open)�
repository)
�	bookmarks�	cacheutil�error�
narrowspec�phases�pycompat�requirements�scmutil�store�util)�nodemap)�
stringutilcCs t|�}|tj8}|�|�|S)a	determine the final set of requirement for a new stream clone

    this method combine the "default" requirements that a new repository would
    use with the constaint we get from the stream clone content. We keep local
    configuration choice when possible.
    )�set�requirementsmod�STREAM_FIXED_REQUIREMENTS�update)Zdefault_requirements�streamed_requirementsr
�r�;/usr/lib64/python3.9/site-packages/mercurial/streamclone.py�new_stream_clone_requirements&s

rcCs|jtj@}|S)z�the set of requirement the new clone will have to support

    This is used for advertising the stream options and to generate the actual
    stream content.)r
rr)�repoZrequiredformatsrrrr3s
�rFc	Cs|j}|j}d}|jr,d|j�dg�vr,d}|r8|s8dS|rD|sDdSt|�rPdS|jrZdS|j}|durr|�d�}|szdSt	�}|�d�r�|�
tj�n||�d�}|s�|jj
�td	��dSt	|�d
��}||j}|�r|jj
�td�d�t|���|jj
�td
��dS|}d|fS)a�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.
    Fsv2sstreamT)FNNsstream-preferreds
streamreqss=warning: stream clone requested but server has them disabled
�,sGwarning: stream clone requested but client is missing requirements: %s
�, sQ(see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
)r�remoteZ
canusebundle2Zremotebundle2caps�get�lenZheadsZstreamclonerequested�capabler�addrZREVLOGV1_REQUIREMENT�ui�warnr�split�	supported�join�sorted)	�pullopZbundle2rrZbundle2supportedZstreamrequestedr
Z
streamreqs�missingreqsrrr�canperformstreamclone>s`
	

��
�����r+c
	Csddlm}t|�\}}|s dS|j}|j}d}|�d�rr|��� }|�di���}Wd�n1sh0Y|j	�
td��|��� }|�di���}Wd�n1s�0Y|��}	zt
|	�}
Wn"ty�t�td�|	��Yn0|
dk�rt�td���n2|
d	k�r&t�td
���n|
dk�r>t�td���|��}	ztt
|	�d
d��\}}Wn(ttf�y�t�td�|	��Yn0|���tt||||�t|j|�|_|�|j	|j|j�|j_t�|�t� |�|�r�|j!�"||�|�#�Wd�n1�s0YdS)z�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.
    r��	localrepoNs	branchmapsstreaming all changes
s
stream_out�'unexpected response from remote server:soperation forbidden by server�s$locking the remote repository failedrs%the server sent an unknown error code� )$�r-r+rrr!ZcommandexecutorZcallcommand�resultr#�statusr�readline�int�
ValueErrorr	�
ResponseError�Abort�mapr%�	TypeError�lock�	consumev1rr
�resolvestorevfsoptions�features�svfs�optionsr�writereporequirementsr�post_stream_cleanupZ
_branchcaches�replace�
invalidate)
r)r-r&r
rrZ
rbranchmap�e�fp�lZresp�	filecount�	bytecountrrr�maybeperformlegacystreamclone�s^	

.
.�



�

��

rJcCsFtj|jvrdS|jjdddd�s&dSt�|�}|rB|j�dd�SdS)z5Whether streaming clones are allowed from the server.FsserversuncompressedT)Z	untrustedsuncompressedallowsecret)rZREPO_FEATURE_STREAM_CLONEr>r#Z
configboolrZ	hassecret)rZsecretrrr�allowservergeneration�s
rKcCs|j�|�S�N)r�walk)r�matcherrrr�_walkstreamfiles�srOcs�g�d}����R�j�d�t��D]$\}}}|r&��||f�||7}q&t��Wd�n1sh0Yt���j�dt��|f��j��jj	�����fdd�}t��||�fS)a�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.
    r�	scanning
Ns%d files, %d bytes to transfer
c	3s��D]�\}}�r$�j�d||f�dt�|�|fV�|ddd��@}|dkr^|�|�Vntj||d�D]
}|VqlWd�q1s�0YqdS)Nssending %s (%d bytes)
s%s%d
�rbF)Z	auditpath���limit)r#�debugrZ	encodedir�readr�
filechunkiter)�name�sizerF�chunk��	debugflag�entriesrr?rr�emitrevlogdata"sz"generatev1.<locals>.emitrevlogdata)
r;r#rUrO�append�_test_sync_point_walk_1�_test_sync_point_walk_2r r?r\)rZtotal_bytesZ	file_typerXrYr^rr[r�
generatev1�s"

&�rbccsjt|�sdVdSzt|�\}}}Wntjy@dVYdS0dVd||fV|D]
}|VqZdS)a�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
)rKrbr	Z	LockError)rrHrI�itrZrrr�generatev1wireproto4srd�UNcs@�dkrtd��t��}d�t|������fdd�}||�fS)a@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).
    res.we do not support the compression argument yetrc3s�dV�Vt��\}}}�j�td�||f�t�d||�Vt�dt��d�V�dV�jjtd�|td�d	�}|�d
�|D]}|j	t|�d�|Vq�|�
�dS)NsHGS1swriting %d bytes for %d files
�>QQ�>Hr��bundle�bytes��total�unitr��step)rbr#r3r�struct�packr �makeprogressr�	increment�complete)rHrIrc�progressrZ��compressionr�requiresrr�genls"�
�
zgeneratebundlev1.<locals>.gen)r6rr'r()rrwr
ryrrvr�generatebundlev1Psrzc
Cs|�����|j�td�|t�|�f�|jjtd�|td�d�}|�d�t��}|�	d���:|j
j|j|d���t�
|�D]�}|��}z|�dd�\}}	t|	�}	Wn&ttfy�t�td	�|��Yn0|jjr�|j�d
|t�|	�f�t�|�}
|j
|
ddd
��@}tj||	d�D] }|jt|�d�|�|��qWd�q�1�sV0Yq�Wd�n1�sx0Y|jdd�Wd�n1�s�0Yt��|}
|
dk�r�d}
|��|j�td�t�|�|
t�||
�f�Wd�n1�s0YdS)a
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.
    �!%d files to transfer, %s of data
�clonerjrkr)Z
expectedcountrhrr.sadding %s (%s)
�wT)ZbackgroundcloserSrnN�Zclearfilecache���MbP?�(transferred %s in %.1f seconds (%s/sec)
)r;r#r3rrrIrrr�timer�transactionr?�backgroundclosingrZxranger4r%r5r6r:r	r7r\rUrZ	decodedirrWrsr �writerDrt)rrFrHrIru�start�irGrXrY�path�ofprZ�elapsedrrrr<�sX	���
�
�
P,
���r<cCs�|�d�}|dkr$t�td�|��t�d|�d��\}}t�d|�d��d}|�|�}|�d�srt�td	���t|�d��	d
��}|||fS)Nr/res<only uncompressed stream clone bundles are supported; got %srf�rgrrhs@malformed stream clone bundle: requirements not properly encodedr)
rVr	r8rrp�unpack�endswithr�rstripr%)rFrwrHrIZrequireslenrxr
rrr�readbundle1header�s(
���

��r�cCsjt|�rt�td���t|�\}}}||j}|rNt�td�d�t|����t||||�t	�
|�dS)z�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 repo�4unable to apply stream clone: unsupported format: %srN)r r	r8rr�r&r'r(r<rrB)rrFrHrIr
r*rrr�
applybundlev1�s�
��r�c@s eZdZdZdd�Zdd�ZdS)�streamcloneapplierz�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.
    cCs
||_dSrL)�_fh)�selfZfhrrr�__init__szstreamcloneapplier.__init__cCst||j�SrL)r�r�)r�rrrr�applyszstreamcloneapplier.applyN)�__name__�
__module__�__qualname__�__doc__r�r�rrrrr�sr��s�ccCsg}|��s|�d�|S)z!list snapshot file from the stores
phaseroots)Z
publishingr_)r�fnamesrrr�_walkstreamfullstorefiless
r�cCs2|\}}}}|tkr|S||||||�|��fS)z actually copy the snapshot files)�	_filefullr')�entry�copy�vfsmap�srcrX�ftype�datarrr�_filterfull'sr�c
#sJg�z*�fdd�}|VW�D]}t�|�qn�D]}t�|�q40dS)z(return a function to temporary copy filecs4t��\}}t�|���|�tj||dd�|S)NT)�hardlink)rZmkstemp�os�closer_rZ	copyfiles)r��fd�dst��filesrrr�5s


zmaketempcopies.<locals>.copyN)rZ	tryunlink)r��tmprr�r�maketempcopies/s�r�cCst|jt|ji}|S)z$make a (src -> vfs) map for the repo)�	_srcstorer?�	_srccache�cachevfs)rr�rrr�_makemapBs�r�c#s�t|��|j���vr t�d��|jjtd�|td�d�}|�d�t	���f�|��>��fdd�|D�}dVd}|D�]\}}}}�|}	|Vt
�t|��V|t
kr�|	|�}
|}n|tkr�t|d	�}
t
�|
�j}d}z�t
�|�V|V|d
k�r|
�|�f}
nt
j|
|d�}
|
D].}|t|�7}|t|�7}|�|�|V�q||k�rlt�td�|||f��W|
��qx|
��0qxWd�n1�s�0YWd�n1�s�0YdS)
zactually emit the stream bundle�9repo.vfs must not be added to vfsmap for security reasonsrirjrkrcsg|]}t|����qSr)r�)�.0rE�r�r�rr�
<listcomp>b�z_emit2.<locals>.<listcomp>NrQrRrSs=clone could only read %d bytes from %s, but expected %d bytes)r��vfs�valuesr	�ProgrammingErrorr#rrrrr�rZ
uvarintencoder �_fileappendr�r�fstat�st_sizerVrWr8r�)rr]�
totalfilesizeruZtotalbytecountr�rXr�r�r�rFrYrI�chunksrZrr�r�_emit2OsX��





���r�cCsdS�z+a function for synchronisation during testsNr�rrrrr`�sr`cCsdSr�rr�rrrra�sracCs$g}d}d}|s|r$t�|j||�}t||�D]:\}}}	|	r.t}
|tj@rNt}
|�t	||
|	f�||	7}q.t
|�D]4}|j�|�rr||j�
|�j7}|�t	|tdf�qr|r�|j�d�r�||j�
d�j7}|�t	dtdf�t�|�D]4}|j�|�r�||j�
|�j7}|�t|tdf�q�||fS)a�emit a seris of files information useful to clone a repo

    return (entries, totalfilesize)

    entries is a list of tuple (vfs-key, file-path, file-type, size)

    - `vfs-key`: is a key to the right vfs to write the file (see _makemap)
    - `name`: file path of the file to copy (to be feed to the vfss)
    - `file-type`: do this file need to be copied with the source lock ?
    - `size`: the size of the file (or None)
    rNsobsstore)r
�match�rootrOr�rZFILEFLAGS_VOLATILEr�r_r�r�r?�exists�lstatr�rZcachetocopyr�r�)r�includes�excludes�includeobsmarkersr]r�rNZrl_typerXrYZftrrr�_v2_walk�s0


r�cCsz|���L|j�d�t||||d�\}}t|||�}t|�}t|�Wd�n1sZ0Yt|�t|�||fS)a�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).
    rP�r�r�r�N)	r;r#rUr�r��nextr`rar )rr�r�r�r]r�r��firstrrr�
generatev2�s
�
&r�c	gsv|d}|dd�}|�J|rNt|��dVWd�qT1sB0YndVWd�n1sh0YdS)Nrr)�nested)�ctxs�this�restrrrr��s
&r�cs(������j�td�|t�|�f�t��}�jjtd�|td�d�}|�d�t	��}�j
|��vrvt�
d����d��� �fdd�|��D�}t|���t|�D]�}t�|d	�}	||	}
t�|�}t�|�}t�||�}
�jj�r
�j�d
|	|
t�|�f�|
|
d��@}tj||d�D] }|jt|�d
�|�|��q$Wd�q�1�s\0Yq�Wd�n1�s~0Y�jdd�Wd�n1�s�0Yt��|}|dk�r�d}�j�td�t�|j�|t�|j|�f�|��Wd�n1�s0YdS)z�Apply the contents from a version 2 streaming clone.

    Data is read from an object that only needs to provide a ``read(size)``
    method.
    r{r|rjrkrr�c3s|]}|��j�VqdSrL)r�r#)r�r�r�rr�	<genexpr>r�zconsumev2.<locals>.<genexpr>rsadding [%s] %s (%s)
r}rSrnNTr~rr�)r;r#r3rrrIr�rrrr�r�r�r	r�r�r��rangeZreadexactlyZuvarintdecodestreamr\rUrWrsr r�rD�posrt)rrFrH�filesizer�rur�r�r�r�r�ZnamelenZdatalenrXr�rZr�rr�r�	consumev2�s`���
�



��P,

���r�cs�ddlm}�fdd�|D�}|r>t�td�d�t|����t�|||�t�j	|��_	|�
�j�j	�j��j
_t���t���dS)Nrr,csg|]}|�jvr|�qSr)r&�r��rr�rrr�1r�z!applybundlev2.<locals>.<listcomp>r�r)r1r-r	r8rr'r(r�rr
r=r#r>r?r@rrArrB)rrFrHr�r
r-r*rr�r�
applybundlev2.s$����
r�c
s�dg���fdd�}|D]z\}}}||}||}	|�|�}
|	�|�}tj�|�}tj�|�sht�|�|	�|�tj|
|�d|dd���	�q�dS)NTcsd�d<td��_dS)NFrscopying)r�topicr�r�rurr�	copy_usedHsz_copy_files.<locals>.copy_usedrF)r�Zno_hardlink_cbZcheck_fs_hardlink)
r'r�r��dirnamer�r�makedirsZ
register_file�copyfilers)
�src_vfs_mapZdst_vfs_mapr]rur��kr�rYZsrc_vfsZdst_vfsZsrc_pathZdst_pathr�rr�r�_copy_filesEs(



�
r�cCs0dd�|jD�}dd�|jD�}|�����|����t�|�}|�d�}d}tj�|�r^d}t|dddd	�\}}t	|�}	t	|�}
|j
jtd
�t
|�|td�d�}d
d�|D�}t|	|
||�}
|r�t�|�}|�d�}t�||�Wd�n1s�0Y|��|
�rd}nd}|j
�|t
|�|�|�d��}|j�|�Wd�n1�s`0Y|jdfg}|�|���|D]�\}}z|�|�Wnht�y}zN|jtjk�r�td�}|�|�}t�|�}|||f;}|j
�|�WYd}~n
d}~00�q�Wd�n1�s"0YdS)zYcopy all content from one local repository to another

    This is useful for local clonecSsh|]}|tjvr|�qSr�rZWORKING_DIR_REQUIREMENTSr�rrr�	<setcomp>gs
�zlocal_copy.<locals>.<setcomp>cSsh|]}|tjvr|�qSrr�r�rrrr�ls
�s	bookmarksrrNTr�slinkingsfiles)r�rlrmcss |]\}}}}|||fVqdSrLr)r�r�r�r�rYrrrr��r�zlocal_copy.<locals>.<genexpr>slinked %d files
scopied %d files
s
localclonesundo.backupfilesserror removing %s: %s
) r
r;rZbookmarksvfsr'r�r�r�r�r�r#rrrr r�rr�rtrUr�rr�r?�extendZ	undofiles�unlink�OSError�errno�ENOENTrZforcebytestrr$)Zsrc_repoZ	dest_repoZsrc_store_requirementsZdest_store_requirementsZsrc_book_vfsZsrcbookmarksZbm_countr]r�r�Zdest_vfs_maprur�r�Zdst_book_vfsZdstbookmarks�msg�trZ
undo_filesZundovfsZundofilerEr�Ze_msgrrr�
local_copycsf��


�

�

*,

r�)F)N)re)<Z
__future__r�
contextlibr�r�rpZi18nrrrZ
interfacesrr1rrr	r
rr
rrrrZrevlogutilsrZutilsrrrr+rJrKrOrbrdrzr<r�r��objectr�r�r�r�r�r�r��contextmanagerr�r�r�r`rar�r�r�r�r�r�r�rrrr�<module>sV0

]K
8
:K

<)!
E

Youez - 2016 - github.com/yon3zu
LinuXploit