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

�]Lb�;�@s�dZddlmZmZddlZddlZddlmZddlm	Z	e�
d�ZGdd	�d	e�Z
ejGd
d�de��ZejGdd
�d
e��ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�ZGdd�de�ZdS)a�linelog is an efficient cache for annotate data inspired by SCCS Weaves.

SCCS Weaves are an implementation of
https://en.wikipedia.org/wiki/Interleaved_deltas. See
mercurial/helptext/internals/linelog.txt for an exploration of SCCS weaves
and how linelog works in detail.

Here's a hacker's summary: a linelog is a program which is executed in
the context of a revision. Executing the program emits information
about lines, including the revision that introduced them and the line
number in the file at the introducing revision. When an insertion or
deletion is performed on the file, a jump instruction is used to patch
in a new body of annotate information.
�)�absolute_import�print_functionN�)�attr)�pycompats>IIc@seZdZdZdS)�LineLogErrorz>Error raised when something bad happens internally in linelog.N)�__name__�
__module__�__qualname__�__doc__�rr�3/usr/lib/python3/dist-packages/mercurial/linelog.pyr src@s$eZdZe��Ze��Ze��ZdS)�lineinfoN)rr	r
r�ib�rev�linenum�_offsetrrrr
r$src@s,eZdZe��Ze��Ze��Zdd�ZdS)�annotateresultcCs
t|j�S�N)�iter�lines��selfrrr
�__iter__4�
zannotateresult.__iter__N)	rr	r
rrrr�_eofrrrrr
r.s
rc@s`eZdZejZejdd��Zejdd��Zdd�Z	ejdd��Z
ejd	d
��Zejdd��Zd
S)�_llinstructioncC�dSrr�r�op1�op2rrr
�__init__<�z_llinstruction.__init__cCrrrrrrr
�__str__@r"z_llinstruction.__str__cCst|�Sr)�strrrrr
�__repr__Dsz_llinstruction.__repr__cCrrr�r�otherrrr
�__eq__Gr"z_llinstruction.__eq__cC�dS)z5Encode this instruction to the binary linelog format.Nrrrrr
�encodeK�z_llinstruction.encodecCr))agExecute this instruction.

        Args:
          rev: The revision we're annotating.
          pc: The current offset in the linelog program.
          emit: A function that accepts a single lineinfo object.

        Returns:
          The new value of pc. Returns None if exeuction should stop
          (that is, we've found the end of the file.)
        Nr�rr�pc�emitrrr
�executeOr+z_llinstruction.executeN)
rr	r
�abc�ABCMeta�
__metaclass__�abstractmethodr!r#r%r(r*r/rrrr
r8s



rc@�8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_jgez@If the current rev is greater than or equal to op1, jump to op2.cC�||_||_dSr��_cmprev�_targetrrrr
r!a�
z
_jge.__init__cC�d|j|jfS)Nz	JGE %d %dr7rrrr
r#e�z_jge.__str__cC�(t|�t|�ko|j|jko|j|jkSr��typer8r9r&rrr
r(h�

�
�z_jge.__eq__cCst�|jd>|j�S�N���_llentry�packr8r9rrrr
r*osz_jge.encodecCs||jkr|jS|dS�Nrr7r,rrr
r/r�
z_jge.executeN�	rr	r
rr!r#r(r*r/rrrr
r5^�r5c@r4)
�_jumpz=Unconditional jumps are expressed as a JGE with op1 set to 0.cCs|dkr
td|��||_dS)Nrs%malformed JUMP, op1 must be 0, got %d)rr9rrrr
r!{s
z_jump.__init__cCs
d|jS)NzJUMP %d�r9rrrr
r#�rz
_jump.__str__cCst|�t|�ko
|j|jkSr)r?r9r&rrr
r(�sz_jump.__eq__cCst�d|j�S�Nr)rDrEr9rrrr
r*��z_jump.encodecC�|jSrrKr,rrr
r/�sz
_jump.executeNrHrrrr
rJxsrJc@r4)
rz1EOF is expressed as a JGE that always jumps to 0.cCs,|dkr
td|��|dkrtd|��dS)Nrs$malformed EOF, op1 must be 0, got %ds$malformed EOF, op2 must be 0, got %d)rrrrr
r!�s
�z
_eof.__init__cCr))N�EOFrrrrr
r#��z_eof.__str__cCst|�t|�kSr)r?r&rrr
r(�r<z_eof.__eq__cCst�dd�SrL)rDrErrrr
r*�sz_eof.encodecCrrrr,rrr
r/�rPz_eof.executeNrHrrrr
r�src@r4)
�_jlz1If the current rev is less than op1, jump to op2.cCr6rr7rrrr
r!�r:z_jl.__init__cCr;)NzJL %d %dr7rrrr
r#�r<z_jl.__str__cCr=rr>r&rrr
r(�r@z
_jl.__eq__cCst�d|jd>B|j�S)NrrBrCrrrr
r*��z
_jl.encodecCs||jkr|jS|dSrFr7r,rrr
r/�rGz_jl.executeNrHrrrr
rQ�rIrQc@r4)
�_linezEmit a line.cCr6r��_rev�_origlinenorrrr
r!�s
z_line.__init__cCr;)Nz
LINE %d %drTrrrr
r#�r<z
_line.__str__cCr=r)r?rUrVr&rrr
r(�r@z_line.__eq__cCst�d|jd>B|j�SrA)rDrErUrVrrrr
r*�rRz_line.encodecCs|t|j|j|��|dSrF)rrUrVr,rrr
r/�sz
_line.executeNrHrrrr
rS�srSc
Cs�z
t�||�\}}Wntjy}ztd|��d}~ww|d@}|d?}|dkrA|dkr<|dkr7t||�St||�St||�S|dkrJt||�S|dkrSt	||�St
d|��)z?Decode a single linelog instruction from an offset in a buffer.s!reading an instruction failed: %rN�rBrrsUnimplemented opcode %r)rD�unpack_from�struct�errorrrrJr5rQrS�NotImplementedError)�data�offsetrr �e�opcoderrr
�
_decodeone�s&��




r`c@s�eZdZdZd dd�Zdd�Zdd	�Zd
d�Zedd
��Z	dd�Z
dd�Zdd�Zd!dd�Z
dd�Zedd��Zedd��Zdd�Zd"dd�ZdS)#�linelogz1Efficient cache for per-line history information.NrcCs2|durtdd�tdd�g}||_d|_||_dSrL)r�_program�
_lastannotate�_maxrev)r�program�maxrevrrr
r!�s

zlinelog.__init__cCr=r)r?rbrdr&rrr
r(�r@zlinelog.__eq__cCsdtt|��|jt|j�fS)Nz"<linelog at %s: maxrev=%d size=%d>)�hex�idrd�lenrbrrrr
r%s

�zlinelog.__repr__csDdttt|j����t�d���fdd�t|jdd�d�D��S)Nz	%%%dd %%s�
c3s �|]\}}�||fVqdSrr)�.0�idx�i��fmtrr
�	<genexpr>
s�
�z#linelog.debugstr.<locals>.<genexpr>r)rir$rbr�sysstr�join�	enumeraterrrnr
�debugstrs�zlinelog.debugstrcCs�t|�tjdkrtdt|�tjf��t|�tj}t|d�}t|t�r(d}nt|ttf�r3|j	}n	tdt
|�j��t|tttf�sFJ�|j}||krUtd||f��t
dd�g}t�d|�D]
}|�t||tj��qa|||d�S)Nrs9invalid linelog buffer size %d (must be a multiple of %d)z,Expected one of _jump, _jge, or _jl. Got %s.sFcorrupt linelog data: claimed %d entries but given data for %d entriesr)rf)rirD�sizerr`�
isinstancerJr5rQr8r?rr9rr�xrange�append)�cls�buf�expected�fakejgerf�
numentries�instructionsr]rrr
�fromdatas:��

����zlinelog.fromdatacCs8t|jt|j����}|d�dd�|jdd�D��S)N�css�|]}|��VqdSr)r*)rkrmrrr
rp/s�z!linelog.encode.<locals>.<genexpr>r)r5rdrirbr*rr)r�hdrrrr
r*-s"zlinelog.encodecCsg|_d|_d|_dSrL)rbrdrcrrrr
�clear1s
z
linelog.clearcCs|j|||dt|�|d�S)Nr)�_internal_blines)�replacelinesri)rr�a1�a2�blinesrrr
�replacelines_vec6s�zlinelog.replacelines_veccCsf|jr|j}n|�|�}|t|j�krtd|t|j�|f��|t|j�kr3tdd�}tdd|j�}	n|j|}	|j|	j}|jj	}
|
�}|jj
}g}
|
j
}||kr�|||d}|t||��t�
||�D]-}|dur~|t|||
���|t||��qg||\}}|t|||
���|t||��qg||kr�|t|j�kr�td|t|j�|f��|t|j�kr�|j}n|j|j}|dkr�||jkr�|j|djd}|t||��|
�}||�t|ttf�s�|td|	jd��td|�|j|	j<t|jj�|k�r	||jj|_nt|t��sJ�||j_|
|jj||�<t|jj|�|j_||jk�r1||_dSdS)z+Replace lines [a1, a2) with lines [b1, b2).s-%d contains %d lines, tried to access line %drrN)rc�annotaterirrrrrbr�__len__rxrQrrwrSrdr5rvrJ�maxr)rrr�r��b1�b2r��ar�a1inst�a1info�
programlen�
oldproglen�
appendinst�
blineinfos�bappend�tgtr�newrev�
newlinenum�endaddr�a1instpcrrr
r�;sp
��

��
�zlinelog.replacelinescCs�d}g}d}|dur/|t|j�kr/|j|}|}|�|||j�}|d7}|dur/|t|j�ks|dur;td|����t|||�}||_|S)Nrrz4Probably hit an infinite loop in linelog. Program:\n)rirbr/rxrrtrrc)rrr-r�executed�inst�lastpcr�rrr
r��s$
���zlinelog.annotatecCrNr)rdrrrr
rf�szlinelog.maxrevcCsdd�|jjD�S)z?Return the last annotation result. C linelog code exposed this.cSsg|]}|j|jf�qSr)rr)rk�lrrr
�
<listcomp>�sz*linelog.annotateresult.<locals>.<listcomp>)rcrrrrr
r�szlinelog.annotateresultcCs|jj|jSr)rcrr)r�linerrr
�	getoffset�rMzlinelog.getoffsetcCs�|pd}g}t�t|j��D]D}|j|}|d}t|t�r"|j}n&t|t�r+|St|tt	f�r3nt|t
�rB|�|j|j
f�ntd|��||krP|S|}qtd��)z�Get all lines that ever occurred in [start, end).

        Passing start == end == 0 means "all lines ever".

        This works in terms of *internal* program offsets, not line numbers.
        rsIllegal instruction %rsFailed to perform getalllines)rrwrirbrvrJr9rrQr5rSrxrUrVr)r�start�endr-r�stepr��nextpcrrr
�getalllines�s$



zlinelog.getalllinesrLr)rr)rr	r
rr!r(r%rt�classmethodrr*r�r�r�r��propertyrfrr�r�rrrr
ra�s&



X

ra)r�
__future__rrr0rY�
thirdpartyr�r�StructrD�	Exceptionr�s�objectrrrr5rJrrQrSr`rarrrr
�<module>s(
		&

https://t.me/RX1948 - 2025