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 :  /usr/lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.9/site-packages/mercurial/__pycache__/branchmap.cpython-39.pyc
a

�+�bR~�@sVddlmZddlZddlmZmZmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZmZejr�ddlmZmZmZmZmZmZmZmZmZddlmZeeeeeeeeeeef
�s�J�ejZejZej Z ej!Z!Gd	d
�d
e"�Z#dd�Z$d
d�Z%Gdd�de"�Z&Gdd�de&�Z'dZ(de(Z)de(Z*dZ+ee+�Z,de,Z-dZ.dZ/dZ0Gdd�de"�Z1dS)�)�absolute_importN�)�bin�hex�nullrev)�encoding�error�obsolete�pycompat�scmutil�util)�repoviewutil�
stringutil)	�Any�Callable�Dict�Iterable�List�Optional�Set�Tuple�Union)�	localrepoc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�BranchMapCachez8mapping of filtered views of repo with their branchcachecCs
i|_dS�N)�_per_filter��self�r�9/usr/lib64/python3.9/site-packages/mercurial/branchmap.py�__init__EszBranchMapCache.__init__cCs|�|�|j|jSr)�updatecacher�
filtername�r�reporrr�__getitem__Hs
zBranchMapCache.__getitem__cs�|j}|j}|j�|���dus*��|�s4t�|��g}�dur�t�|�}|dur�|�|�}||�	��|jj
|j
}|��fdd�|D��nt|��|�|j�j
dd��|r���||���|�s�J|���|j|j<dS)z<Update the cache for the given filtered view on a repositoryNc3s|]}|�jkr|VqdSr)�tiprev)�.0�r��bcacherr�	<genexpr>c�z-BranchMapCache.updatecache.<locals>.<genexpr>r)�start)�	changelogr"r�get�validfor�branchcache�fromfile�subsettable�filtered�copyZfilteredrevs�extend�revsr&�update)rr$�clr"r7Z
subsetnameZsubsetZ	extrarevsrr)rr!Ls&


zBranchMapCache.updatecachecs�|j}|j�|j}g}t�}t�|�D]8}||7}|D]&}�|�}	||	�\}
}|r6|�|�q6q&|r�t�fdd�|D��}t||||�	�||d�}
dD]2}|�
|�}|
�|�r�|
|j|<|
�
|�dSq�dS)z�Replace the branchmap cache for a repo with a branch mapping.

        This is likely only called during clone with a branch map from a
        remote.

        c3s|]}t�|��VqdSr)�int�r'�node�Zclrevrrr+�r,z)BranchMapCache.replace.<locals>.<genexpr>)�closednodes)sbases	immutablesservedN)r.�rev�
branchinfo�setr
�
itervalues�add�maxr1r<r4r0r�write)rr$Zremotebranchmapr9ZclbranchinfoZrbheads�closed�bheads�hr(�b�cZrtiprev�cache�	candidateZrviewrr=r�replaceos6
�




zBranchMapCache.replacecCs|j��dSr)r�clearrrrrrN�szBranchMapCache.clearcCs:|��}|j��D]"\}}|jr|�|�}|�|�qdSr)�
unfilteredr�items�_delayedr4rE)rr$Zunfir"rKrrr�
write_delayed�s

zBranchMapCache.write_delayedN)
�__name__�
__module__�__qualname__�__doc__r r%r!rMrNrRrrrrrBs#'rcCstdt�t|����dS)zEraises ValueError when branchcache found a node which does not existsznode %s does not existN)�
ValueErrorr
Zsysstrr�r<rrr�_unknownnode�srYcCs|jdurd|jSdSdS)Nsbranch cache (%s)sbranch cache�r")r$rrr�_branchcachedesc�s

r[c@s�eZdZdZddedddfdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zdd�Zedd��Zdd�Zedd��Zdd�Zd d!�Zd"d#�Zd$d%�Zd3d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdS)4r1a<A dict like object that hold branches heads cache.

    This cache is used to avoid costly computations to determine all the
    branch heads of a repo.

    The cache is serialized on disk in the following format:

    <tip hex node> <tip rev number> [optional filtered repo hex hash]
    <branch head hex node> <open/closed state> <branch name>
    <branch head hex node> <open/closed state> <branch name>
    ...

    The first line is used to check if the cache is still valid. If the
    branch cache is for a filtered repo view, an optional third hash is
    included that hashes the hashes of all filtered and obsolete revisions.

    The open/closed state is represented by a single letter 'o' or 'c'.
    This field can be used to avoid changelog reads when determining if a
    branch head closes a branch or not.
    rNcCs~||_d|_|dur|j|_n||_||_||_|durBt�|_n||_t|�|_	d|_
t�|_||_|jdurzdd�|_dS)z�hasnode is a function which can be used to verify whether changelog
        has a given node or not. If it's not provided, we assume that every node
        we have exists in changelogFNcSsdS)NTr)�xrrr�<lambda>�r,z&branchcache.__init__.<locals>.<lambda>)
�_reporQ�nullid�tipnoder&�filteredhashrA�_closednodes�dict�_entries�_closedverified�_verifiedbranches�_hasnode)rr$�entriesr`r&rar>�hasnoderrrr �s 



zbranchcache.__init__cCs2|jr
dS|jD]}|�|�st|�qd|_dS)zverify the closed nodes we haveNT)rerbrgrY)rr<rrr�
_verifyclosed�s


zbranchcache._verifyclosedcCsJ||jvs||jvrdS|j|D]}|�|�s"t|�q"|j�|�dS)z'verify head nodes for the given branch.N)rdrfrgrYrC)r�branch�nrrr�
_verifybranch�s

zbranchcache._verifybranchcCs,t|j���|j}|D]}|�|�qdS)z"verifies nodes of all the branchesN)rArd�keysrfrm)rZneedverificationrIrrr�
_verifyall�szbranchcache._verifyallcCs
t|j�Sr)�iterrdrrrr�__iter__szbranchcache.__iter__cCs||j|<dSr)rd)r�key�valuerrr�__setitem__szbranchcache.__setitem__cCs|�|�|j|Sr�rmrd�rrrrrrr%	s
zbranchcache.__getitem__cCs|�|�||jvSrrurvrrr�__contains__
s
zbranchcache.__contains__ccs.t�|j�D]\}}|�|�||fVqdSr)r
�	iteritemsrdrm)r�k�vrrrrxs
zbranchcache.iteritemscCs|�|�||jvS)z2checks whether a branch of this name exists or notru)r�labelrrr�	hasbranchs
zbranchcache.hasbranchc
CsRd}�z6z�|�|�|��}t|�}t|��d��dd�}|dd�\}}t|�t|�}}d}|jj	}t
|�dkr~t|d�}||||||d�}	|	�|�s�td��|	�
||�Wnzttfy�YW|r�|��dSt�y*}
z<|jj�rd}|j�|t|�t�|
�f�d}	WYd}
~
n
d}
~
00W|�rN|��n|�rL|��0|	S)N�
� �)r`r&rariztip differssinvalid %s: %s
)�cachevfs�	_filenamerp�next�rstrip�splitrr:r.ri�lenr0rW�load�IOError�OSError�close�	Exception�uiZ	debugflag�debugr[r�forcebytestr)�clsr$�f�lineiter�cachekeyZlastZlrevrarir*�inst�msgrrrr2sT�
�
���
�
zbranchcache.fromfilecCs~|D]t}|�d�}|sq|�dd�\}}}|dvr:td��t�|���}t|�}|j�|g��	|�|dkr|j
�|�qdS)z[fully loads the branchcache by reading from the file using the line
        iterator passedr}r~rsoczinvalid branch state�cN)r�r�rWr�tolocal�striprrd�
setdefault�appendrbrC)rr$r��liner<�stater{rrrr�Js
zbranchcache.loadcCsd}|jrd||jf}|S)z7name of a branchcache file for a given repo or repoviewsbranch2s%s-%srZ)r$�filenamerrrr�Zszbranchcache._filenamecCsRz|j�|j�}Wnty&YdS0|j|kr6dStj||jdd�}|j|kS)z�check that cache contents are valid for (a subset of) this repo

        - False when the order of changesets changed or if we detect a strip.
        - True when cache is up-to-date for the current repo or its subset.FT�Zneedobsolete)r.r<r&�
IndexErrorr`rra)rr$r<Ztiphashrrrr0bs
zbranchcache.validforcCs8|d}d}t|�D]}||jvr|}d}q0q||fS)zhReturn tuple with last open head in heads and false,
        otherwise return last closed head and true.���TF)�reversedrb)r�headsZtiprFrHrrr�
_branchtipws
zbranchcache._branchtipcCs|�||�dS)z�Return the tipmost open head on branch head, otherwise return the
        tipmost closed head on branch.
        Raise KeyError for unknown branch.r)r�)rrkrrr�	branchtip�szbranchcache.branchtipcs�fdd�|D�S)Nc3s|]}|�jvr|VqdSr)rb)r'rlrrrr+�r,z'branchcache.iteropen.<locals>.<genexpr>r)r�nodesrrr�iteropen�szbranchcache.iteropenFcCs*|�|�|j|}|s&t|�|��}|Sr)rmrd�listr�)rrkrFr�rrr�branchheads�s


zbranchcache.branchheadsccs,t�|�D]\}}||f|�|�Vq
dSr)r
rxr�)r�bnr�rrr�iterbranches�szbranchcache.iterbranchescCs|��t�|j�S)zreturns all the heads)ror
rBrdrrrr�	iterheads�szbranchcache.iterheadscCs"t|�|j|j|j|j|j|j�S)z-return an deep copy of the branchcache object)�typer^rdr`r&rarbrrrrr5�s�zbranchcache.copyc
CsV|��}t|dd�sd|_dSz�|j|�|�ddd�}t|j�d|jg}|jdurd|�	t|j��|�
d�|�d�d}tt
�|j��D]P\}}t�|�}|D]8}|d	7}||jvr�d
}	nd}	|�
dt|�|	|f�q�q�|��|j�d
dt|�t|j�|�d|_WnDtttjf�yP}
z"|j�dt�|
��WYd}
~
n
d}
~
00dS)NZ	finalizedT�w)Z
atomictemps%dr~r}rrr��os	%s %s %s
�branchcaches%wrote %s with %d labels and %d nodes
Fs couldn't write branch cache: %s
)�currenttransaction�getattrrQr�r�rr`r&rar�rE�join�sortedr
rxrdr�	fromlocalrbr�r��logr[r�r�r�r�Abortr�rr�)rr$�trr�r�Z	nodecountr{r�r<r�r�rrrrE�sD


�
��zbranchcache.writecs�t��}|j�i}|��j}|D]8}||�\}}|�|g��|�|r |j���	|��q |j
}	d}
|��jj}t
�|d�}t�|�D�]�\}}
|j�|g�}�fdd�|D�}t�}t|
�D]�}||vr�q�|s�|�|�q�dd�||�D�}t�}t�}t�}|D]N}||v�r|�|�n2||v�s:||�d|k�rF|�|�n
|�|��qt|�t|�k�rtdk�s�n|�|�|�|�|�|�|�|�q�|�r�|
du�r�t����}
||
�r�t|�}|t|�k�r�t��||��}||8}|�r�fd	d�t|�D�||<t|
�}||	kr�|}	q�|	|j
k�rH|	|_
��	|	�|_|�|��s�|j|_t|_
|� �D]D}|�sx�qjt�fd
d�|D��}||j
k�rj��	|�|_||_
�qjt!j"||j
dd
�|_"t��|}|j#�$ddt%|�|�|�&|�dS)z�Given a branchhead cache, self, that may have extra nodes or be
        missing heads, and a generator of nodes that are strictly a superset of
        heads missing, this function updates self to be correct.
        Nsobsoletecsh|]}��|��qSr�r?r;�r9rr�	<setcomp>r,z%branchcache.update.<locals>.<setcomp>cSsg|]}|tkr|�qSr)r)r'�prrr�
<listcomp>r,z&branchcache.update.<locals>.<listcomp>rrcsg|]}��|��qSrrX)r'r?r�rrr�>r,c3s|]}��|�VqdSrr�r;r�rrr+Sr,z%branchcache.update.<locals>.<genexpr>Tr�r�supdated %s in %.4f seconds
)'rZtimerr.�revbranchcacher@r�r�rbrCr<r&rO�
parentrevsr	Zgetrevsr
rxrdr/rAr�r�r8�difference_updateZheadrevs�minrD�	ancestorsr`r0r_rr�rrar�r�r[rE)rr$ZrevgenZ	starttimeZnewbranchesZ
getbranchinfor(rkZclosesbranchZntiprevZ	topoheadsr�ZobsrevsZnewheadrevsrGZbheadsetZ	uncertainZnewrev�parentsZ
samebranchZotherbranchZ
obsparentsr�Zfloorrevr�r&r�Zdurationrr�rr8�s�
$

"





��zbranchcache.update)F)rSrTrUrVrr rjrmrorqrtr%rwrxrPr|�classmethodr2r��staticmethodr�r0r�r�r�r�r�r�r5rEr8rrrrr1�sB�
&


,

(r1c@seZdZdZdd�ZdS)�remotebranchcachez@Branchmap info for a remote connection, should not write locallycCsdSrrr#rrrrEiszremotebranchcache.writeN)rSrTrUrVrErrrrr�fsr�s-v1s	rbc-namessrbc-revss>4sI�@�i���lc@sjeZdZdZddd�Zdd�Zejdd��Zd	d
�Z	dd�Z
d
d�Zdd�Zddd�Z
dd�Zdd�ZdS)r�a�Persistent cache, mapping from revision number to branch name and close.
    This is a low level cache, independent of filtering.

    Branch names are stored in rbc-names in internal encoding separated by 0.
    rbc-names is append-only, and each branch name is only stored once and will
    thus have a unique index.

    The branch info for each revision is stored in rbc-revs as constant size
    records. The whole file is read into memory, but it is only 'parsed' on
    demand. The file is usually append-only but will be truncated if repo
    modification is detected.
    The record for each revision contains the first 4 bytes of the
    corresponding node hash, and the record is only used if it still matches.
    Even a completely trashed rbc-revs fill thus still give the right result
    while converging towards full recovery ... assuming no incorrectly matching
    node hashes.
    The record also contains 4 bytes where 31 bits contains the index of the
    branch and the last bit indicate that it is a branch close commit.
    The usage pattern for rbc-revs is thus somewhat similar to 00changelog.i
    and will grow with it but be 1/8th of its size.
    Tc
Cs"|jdusJ�||_g|_t�|_d|_z4|j�t�}t	|�|_|rZdd�|�
d�D�|_Wn"ttfy~|rz|j
|_Yn0|jr�z|j�t�}||jdd�<Wn>ttfy�}z"|j�dt�|��WYd}~n
d}~00tt	|j�tt	|j��|_|jdk�rg|_t	|j�|_dS)NrcSsg|]}t�|��qSr)rr�)r'r�rrrr��sz+revbranchcache.__init__.<locals>.<listcomp>�s(couldn't read revision branch cache: %s
)r"r^�_names�	bytearray�_rbcrevs�
_rbcsnameslenr��read�	_rbcnamesr�r�r�r��_branchinfor@r�r�rr�r��_rbcrecsizer.�_rbcrevslen�_rbcnamescount)rr$�readonlyZbndata�datar�rrrr �s>
����zrevbranchcache.__init__cCsFd|_|jdd�=d|_t|jj�|_t|jt�|_	t
�|d�dS)Nrs
_namesreverse)r�r�r�r�r^r.r�r�r�r�rZclearcachedpropertyrrrr�_clear�szrevbranchcache._clearcCsdd�t|j�D�S)NcSsi|]\}}||�qSrr)r'r(rIrrr�
<dictcomp>�r,z0revbranchcache._namesreverse.<locals>.<dictcomp>)�	enumerater�rrrr�
_namesreverse�szrevbranchcache._namesreversec	Cs|jj}|t}|tkr"|�|�St|j�|tkr>|�|�S|�|�dt	�}t
tt�
|j�|�\}}t|t@�}|r�|tM}|dkr�nx||kr�z|j||fWSty�|jj�d�|��Yn0n4|jj�d|�|t}|j|d�=t|j|�|_|�|�S)zWReturn branch name and close flag for rev, using and updating
        persistent cache.NssRreferenced branch names not found - rebuilding revision branch cache from scratch
sPhistory modification detected - truncating revision branch cache to revision %d
)r^r.r�rr@r�r�r�r<�_rbcnodelen�unpack_from�
_rbcrecfmtr�buffer�bool�
_rbccloseflag�_rbcbranchidxmaskr�r�r�r�r�r�r�)	rr?r.�	rbcrevidx�reponodeZ	cachenode�	branchidxr��truncaterrrr@�s@

����zrevbranchcache.branchinfocCsx|jj}|�|�\}}||jvr,|j|}n t|j�}|j�|�||j|<|�|�}|rb|tO}|�	|||�||fS)z7Retrieve branch info from changelog and update _rbcrevs)
r^r.r@r�r�r�r�r<r��
_setcachedata)rr?r.rIr�r�r�rrrr��s



zrevbranchcache._branchinfocCsx|j\}}||jvr |j|}n t|j�}|j�|�||j|<|rL|tO}|�||jj�	|�|�dt
|�vrt|`dS)z%add new data information to the cacher@N)r@r�r�r�r�r�r�r^r.r<�vars)rr?Zchangelogrevisionrkr�r�rrr�setdatas



zrevbranchcache.setdatacCs�|tkrdS|t}|t}t|j�}||krD|j�dtt|��tt|j|||�t	|j
|�|_
|j��}|r�|�
d|j�dS)z:Writes the node's branch data to the in-memory cache data.Nr�swrite-revbranchcache)rr�r�r�r6rD�
_rbcmininc�	pack_intor�r�r�r^r�ZaddfinalizerE)rr?r<r�r�ZrequiredsizeZrbccurr�rrrr�s

zrevbranchcache._setcachedataNcCs�|j}d}d}z�zj|jt|j�kr<|jdd�}d}|�|�|jt}|t|j�krxd}|durl|jdd�}|�	||�WnJt
ttj
tjfy�}z&|j�d|t�|�f�WYd}~n
d}~00W|dur�|��n|dur�|��0dS)z!Save branch cache if it is dirty.Nr,F)�waits namess+couldn't write revision branch cache%s: %s
)r^r�r�r��wlock�_writenamesr�r�r��
_writerevsr�r�rr�Z	LockErrorr�r�rr��release)rr�r$r��stepr-r�rrrrE,s0

��
�zrevbranchcache.writecCs�|jdkrV|j�td�}|��|jkr2|�d�n$|��|j�	dt�d|_d|_
|jdkr~|jjtdd�|j�td�}|�d�
dd	�|j|jd
�D���|��|_|��t|j�|_d
S)z,write the new branch names to revbranchcacher�abr�s%s changed - rewriting it
T)Z
ignoremissingswbcss|]}t�|�VqdSr)rr�)r'rIrrrr+Ys�z-revbranchcache._writenames.<locals>.<genexpr>N)r�r��openr��tellr�rEr�r�r�r�Z
unlinkpathr�r�r�r�)rr$r�rrrr�Is&


��
zrevbranchcache._writenamescCs�tt|j�t|j�t�}|j�td��x}|��|krv|j�	dt|f�|�
|�|��|krnd}|�
|�|��|t}|�|j||��Wd�n1s�0Y||_
dS)z$write the new revs to revbranchcacher�struncating cache/%s to %d
rN)r�r�r.r�r�r�r�r�r�r��seekr�rEr�)rr$r-r7r��endrrrr�bs
�

2zrevbranchcache._writerevs)T)N)rSrTrUrVr r�rZ
propertycacher�r@r�r�r�rEr�r�rrrrr�{s
$
/
r�)2Z
__future__r�structr<rrr�rrr	r
rrZutilsr
r�
TYPE_CHECKING�typingrrrrrrrrrr�anyr3�calcsizer�r��objectrrYr[r1r�Z_rbcversionr�r�r�r�r�r�r�r�r�rrrr�<module>sT ,��_<	

Youez - 2016 - github.com/yon3zu
LinuXploit