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/hgext/remotefilelog/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/hgext/remotefilelog/__pycache__/fileserverclient.cpython-39.pyc
a

�+�b-Y�@sddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
mZmZmZmZmZddlmZmZddlmZmZmZejZdadadadadZ d	d
�Z!dd�Z"d
d�Z#Gdd�de$�Z%dd�Z&dd�Z'dd�Z(Gdd�de$�Z)dS)�)�absolute_importN)�_)�bin�hex)�error�pycompat�revlog�sshpeer�util�wireprotov1peer)�hashutil�procutil�)�	constants�contentstore�
metadatastorecCs4tt�|����}tj�||dd�|dd�|�S)N��rrZsha1�digest�os�path�join)�reponame�file�id�pathhash�r�J/usr/lib64/python3.9/site-packages/hgext/remotefilelog/fileserverclient.py�getcachekey0srcCs tt�|����}tj�||�S�Nr)rrrrrr�getlocalkey5sr cs G�fdd�d|j���|_dS)NcsPeZdZejdd��Zejdd��Zdd�Z��fdd�Z��fd	d
�Z	�Z
S)z!peersetup.<locals>.remotefilepeercs0|�d�st�d����fdd�}��d�|fS)N�
x_rfl_getfiles5configured remotefile server does not support getfilecs*|�dd�\}}t|�r&t���|��|S)N�r)�split�intr�LookupError)�d�code�data�r�noderr�decodeCsz?peersetup.<locals>.remotefilepeer.x_rfl_getfile.<locals>.decode�sfilesnode��capabler�Abort)�selfrr*r+rr)r�
x_rfl_getfile<s
�z/peersetup.<locals>.remotefilepeer.x_rfl_getfilecSs(|�d�st�d��dd�}d|i|fS)Nsx_rfl_getflogheadss:configured remotefile server does not support getflogheadscSs|r|�d�SgS)N�
)r#)r&rrrr+SszDpeersetup.<locals>.remotefilepeer.x_rfl_getflogheads.<locals>.decodespathr-)r0rr+rrr�x_rfl_getflogheadsKs
�z4peersetup.<locals>.remotefilepeer.x_rfl_getflogheadscSs�|dkrdStj|��vrdSt�|d�s.dStj|jjvr@dS|�d�}|rV|g}ng}|�	tj
�|jjr�d�|jj�}d|}|�	|�|jj
r�d�|jj
�}d|}|�	|�d�|�|d<dS)Ns	getbundle�
_localrepos
bundlecapsr"sincludepattern=sexcludepattern=�,)r�NETWORK_CAP_LEGACY_SSH_GETFILESZcapabilitiesr
�safehasattrZSHALLOWREPO_REQUIREMENTr4Zrequirements�get�appendZBUNDLE2_CAPABLITYZincludepatternrZexcludepattern)r0�command�optsZ
bundlecaps�patternsZ
includecapZ
excludecaprrr�_updatecallstreamoptsXs8����
	

z7peersetup.<locals>.remotefilepeer._updatecallstreamoptscs&|�||�t�|�j||fi|��Sr)r=�super�_sendrequest)r0r:�argsr;��	__class__�remotefilepeerrrr?�s
��z.peersetup.<locals>.remotefilepeer._sendrequestcs@t�|�}t�|d�s(|�|t�|��t�|�j|fi|��S)Nr?)r>r
r7r=rZbyteskwargs�_callstream)r0r:r;Z	supertyperArrrD�s
z-peersetup.<locals>.remotefilepeer._callstream)�__name__�
__module__�__qualname__rZ	batchabler1r3r=r?rD�
__classcell__r�rC�rBrrC;s

(rCrJ)�ui�peerrrIr�	peersetup:sQrMc@s:eZdZdZdd�Zdd�Zdd�Zdd	d
�Zdd�Zd
S)�cacheconnectionz�The connection for communicating with the remote cache. Performs
    gets and sets by communicating with an external process that has the
    cache-specific implementation.
    cCs"d|_|_|_d|_d|_dS)NF)�pipeo�pipei�pipee�
subprocess�	connected�r0rrr�__init__�szcacheconnection.__init__cCs8|jrt�td���t�|�\|_|_|_|_d|_	dS)Nscache connection already openT)
rOrr/rr
Zpopen4rPrQrRrS)r0Zcachecommandrrr�connect�s�zcacheconnection.connectcCs�dd�}|jr�z|j�d�Wnty0Yn0||j�d|_||j�d|_||j�d|_z|j��Wnty�Yn0d|_d|_dS)NcSs$z|��WntyYn0dSr)�close�	Exception)�piperrr�tryclose�sz'cacheconnection.close.<locals>.tryclosesexit
F)rSrP�writerXrOrQrRZcommunicate)r0rZrrrrW�s$


zcacheconnection.closeTcCsD|jr@z|j�|�|r"|j��Wnty>|��Yn0dSr)rSrPr[�flush�IOErrorrW)r0�requestr\rrrr^�szcacheconnection.requestcCsL|js
dSz"|j��dd�}|s*|��WntyF|��Yn0|S)N���)rSrO�readlinerWr])r0�resultrrr�receiveline�szcacheconnection.receivelineN)T)	rErFrG�__doc__rUrVrWr^rbrrrrrN�s
	rNc
Cs�|����}g}|D](}|�|�d|||dd�d���qt|�D]T\}	}||	��}
d||	<||}|dd�}|t�dt|
�|
f�||�|�qDWd�n1s�0YdS)Nr!����r,s%d
%s)Zcommandexecutorr9Zcallcommand�	enumeratera�io�BytesIO�len)
�remote�receivemissing�progresstick�missed�idmap�	batchsize�eZfutures�m�i�rZfile_r*rrr�_getfilesbatch�s
��rscCs�|�d�d}|j}|j}|t|�kr�|}	tt|�|	|�}
|
}||	|
�D].}|dd�}||}
d||
f}|�|�qL|��||	|
�D]*}|dd�}||}
|||
|�|�q�q|�d�|��dS)N�x_rfl_getfilesrrd�%s%s
r2)rD�_pipeo�_pipeirh�minr[r\)rirjrkrlrm�steprqrOrP�start�end�	missingid�	versionidr�
sshrequestrrr�_getfiles_optimistic�s*


rcs�|�d�|j�|j}���fdd�}tj|d�}d|_|���D]*}	|	dd�}
�|	}||||
�|�qD|����d���	�dS)Nrtcs@�D].}|dd�}�|}d||f}��|�q���dS)Nrdru)r[r\)r|r}rr~�rmrlrOrr�writersz"_getfiles_threaded.<locals>.writer)�targetTrdr2)
rDrvrw�	threading�Thread�daemonrzrr[r\)rirjrkrlrmryrPr�Zwriterthreadr|r}rrr�r�_getfiles_threadeds

r�c@sbeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)�fileserverclientz:A client for requesting files from the remote file server.cCs\|j}||_||_|�dd�|_|jr4t�|j�|_|�dd�|_|�dd�|_t	�|_
dS)N�
remotefilelogscacheprocessscacheprocess.includepathsdebug)rK�repo�config�cacheprocessr
Z
expandpathZ
configbool�cacheprocesspasspath�debugoutputrN�remotecache)r0r�rKrrrrU5s�zfileserverclient.__init__cCs||_||_||_||_dSr)�	datastore�historystore�	writedata�writehistory)r0r�r�r�r�rrr�setstoreGszfileserverclient.setstorecCs|jj�|jj�Sr)r�Zconnectionpoolr8ZfallbackpathrTrrr�_connectMszfileserverclient._connectc	Cs\|jjs|��|j}|j}|j}t|�}d|}i}|j}|D]:\}	}
t||	|
�}|jrf||	d7}||d7}|	||<q@|�	|�|j
jtd�|d�}|�
d�g}
|��}|s�t|
�}|D]}||vr�|
�|�q�|j
�td���q.|dkr��q.|�d	��r"|�d
�}|�t|d��q�|
�|�q�tt|
�7a|t|
�}|j
||d�|j
jdd
||||d�t�d�}�z�|
�r(|j
j}d|j
_�zj�z&|����}|j}|�tj��rt |t!��s�t"�#d��|j
�$dd�}|j
�%dd�}|dk�r�t&}nt'}|||j(|j|
||�nh|�d��rr|�d��r2d}nd}|j
�$dd|�}|j
�)dt|
��t*||j(|j|
||�n
t"�#d��Wd�n1�s�0Y|j
jdd|j+|||d�Wn4t,�y�|j
jdd|j+|||d��Yn0W||j
_n
||j
_0d t|
�d�-|
�f}|�	|�|�.�|�/|jj0�Wt�|�nt�|�0dS)!z�Takes a list of filename/node pairs and fetches them from the
        server. Files are stored in the local cache.
        A list of nodes that the server couldn't find is returned.
        If the connection fails, an exception is raised.
        sget
%d
r"r2sdownloading)�totalrs@warning: cache connection closed early - falling back to server
�0s_hits_�_rr�s"remote cache hit rate is %r of %r
)Zhitr�Fs"remotefilelog requires ssh serverssgetfilesstepsgetfilestypesthreadedr!sbatch�d�
s	batchsizes1requesting %d files from remotefilelog server...
s>configured remotefilelog server does not support remotefilelogNsremotefilefetchlogsSuccess
)Z
fetched_filesZtotal_to_fetchsFail
s
set
%d
%s
)1r�rSrVr�r�rh�namerr�r^rKZmakeprogressr�updaterb�setr9�warn�
startswithr#Z	incrementr$�fetchmisses�logr�umask�verboser�rLr.rr6�
isinstance�
_sshv1peerrr/Z	configintr�r�rrj�debugrs�posrXrZcompleteZmarkrepor)r0�fileids�cacher�r�r�r^rmrrrZfullidZprogressrlr|Z	missedset�partsZ	fromcacheZoldumaskr�ZconnriryZgetfilestypeZ	_getfilesZbatchdefaultrnrrrr^Ps�


��
�	

����
�����	�$�
�

zfileserverclient.requestcCs�|��dd�}|s(t�td�td���t|�}|�|�}t|�|krft�td�td�t|�|f��|j�|t	|�t
�|��dS)Nr_s error downloading file contents:sconnection closed earlysonly received %s of %s bytes)r`rZ
ResponseErrorrr$�readrhr�Zaddremotefilelognoder�zlib�
decompress)r0rY�filenamer*�line�sizer(rrrrj�s �
��zfileserverclient.receivemissingcCsB|jr&d|j|jjf}|j�|�nGdd�dt�}|�|_dS)Ns%s %sc@s.eZdZdd�Zdd�Zddd�Zdd	�Zd
S)z-fileserverclient.connect.<locals>.simplecachecSsg|_d|_dS)NT)�
missingidsrSrTrrrrU
sz6fileserverclient.connect.<locals>.simplecache.__init__cSsdSrrrTrrrrWsz3fileserverclient.connect.<locals>.simplecache.closeTcSs8|�d�}|ddkrdS|dd�|_|j�d�dS)Nr2rsgetrr_r�)r#r�r9)r0�valuer\�linesrrrr^s

z5fileserverclient.connect.<locals>.simplecache.requestcSst|j�dkr|j�d�SdS)Nr)rhr��poprTrrrrbsz9fileserverclient.connect.<locals>.simplecache.receivelineN)T)rErFrGrUrWr^rbrrrr�simplecache	s
r�)r�r��_pathr�rV�object)r0�cmdr�rrrrVs
zfileserverclient.connectcCsvtr`dtttttt�tt�dtf}|jr<|j�|�|jjd|�	dd�ttttdd�|j
jrr|j
��dS)NsN%d files fetched over %d fetches - (%d misses, %0.2f%% hit ratio) over %0.2fs
gY@sremotefilelog.prefetch�%s%%i�)ZremotefilelogfetchedZremotefilelogfetchesZremotefilelogfetchmissesZremotefilelogfetchtime)
�fetches�fetchedr��float�	fetchcostr�rKr�r��replacer�rSrW)r0�msgrrrrWs*��

�	zfileserverclient.closeFTcs��j}g}|D]:\}}|dkst|�dks|�|�s6q|�|t|�f�q�j}	�j}
|rrtj|j	�}	t
j|j�}
t
�}|r�|�|	�|��|r�|�|
�|��t�fdd�|D��}|r�fdd�|D�}|jjd|dd�|�r�td	7atd
k�r8tdk�r8td
k�r0�j�dd
�}
|
�r0�j�|
d����dd�t|�D�}tt|�7at��}��|�}|�r�t�td�t|���tt��|7a��|�dS)z.downloads the given file versions to the caches.hgtags�*cs g|]\}}|�jjkrd�qSr�r�Znullid)�.0ZunusedrrTrr�
<listcomp>^�z-fileserverclient.prefetch.<locals>.<listcomp>cs$g|]\}}|�jjkr||f�qSrr�)r��frrTrrr�assDremotefilelog not fetching %d null revs - this is likely hiding bugssremotefilelog-ext)r�r��r�sfetchwarningr2cSsg|]\}}|t|�f�qSr)r)r�rrrrrr�yr�sunable to download %d filesN)r�rhZshallowmatchr9rr�r�rZunioncontentstoreZshareddatastoresrZunionmetadatastoreZsharedhistorystoresr�r�Z
getmissingrKZ	develwarnr�r�r��
logstacktrace�sortedr��timer^rr/rr��_lfsprefetch)r0r��forceZ	fetchdataZfetchhistoryr�Z
idstocheckrrr�r�r�ZnullidsZfetchwarningrzrrTr�prefetch9sp�
����
���
�
�zfileserverclient.prefetchc
s�trt�|jjd�sdStj�|j�s*dSg}|jjj�|D]^\}}t|�}|j�	|�}|�
|�tj@r<|�
|�}tj�|�}|��}	��|	�s<|�|�q<t|�dkr�|jjj�|��t�fdd�|D��s�J�dS)Nslfslocalblobstorerc3s|]}��|���VqdSr)�has�oid)r��p��storerr�	<genexpr>�r�z0fileserverclient._lfsprefetch.<locals>.<genexpr>)�_lfsmodr
r7r�Zsvfs�wrapperZcandownloadZlfslocalblobstorerr�flagsrZREVIDX_EXTSTOREDZrawdataZpointerZdeserializer�r�r9rhZlfsremoteblobstoreZ	readbatch�all)
r0r�Zpointersrrr*Zrlog�textr�r�rr�rr��s(�


zfileserverclient._lfsprefetchc	Cs0ddl}|j�ddd�dd�|��D���dS)Nrr�s"excess remotefilelog fetching:
%s
r�css|]}t�|�VqdSr)rZsysbytes)r��srrrr��r�z1fileserverclient.logstacktrace.<locals>.<genexpr>)�	tracebackrKr�r�format_stack)r0r�rrrr��s�zfileserverclient.logstacktraceN)FTF)rErFrGrcrUr�r�r^rjrVrWr�r�r�rrrrr�2s�
Kr�)*Z
__future__rrfrr�r�r�Zmercurial.i18nrZmercurial.noderrZ	mercurialrrrr	r
rZmercurial.utilsrr
�rrrZ	sshv1peerr�r�r�r�r�r�rr rMr�rNrsrr�r�rrrr�<module>s0 UE 

Youez - 2016 - github.com/yon3zu
LinuXploit