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__/changelog.cpython-310.pyc
o

�]Lb�N�@sddlmZddlmZddlmZmZddlmZddl	m
Z
mZmZm
Z
mZddlmZmZddlmZmZd	d
iZdd�Zd
d�Zdd�Zdd�Zdd�ZGdd�de�ZGdd�de�Zdd�Zej Gdd�de��Z!Gdd�de�Z"Gdd �d ej�Z#d!S)"�)�absolute_import�)�_)�bin�hex)�attr)�encoding�error�metadata�pycompat�revlog)�dateutil�
stringutil)�	constants�flagutil�branch�defaultcCs(|�dd��dd��dd�}|�dd�S)	aA
    >>> from .pycompat import bytechr as chr
    >>> d = {b'nl': chr(10), b'bs': chr(92), b'cr': chr(13), b'nul': chr(0)}
    >>> s = b"ab%(nl)scd%(bs)s%(bs)sn%(nul)s12ab%(cr)scd%(bs)s%(nl)s" % d
    >>> s
    'ab\ncd\\\\n\x0012ab\rcd\\\n'
    >>> res = _string_escape(s)
    >>> s == _string_unescape(res)
    True
    �\�\\�
s\n�
s\r��\0)�replace��text�r�5/usr/lib/python3/dist-packages/mercurial/changelog.py�_string_escape$s


�rcCs6d|vr|�dd�}|�dd�}|�dd�}t�|�S)Nrrs\\
rr�)rr�unescapestrrrrr�_string_unescape8s

r!cCs<t��}|�d�D]}|rt|��dd�\}}|||<q	|S)a�
    >>> from .pycompat import bytechr as chr
    >>> sorted(decodeextra(encodeextra({b'foo': b'bar', b'baz': chr(0) + b'2'})
    ...                    ).items())
    [('baz', '\x002'), ('branch', 'default'), ('foo', 'bar')]
    >>> sorted(decodeextra(encodeextra({b'foo': b'bar',
    ...                                 b'baz': chr(92) + chr(0) + b'2'})
    ...                    ).items())
    [('baz', '\\\x002'), ('branch', 'default'), ('foo', 'bar')]
    r�:r)�
_defaultextra�copy�splitr!)r�extra�l�k�vrrr�decodeextraAs�r*cs �fdd�t��D�}d�|�S)Ncs g|]}td|�|f��qS)s%s:%s)r)�.0r(��drr�
<listcomp>Vs zencodeextra.<locals>.<listcomp>r)�sorted�join)r-�itemsrr,r�encodeextraTs
r2cCsd�dd�|��D���d�S)z>strip trailing whitespace and leading and trailing empty linesrcSsg|]}|���qSr)�rstrip)r+r'rrrr.\szstripdesc.<locals>.<listcomp>)r0�
splitlines�strip)�descrrr�	stripdescZ�r7c@speZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dd
�Z
ddd�Zddd�Zdd�Z
dd�Zdd�ZdS)�appenderz`the changelog index must be updated last on disk, so we use this class
    to delay writes to itcCs:||_|||�}||_|��|_|�|�j|_|j|_dS�N)�data�fp�tell�offset�fstat�st_size�size�_end)�self�vfs�name�mode�bufr<rrr�__init__cs

zappender.__init__cC�|jSr:)rB�rCrrr�endk�zappender.endcCrIr:)r>rJrrrr=nrLz
appender.tellcCsdSr:rrJrrr�flushqszappender.flushcCs|jjSr:)r<�closedrJrrrrNtszappender.closedcCs|j��dSr:)r<�closerJrrrrOxszappender.closercCs`|dkr||_n|dkr|j|7_n|dkr|��||_|j|jkr.|j�|j�dSdS)z,virtual file offset spans real file and datarr�N)r>rKrAr<�seek)rCr>�whencerrrrQ{s�z
appender.seek���cCs�d}|j|jkr#|j�|�}|}|jt|�7_|dkr#|t|�8}|dkrV|j|j}|j�dd�|j��|jdd�=|jd|||�}|jt|�7_||7}|S)z5only trick here is reads that span real file and datarrrN)r>rAr<�read�lenr;�insertr0)rC�count�ret�s�doffrrrrT�sz
appender.readcCs8|j�t|��|jt|�7_|jt|�7_dSr:)r;�append�bytesr>rUrB)rCrYrrr�write�szappender.writecCs|j��|Sr:)r<�	__enter__rJrrrr^�s
zappender.__enter__cGs|jj|�Sr:)r<�__exit__)rC�argsrrrr_��zappender.__exit__N)r)rS)�__name__�
__module__�__qualname__�__doc__rHrKr=rM�propertyrNrOrQrTr]r^r_rrrrr9_s


r9c@s&eZdZdd�Zd
dd�Zdd�Zd	S)�
_divertopenercCs||_||_dSr:)�_opener�_target)rC�opener�targetrrrrH�s
z_divertopener.__init__�rFcKs6||jkr|j||fi|��S|j|d|fi|��S)N�.a)rirh)rCrErF�
checkambig�kwargsrrr�__call__�s
z_divertopener.__call__cCst|j|�Sr:)�getattrrh)rCrrrr�__getattr__�raz_divertopener.__getattr__N�rlF)rbrcrdrHrprrrrrrrg�s
rgcsd���fdd�	}|S)z?build an opener that stores chunks in 'buf' instead of 'target'rlFcs0|�kr
�||fi|��S|rJ�t�||��Sr:)r9)rErFrnro�rGrjrkrr�_delay�sz_delayopener.<locals>._delayNrsr)rjrkrGrurrtr�_delayopener�srvc@s�eZdZe��Ze��Zejdd�Zejdd�Zeje�	e
�d�Zejdd�Zejdd�Z
ejdd�Zejdd�Zejdd�Zejeddfd�ZdS)�_changelogrevisionr)�default)rrNrF)rbrcrdr�ibr&�manifest�user�date�Factory�list�files�
filesadded�filesremoved�p1copies�p2copies�descriptionr#�
branchinforrrrrw�srwcs�eZdZdZdZ�fdd�Zedd��Zedd��Zed	d
��Z	edd��Z
ed
d��Zedd��Zedd��Z
edd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Z�ZS)!�changelogrevisionz�Holds results of a parsed changelog revision.

    Changelog revisions consist of multiple pieces of data, including
    the manifest node, user, and date. This object exposes a view into
    the parsed object.
    )�_offsets�_text�	_sidedata�_cpsd�_changesc
s�|s	tt|jd�Stt|��|�}|�d�}|�d|d�}|�d|d�}||d|d�dkr5|}	n|�d|d�}	||||	f|_||_||_	||_
d|_|S)N)r&rzrrrP�

)rwr#�nullid�superr��__new__�indexr�r�r�r�r�)
�cls�clr�sidedata�cpsdrC�nl1�nl2�nl3�doublenl��	__class__rrr��s
zchangelogrevision.__new__cCst|jd|jd��S)Nr)rr�r�rJrrrrzszchangelogrevision.manifestcCs&|j}t�|j|dd|d��S�Nrr)r�r�tolocalr��rC�offrrrr{
s zchangelogrevision.usercCs4|j}|j|dd|d�}|�dd�dd�S)NrrP� r)r�r�r%)rCr��	dateextrarrr�_rawdateszchangelogrevision._rawdatecCsD|j}|j|dd|d�}|�dd�}t|�dkrdS|dS)NrrPr��)r�r�r%rU)rCr�r��fieldsrrr�	_rawextraszchangelogrevision._rawextracCsF|j}t|d�}zt|d�}W||fSty"d}Y||fSwr�)r��float�int�
ValueError)rC�raw�time�timezonerrrr|s��zchangelogrevision.datecCs|j}|dur	tSt|�Sr:)r�r#r*)rCr�rrrr&+szchangelogrevision.extracCs`|jdur|jS|jrt�|j�}ntj|jpd|jpd|jp d|j	p$i|j
p(id�}||_|S)Nr)�touched�added�removed�	p1_copies�	p2_copies)r�r�r
�decode_files_sidedatar��
ChangingFilesrr�r�r�r�)rC�changesrrrr�3s
�zchangelogrevision.changescCsL|jr	t|jj�S|j}|d|dkrgS|j|dd|d��d�S)NrPr�rr)r�r/r�r�r�r�r%r�rrrrDs zchangelogrevision.filescC�4|jr|jjS|j�d�}|durdSt�|j|�S)Ns
filesadded)r�r�r�r&�getr
�decodefileindicesr�rC�
rawindicesrrrr�N�zchangelogrevision.filesaddedcCr�)Nsfilesremoved)r�r�r�r&r�r
r�rr�rrrr�Xr�zchangelogrevision.filesremovedcCr�)Nsp1copies)r�r��copied_from_p1r&r�r
�decodecopiesr�rC�	rawcopiesrrrr�br�zchangelogrevision.p1copiescCr�)Nsp2copies)r�r��copied_from_p2r&r�r
r�rr�rrrr�lr�zchangelogrevision.p2copiescCst�|j|jddd��S)Nr�rP)rr�r�r�rJrrrr�vr8zchangelogrevision.descriptioncCs|j}t�|�d��d|vfS)Nrsclose)r&rr�r�)rCr&rrrr�zszchangelogrevision.branchinfo)rbrcrdre�	__slots__r�rfrzr{r�r�r|r&r�rr�r�r�r�r�r��
__classcell__rrr�rr��s@&



	



	
	
	
	
	
r�cs�eZdZddd�Zedd��Zejdd��Z�fdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Z		ddd�Zdd�Zdd�Z�ZS) �	changelogFNcCs�tjj||tjdfddd|j�dd�||d�	|jr,|jtjkr,|j	tj
M_	d|_d|_||_
d|_d|_d|_t�|_i|_|j�d�|_dS)aVLoad a changelog revlog using an opener.

        If ``trypending`` is true, we attempt to load the index from a
        ``00changelog.i.a`` file instead of the default ``00changelog.i``.
        The ``00changelog.i.a`` file contains index (and possibly inline
        revision) data for a transaction that hasn't been finalized yet.
        It exists in a separate file to facilitate readers (such as
        hooks processes) accessing data before a transaction is finalized.

        ``concurrencychecker`` will be passed to the revlog init function, see
        the documentation there.
        Ns00changelogTspersistent-nodemapF)rk�radixrn�mmaplargeindex�persistentnodemap�concurrencychecker�
trypendingscopies-storage)rrH�revlog_constants�KIND_CHANGELOG�optionsr��
_initempty�_format_version�REVLOGV1�
_format_flags�FLAG_GENERALDELTA�
_generaldelta�_storedeltachains�_realopener�_delayed�	_delaybuf�_divert�	frozenset�
_filteredrevs�_filteredrevs_hashcache�_copiesstorage)rCrjr�r�rrrrH�s,
�zchangelog.__init__cCrIr:)r�rJrrr�filteredrevs�szchangelog.filteredrevscCst|t�sJ�||_i|_dSr:)�
isinstancer�r�r�)rC�valrrrr��s
cs|js
tt|��|�dSdSr:)r�r�r��
_write_docket�rC�trr�rrr��s�zchangelog._write_docketcCs�|jdurC|jsCt|�dkr,d|_|j�|jd�r#|j�|jd�t|j|j�|_	n
g|_
t|j|j|j
�|_	|j	|j_	|j	|j
_	d|_|�dt|�|j�|�dt|�|j�dS)z2delay visibility of index updates to other readersNrTrmscl-%i)�_docketr�rUr�r��exists�
_indexfile�unlinkrgrjr�rv�_segmentfile�_segmentfile_sidedata�
addpending�id�
_writepending�addfinalize�	_finalizer�rrr�delayupdate�s�

zchangelog.delayupdatecCs�d|_|j|_|j|j_|j|j_|jdur|�|�n>|jr>|jr$J�|j	d}|j�
|�}|��|jj||j	dd�n|jrZ|j|j	ddd�}|�
d�|j��|��d|_d|_|�|�dS)zfinalize index updatesFNrmT)rn�ar)r�r�rjr�r�r�r�r�r�r��openrO�renamer]r0�_enforceinlinesize)rCr��tmpname�nfiler<rrrr��s&




zchangelog._finalizecCs�|jr|jj|dd�S|jrP|�|j�}|jd}|�|�|�|d�}|�|���|�d�|j��|��d|_d|_	t
|j|j�|_|j|j_|j|j
_|j	rUdSdS)zLcreate a file containing the unfinalized state for
        pretxnchangegroupT)�pendingrm�wrNF)r�r]r�r�r��registertmprTr0rOr�rgrjr�r�)rCr��fp1�pendingfilename�fp2rrrr��s$



zchangelog._writependingcCs|jstj�||�dSdSr:)r�rr�r�rrrr�s�zchangelog._enforceinlinesizecCsH|�|�}|�|�}|jdk}t||||�}|j|j|j|j|j|j	fS)a�Obtain data from a parsed changelog revision.

        Returns a 6-tuple of:

           - manifest node in binary
           - author/user as a localstr
           - date as a 2-tuple of (time, timezone)
           - list of files
           - commit message as a localstr
           - dict of extra metadata

        Unless you need to access all fields, consider calling
        ``changelogrevision`` instead, as it is faster for partial object
        access.
        �changeset-sidedata)
�
_revisiondatar�r�r�rzr{r|rr�r&)rC�	nodeorrevr-r��copy_sd�crrrrTs



zchangelog.readcCs(|�|�}|�|�}t||||jdk�S)z6Obtain a ``changelogrevision`` for a node or revision.r�)r�r�r�r�)rCr�rr�rrrr�s


�zchangelog.changelogrevisioncCs:|�|�}|s	gS|�d�}|d|��d�}|dd�S)zX
        short version of read that only returns the files modified by the cset
        r�Nrr�)�revisionr�r%)rCr�r�lastr'rrr�	readfiles&s

zchangelog.readfilesc
	CsHt�|�t�|�}}|��}|st�td���d|vr(t�td�t�|���t|�}|r6dt	�
|�}
ndt	��}
|	rX|	�d�}|dvrK|	d=n
|dvrXt�td�|��t
|j�}d	}
d}|jd
krs|jrn|
tjO}
t�|�}|	rt|	�}	d|
|	f}
t|�||
g|d|g}d�|�}|j||t|�||||
d
�}|�|�S)Nsempty usernamersusername %r contains a newlines%d %dr)rr)�.snullstipsthe name '%s' is reservedrr�s%s %sr)r��flags)r�	fromlocalr5r	�StorageErrorrr�bytestrr7r
�	parsedate�makedater�r/r�r��has_copies_infor�REVIDX_HASCOPIESINFOr
�encode_files_sidedatar2rr0�addrevisionrU�node)rCrzrr6�transaction�p1�p2r{r|r&�
parseddate�branch�sortedfilesr�r�r'r�revrrr�add1sH�

�




�
z
changelog.addcCs|�|�jS)z�return the branch name and open/close state of a revision

        This function exists because creating a changectx object
        just to access this is costly.)r�r�)rCrrrrr�mszchangelog.branchinfocCs|j�dg�}|�|�dS)Ns
revduplicates)r��
setdefaultr[)rCr
r�
duplicatesrrr�_nodeduplicatecallbacktsz changelog._nodeduplicatecallback)FN)NN)rbrcrdrHrfr��setterr�r�r�r�r�rTr�r�rr�rr�rrr�rr��s&
,


�<r�N)$�
__future__r�i18nrr	rr�
thirdpartyr�rr	r
rr�utilsr
r�revlogutilsrr�rr#rr!r*r2r7�objectr9rgrvrYrwr�r�rrrr�<module>s*	F1

https://t.me/RX1948 - 2025