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/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/mercurial/__pycache__/store.cpython-310.pyc
o

�]Lbe�@s.ddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZmZmZmZm	Z	mZmZddlmZe�d	�Zd
Zdd�Zd
d�Ze
ede�Zdd�Zdd�Zdd�Ze�\Z Z!dd�Z"dd�Z#dd�Z$e
edd�p~e$�Z%dZ&dZ'dd �Z(d!Z)d"Z*d"e*dd#Z+d$d%�Z,d&d'�Z-d(d)�Z.e
ed*e.�Z.d+d,�Z/d-d.�Z0gd/�Z1d0Z2d1Z3d2Z4e�5d3�Z6d4d5�Z7d6d7�Z8d8Z9d9Z:d:Z;d;Z<d<Z=dZ>d=Z?e9e=BZ@e9e>BZAe:e=BZBe:e>BZCe;e=BZDe;e>BZEe<ZFGd>d?�d?eG�ZHGd@dA�dAeH�ZIGdBdC�dCeG�ZJGdDdE�dEejK�ZLGdFdG�dGeH�ZMdS)H�)�absolute_importN�)�_)�getattr)�hex)�	changelog�error�manifest�policy�pycompat�util�vfs)�hashutil�parsersi@BcCsl|durdSt|�}|�d�r||td�td���S|�d�r/|�|td�td���St�d|��)z�parses a fncache entry and returns whether the entry is tracking a path
    matched by matcher or not.

    If matcher is None, returns TrueNT�data/�.i�meta/s
/00manifest.iscannot decode path %s)�	decodedir�
startswith�len�visitdirr�ProgrammingError)�path�matcher�r�1/usr/lib/python3/dist-packages/mercurial/store.py�_matchtrackedpath$s

rcCs|�dd��dd��dd�S)aM
    >>> _encodedir(b'data/foo.i')
    'data/foo.i'
    >>> _encodedir(b'data/foo.i/bla.i')
    'data/foo.i.hg/bla.i'
    >>> _encodedir(b'data/foo.i.hg/bla.i')
    'data/foo.i.hg.hg/bla.i'
    >>> _encodedir(b'data/foo.i\ndata/foo.i/bla.i\ndata/foo.i.hg/bla.i\n')
    'data/foo.i\ndata/foo.i.hg/bla.i\ndata/foo.i.hg.hg/bla.i\n'
    �.hg/�.hg.hg/�.i/�.i.hg/�.d/�.d.hg/��replace�rrrr�
_encodedir7s
�r&�	encodedircCs(d|vr|S|�dd��dd��dd�S)z�
    >>> decodedir(b'data/foo.i')
    'data/foo.i'
    >>> decodedir(b'data/foo.i.hg/bla.i')
    'data/foo.i/bla.i'
    >>> decodedir(b'data/foo.i.hg.hg/bla.i')
    'data/foo.i.hg/bla.i'
    rr"r!r rrr#r%rrrrLs	
�rccsN�dd�dD�}td�D]}|Vqtdd�D]}|Vq|D]}|VqdS)z�characters that are problematic for filesystems

    * ascii escapes (0..31)
    * ascii hi (126..255)
    * windows specials

    these characters will be escaped by encodefunctions
    cSsg|]}t|��qSr)�ord��.0�xrrr�
<listcomp>g�z_reserved.<locals>.<listcomp>z\:*?"<>|� �~�N)�range)�winreservedr+rrr�	_reserved^s�	�r3cs�d}tj}tt|td���}tttd�td�d��}dd�|D��t�D]
}d|�||�<q%|t|�gD]}|||����||�<q7i�t���D]\}}|�|<qM�fd	d
���fdd��fd
d�fS)a�
    >>> enc, dec = _buildencodefun()

    >>> enc(b'nothing/special.txt')
    'nothing/special.txt'
    >>> dec(b'nothing/special.txt')
    'nothing/special.txt'

    >>> enc(b'HELLO')
    '_h_e_l_l_o'
    >>> dec(b'_h_e_l_l_o')
    'HELLO'

    >>> enc(b'hello:world?')
    'hello~3aworld~3f'
    >>> dec(b'hello~3aworld~3f')
    'hello:world?'

    >>> enc(b'the\x07quick\xADshot')
    'the~07quick~adshot'
    >>> dec(b'the~07quick~adshot')
    'the\x07quick\xadshot'
    �_��A�ZrcSsi|]}||�qSrrr)rrr�
<dictcomp>��z#_buildencodefun.<locals>.<dictcomp>�~%02xc	3sr�d}|t|�kr7t�dd�D]}z�||||�V||7}Wnty,Yqwt�|t|�ks	dSdS)Nrr�)rr�xrange�KeyError)�s�i�l)�dmaprr�decode�s���z_buildencodefun.<locals>.decodecs$d���fdd�t�t���D��S)N�cs g|]}��||d��qS)rr�r*�c)�cmapr>rrr,�s z5_buildencodefun.<locals>.<lambda>.<locals>.<listcomp>)�joinrr<r�r>�rFrHr�<lambda>�s�z!_buildencodefun.<locals>.<lambda>csd�t�|���S)NrC)rG�listrH)rBrrrJ�r9)	r�bytechrrK�mapr1r(r3�lower�	iteritems)�e�xchr�asciistr�capitalsr+�k�vr)rFrBrAr�_buildencodefunps 



�rVcC�tt|��S)z~
    >>> encodefilename(b'foo.i/bar.d/bla.hg/hi:world?/HELLO')
    'foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o'
    )�_encodefnamer'rHrrr�encodefilename��rYcCrW)z~
    >>> decodefilename(b'foo.i.hg/bar.d.hg/bla.hg.hg/hi~3aworld~3f/_h_e_l_l_o')
    'foo.i/bar.d/bla.hg/hi:world?/HELLO'
    )r�_decodefnamerHrrr�decodefilename�rZr\csztj��fdd�t�d�D��t�D]
}d|��|�<qttd�td�d�D]}�|�����|�<q(�fdd	�}|S)
z�
    >>> f = _buildlowerencodefun()
    >>> f(b'nothing/special.txt')
    'nothing/special.txt'
    >>> f(b'HELLO')
    'hello'
    >>> f(b'hello:world?')
    'hello~3aworld~3f'
    >>> f(b'the\x07quick\xADshot')
    'the~07quick~adshot'
    csi|]	}�|��|��qSrrr))rQrrr8�sz(_buildlowerencodefun.<locals>.<dictcomp>r5r:r6r7rcsd��fdd�t�|�D��S)NrCcsg|]}�|�qSrrrDrIrrr,�r-z=_buildlowerencodefun.<locals>.lowerencode.<locals>.<listcomp>)rGr�iterbytestrrHrIrr�lowerencode�sz)_buildlowerencodefun.<locals>.lowerencode)rrLr<r3r1r(rN)r+r^r)rFrQr�_buildlowerencodefun�s
r_r^)sauxsconsprnsnul)scomslptcCs(t|�D]�\}}|sq|r(|ddvr(dt|dd��|dd�}|||<nQ|�d�}|dkr5t|�}|dkrA|dd�tvs]|d	kry|dd	�d
kry|dd	�dkry|dd�tvrydt|dd��}|dd�||dd�}|||<|ddvr�|dd�dt|dd��||<q|S)
a�
    Encodes filenames containing names reserved by Windows or which end in
    period or space. Does not touch other single reserved characters c.
    Specifically, c in '\:*?"<>|' or ord(c) <= 31 are *not* encoded here.
    Additionally encodes space or period at the beginning, if dotencode is
    True. Parameter path is assumed to be all lowercase.
    A segment only needs encoding if a reserved name appears as a
    basename (e.g. "aux", "aux.foo"). A directory or file named "foo.aux"
    doesn't need encoding.

    >>> s = b'.foo/aux.txt/txt.aux/con/prn/nul/foo.'
    >>> _auxencode(s.split(b'/'), True)
    ['~2efoo', 'au~78.txt', 'txt.aux', 'co~6e', 'pr~6e', 'nu~6c', 'foo~2e']
    >>> s = b'.com1com2/lpt9.lpt4.lpt1/conprn/com0/lpt0/foo.'
    >>> _auxencode(s.split(b'/'), False)
    ['.com1com2', 'lp~749.lpt4.lpt1', 'conprn', 'com0', 'lpt0', 'foo~2e']
    >>> _auxencode([b'foo. '], True)
    ['foo.~20']
    >>> _auxencode([b' .foo'], True)
    ['~20.foo']
    r�. r:rN�.����r;�9�1�)�	enumerater(�findr�_winres3�_winres4)r�	dotencoder?�nr@�ecrrr�
_auxencode�s* 

$�rn�x�r;cCs.tt�|����}t|dd���d�}t||�}|d}tj�	|�\}}g}d}	|dd�D]4}
|
dt
�}|ddvrE|dd�d}|	dkrNt|�}n|	dt|�}|tkr\n|�
|�|}	q/d�|�}
t|
�dkrs|
d7}
d|
||}tt|�}|dkr�|d|�}d|
|||}|S)	N��/rbrr`r4rsdh/)rr�sha1�digestr^�splitrn�osr�splitext�
_dirprefixlenr�_maxshortdirslen�appendrG�_maxstorepathlen)rrkrt�le�parts�basename�_root�ext�sdirs�sdirslen�p�d�t�dirs�res�	spaceleft�fillerrrr�_hashencodes6



r�cCs@t|�}t|��d�}d�t||��}t|�tkrt||�}|S)aeencodes path with a length limit

    Encodes all paths that begin with 'data/', according to the following.

    Default encoding (reversible):

    Encodes all uppercase letters 'X' as '_x'. All reserved or illegal
    characters are encoded as '~xx', where xx is the two digit hex code
    of the character (see encodefilename).
    Relevant path components consisting of Windows reserved filenames are
    masked by encoding the third character ('aux' -> 'au~78', see _auxencode).

    Hashed encoding (not reversible):

    If the default-encoded path is longer than _maxstorepathlen, a
    non-reversible hybrid hashing of the path is done instead.
    This encoding uses up to _dirprefixlen characters of all directory
    levels of the lowerencoded path, but not more levels than can fit into
    _maxshortdirslen.
    Then follows the filler followed by the sha digest of the full path.
    The filler is the beginning of the basename of the lowerencoded path
    (the basename is everything after the last path separator). The filler
    is as long as possible, filling in characters from the basename until
    the encoded path has _maxstorepathlen characters (or all chars of the
    basename have been taken).
    The extension (e.g. '.i' or '.d') is preserved.

    The string 'data/' at the beginning is replaced with 'dh/', if the hashed
    encoding was used.
    rr)r'rXrurGrnrr{r�)rrk�efr�rrr�
_hybridencode4s
r�cCsVt|�}t|�tkrt|d�St|��d�}d�t|d��}t|�tkr)t|d�S|S)NTrr)r'rr{r�rXrurGrn)r�der�r�rrr�_pathencode[s

r��
pathencodecCs
t|d�S�NF)r�)�frrr�_plainhybridencodeis
r�cCsHz|��j}dtj@d|@krd}W|SW|Sty#d}Y|Sw)Ni�)�stat�st_moder�umask�OSError)r
�moderrr�	_calcmodems
���r�)�	bookmarks�
narrowspec�data�meta�00manifest.d�00manifest.i�
00changelog.d�
00changelog.i�
phaseroots�obsstore�requires)rs
i.tmpcensored)s.idxs.ds.dat�.n�.nds.sdas
d.tmpcensored)r�r�s.*undo\.[^/]+\.(nd?|i)$cCs|tjkrdSt|�S�N)r��S_IFREG�revlog_type)r��kind�strrr�	is_revlog�s
r�cCs6|�t�rtS|�t�rt}|�t�r|tO}|SdSr�)�endswith�REVLOG_FILES_MAIN_EXT�FILEFLAGS_REVLOG_MAIN�REVLOG_FILES_OTHER_EXT�FILETYPE_FILELOG_OTHER�REVLOG_FILES_VOLATILE_EXT�FILEFLAGS_VOLATILE)r�r�rrrr��s


r�i iiirfic@s~eZdZdZdd�Zdd�Zdd�Zdd	d
�Zdd�Zdd
d�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�
basicstorez&base class for local repository storescCsB||�}|j|_t|�|_|j|_||_t�|t�|_|j|_	dSr�)
�baserr��
createmode�rawvfs�vfsmod�	filtervfsr'r
�opener��selfr�vfstyper
rrr�__init__�s
zbasicstore.__init__cC�|jdt|�S�Nrr)rr'�r�r�rrrrG��zbasicstore.joincCs�|j}|r|d|7}t|j�d}g}|j�|�rf|g}|jj}|rf|��}||dd�D]6\}	}
}|d|	}t|	|
|�}
|
durWt�||d��}|�	|
t
|�|jf�q-|
tj
krc|rc|�	|�q-|s#|��|S)z%yields (revlog_type, unencoded, size)rrrT)r�N)rrr��isdir�readdir�popr�r�pconvertrzr�st_sizer��S_IFDIR�sort)r��relpath�recurser�striplenr@�visitr�r�r�r�r��fp�rl_typerlrrr�_walk�s,
��
zbasicstore._walkNcCstj|j||d�S)N)�
trypending�concurrencychecker)rr
)r�r�r�rrrr�s
�zbasicstore.changelogcCs"t�|j|j�}t�|j|||�Sr�)r	�manifestrevlog�
nodeconstantsr
�manifestlog)r��repo�storenarrowmatch�	rootstorerrrr��szbasicstore.manifestlogccs>�|�dd�|�dd�}|D]
\}}}t|B||fVqdS)a4Like walk, but excluding the changelog and root manifest.

        When [undecodable] is None, revlogs names that can't be
        decoded cause an exception. When it is provided, it should
        be a list and the filenames that can't be decoded are added
        to it instead. This is very rarely needed.r�Tr�N)r��FILEFLAGS_FILELOG)r�r�undecodable�filesr��ur>rrr�	datafiles�s
��zbasicstore.datafilesccsn�t|�dd��}|D])\}}}|�d�rt|B||fVq|�d�r,t|B||fVqt|B||fVqdS)NrCFs00changelogs
00manifest)�reversedr�r�FILEFLAGS_CHANGELOG�FILEFLAGS_MANIFESTLOG�FILETYPE_OTHER)r�r�r�r�r>rrr�topfiless�

�zbasicstore.topfilesccs0�|�|�D]}|Vq|��D]}|VqdS)z�return file related to data storage (ie: revlogs)

        yields (file_type, unencoded, size)

        if a matcher is passed, storage files of only those tracked paths
        are passed with matches the matcher
        N)r�r�)r�rr+rrr�walks�	�zbasicstore.walkcCstSr���_data�r�rrr�copylist �zbasicstore.copylistcC�dSr�r�r��trrrr�write#r�zbasicstore.writecCr�r�rr�rrr�invalidatecaches&r�zbasicstore.invalidatecachescCr�r�r�r��fnrrr�markremoved)r�zbasicstore.markremovedcCs@d�d|f�}|j�|d�rdS|�d�s|d}|j�|�S)�!Checks if the store contains pathrrr�rT)rGr
�existsr��r�rrrr�__contains__,s
zbasicstore.__contains__r��NN)�__name__�
__module__�__qualname__�__doc__r�rGr�rr�r�r�r�r�r�r�r�r�rrrrr��s	


r�cs6eZdZdd�Zd
�fdd�	Zdd�Zdd	�Z�ZS)�encodedstorecCsF||d�}|j|_t|�|_|j|_||_t�|t�|_|j|_	dS)N�/store)
r�rr�r�r�r�r�rYr
r�r�rrrr�9s
zencodedstore.__init__Nc	#s��tt|���D]5\}}}zt|�}Wnty0|dur)td�|}t�|��|�|�Yqwt	||�s7q|||fVqdS)Nsundecodable revlog name %s)
�superr�r�r\r=rr�StorageErrorrzr)r�rr�r��f1�size�f2�msg��	__class__rrr�Gs�

�
�zencodedstore.datafilescCr�r�)rrYr�rrrrGVr�zencodedstore.joincCsddgdd�tD�S)Nr�r�cS�g|]}d|�qS�sstore/r�r*r�rrrr,Zr-z)encodedstore.copylist.<locals>.<listcomp>r�r�rrrr�Yszencodedstore.copylistr�)r�r�r�r�r�rGr��
__classcell__rrrrr�8s
r�c@sXeZdZdd�Zddd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)�fncachecCs||_d|_d|_t�|_dSr�)r
�entries�_dirty�set�addls)r�r
rrrr�`szfncache.__init__NcCs|jdur|�|�dSdS)z�read the fncache file if not already read.

        If the file on disk is corrupted, raise. If warn is provided,
        warn and keep going instead.N)r�_load)r��warnrrr�ensureloadedgs
�zfncache.ensureloadedc	Cs�d|_z	|jddd�}Wntyt�|_YdSwt�|_d}tt�|jt	�d�D].}||7}z|�
d�}|j�t|d|d���
��||dd�}Wq+tyYYq+w|rrtd	�}|ri||d�n	tj|td
�d��|�||�|��dS)z&fill the entries from the fncache fileF�fncache�rb)r�NrC�
rs$fncache does not ends with a newlines3use 'hg debugrebuildfncache' to rebuild the fncache)�hint)r	r
�IOErrorr
r�iter�	functools�partial�read�fncache_chunksize�rindex�updater�
splitlines�
ValueErrorrr�Abort�
_checkentries�close)r�r
r��chunkrEr�rrrrros<�
 ���z
fncache._loadcCsjd|jvr1|�d�tt�|��D]!\}}|�d�s0td�|d}|r+||d�qt�|��qdSdS)z-make sure there is no empty string in entriesrCrrs!invalid entry in fncache, line %drN)	r�seekrgr�iterfile�rstriprrr)r�r�r
rl�liner�rrrr�s



��zfncache._checkentriescCs�|jr9|jdus
J�|j|jB|_t�|_|�d�|jdddd�}|jr2|�td�|j�d��|�	�d|_|jrf|�d�|jdddd�}|jrY|�td�|j�d��|�	�d|_t�|_dSdS)NrswbT)r��
atomictemprFsab)
r	rrr
�	addbackupr
r�r'rGr)r�r�r�rrrr��s&

�z
fncache.writecCs0|jdur	|��||jvr|j�|�dSdSr�)rrr�addr�rrrr'�s


�zfncache.addcCsZ|jdur	|��||jvr|j�|�dSz|j�|�d|_WdSty,YdSw�NT)rrr�remover	r=r�rrrr)�s

�zfncache.removecCs*||jvrdS|jdur|��||jvSr()rrrr�rrrr��s



zfncache.__contains__cCs"|jdur	|��t|j|jB�Sr�)rrrrr�rrr�__iter__�s
zfncache.__iter__r�)r�r�r�r�rrrr�r'r)r�r*rrrrr]s

&rc@s.eZdZdd�Zddd�Zdd�Zdd	�Zd
S)�_fncachevfscCstj�||�||_||_dSr�)r��proxyvfsr�r�encode)r�r
�fncr-rrrr��s
z_fncachevfs.__init__�rcOs�|�|�}|dvr6|�d�s|�d�r6|jjduo|j�|�}|r.d|vr.|j�|�js.d}|s6|j�|�|j||g|�Ri|��S)N)r/rrrsr+F)	r-rrrr
r�r�r�r')r�rr��args�kw�encoded�notloadrrr�__call__�s
��z_fncachevfs.__call__cCs"|r|j�|�|��S|j�|�Sr�)r
rGr-r�rrrrG�sz_fncachevfs.joincCs(|�d�s
|�d�r|j�|�dSdS)z1generic hook point to lets fncache steer its stewrrN)rrr'r�rrr�
register_file�s�z_fncachevfs.register_fileN)r/)r�r�r�r�r4rGr5rrrrr+�s

r+c@s^eZdZdd�Zdd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�ZdS)�fncachestorecCst|rt}nt}||_||d�}|j|_|jd|_t|�|_|j|_||_t	|�}||_	t
|||�|_|j|_dS)Nr�rr)
r�r�r-r�r�pathsepr�r�r�rr+r
r�)r�rr�rkr-r
r.rrrr��s
zfncachestore.__init__cCs|j|�|�Sr�)r7r-r�rrrrG
�zfncachestore.joincCs|j�|�jSr�)r�r�r�r�rrr�getsize
szfncachestore.getsizeNccs��t|j�D]A}t||�sq|�|�}zt|�}|dus J|��|tO}|||�|�fVWqtyG}z
|jtj	kr=�WYd}~qd}~wwdSr�)
�sortedrrr-r�r�r9r��errno�ENOENT)r�rr�r�r�r��errrrrr�s"�

����zfncachestore.datafilescCsd}ddgdd�|D�S)N)
r�r�r�r�sdhrr�r�r�r�r�r�r�r�r�cSrrrrrrrr,.r-z)fncachestore.copylist.<locals>.<listcomp>r)r�r�rrrr�szfncachestore.copylistcC�|j�|�dSr�)rr�r�rrrr�0r8zfncachestore.writecCsd|j_t�|j_dSr�)rrr
rr�rrrr�3szfncachestore.invalidatecachescCr>r�)rr)r�rrrr�7r8zfncachestore.markremovedc
CsP|�|�}z|�|�WdSty'}z|jtjkr�WYd}~dSd}~ww)NTF)r-r9r�r;r<)r�r�r�r=rrr�_exists:s

��zfncachestore._existscCsjd�d|f�}|d}||jvr|�|�rdS|�d�s |d7}|jD]}|�|�r2|�|�r2dSq#dS)r�rrr�rTF)rGrr?r�r)r�rrPrrrr�Es

�zfncachestore.__contains__r�)
r�r�r�r�rGr9r�r�r�r�r�r?r�rrrrr6�s
r6)N�
__future__rr;rrv�rer��i18nrrr�noder�rrr	r
rr
r��utilsr�	importmodrrrr&r'rr3rVrXr[rYr\r_r^rirjrnr{rxryr�r�r�r�r�r�r�r�r��compile�EXCLUDEDr�r�r�r�r��FILEFLAGS_OTHERr��FILEFLAGS_REVLOG_OTHERr��FILETYPE_CHANGELOG_MAIN�FILETYPE_CHANGELOG_OTHER�FILETYPE_MANIFESTLOG_MAIN�FILETYPE_MANIFESTLOG_OTHER�FILETYPE_FILELOG_MAINr�r��objectr�r�rr,r+r6rrrr�<module>s|$	

<0 '
m%x#

https://t.me/RX1948 - 2025