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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/revlogutils/__pycache__/rewrite.cpython-39.opt-1.pyc
a

�+�b@s�@sXddlZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZddlmZddlmZmZmZmZmZddlm Z dd	lmZm!Z!d0dd�Z"d1d
d�Z#d2dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(dd�Z)dd�Z*dd�Z+dd �Z,d3d!d"�Z-d4d#d$�Z.d%d&�Z/d'd(�Z0d)d*�Z1d+d,�Z2d5d.d/�Z3dS)6�N�)�nullrev�)�COMP_MODE_PLAIN�ENTRY_DATA_COMPRESSED_LENGTH�ENTRY_DATA_COMPRESSION_MODE�ENTRY_DATA_OFFSET�ENTRY_DATA_UNCOMPRESSED_LENGTH�ENTRY_DELTA_BASE�ENTRY_LINK_REV�
ENTRY_NODE_ID�ENTRY_PARENT_1�ENTRY_PARENT_2� ENTRY_SIDEDATA_COMPRESSED_LENGTH�ENTRY_SIDEDATA_COMPRESSION_MODE�ENTRY_SIDEDATA_OFFSET�REVIDX_ISCENSORED�REVLOGV0�REVLOGV1)�_)�error�mdiff�pycompat�revlogutils�util)�storageutil)�	constants�deltas�cCs�ddlm}|�|�}t�d|id�}|j|j|j|jddd�}|j|_|j	|_	|j
|_
|j|_|��D]�}|�
|�}|�|�\}	}
||kr�|�|||�|�|	|
|tj�|�|�tkrhtd�}td	�}tj||d
��qh|�|��r|�|�tk�rtd�}t�|��|�|�}
n
|�|�}
|�|
||�|�|	|
||�|��qh|j|jdd
�|j�sh|j|jdd
�|j� |j|j�|j�s�|j� |j|j�|�!�|�"�dS)z*censors a revision in a "version 1" revlogr)�revlog�censoredrstmpcensoredT)�target�radixZpostfixZ
censorables0censored revision stored as delta; cannot censorsEcensoring of revlogs is not fully implemented; please report this bug)�hints:cannot censor due to censored revision having delta storedsstore)�locationN)#�r�revr�packmeta�openerr!r"�_format_versionZ
_format_flagsZ
_generaldeltaZ_parse_index�revs�node�parentsZaddrawrevisionZlinkrevrr�deltaparentrrr�Abort�
iscensored�_chunk�rawdata�flagsZ	addbackup�
_indexfile�_inlineZ	_datafile�rename�clearcaches�
_loadindex)�rl�tr�
censornode�	tombstonerZ	censorrevZnewrlr&r+�p1�p2�m�hZrawtext�r@�C/usr/lib64/python3.9/site-packages/mercurial/revlogutils/rewrite.py�	v1_censor6sj
�
�
��

�rBcCs|�|�h}t||||�dS)z*censors a revision in a "version 2" revlogN)r&�_rewrite_v2)rr9r:r;�censor_revsr@r@rA�	v2_censor�srEc
Cs |j}|j}t�d|id�}t|�}|j|}|jj|}|td?}	|�|�}
tj	dd���}t
||||�}t|||	|
�}
|
��^}|\}}}}}t|t
|��D]0}||vr�t|||||�q�t||||||�q�Wd�n1s�0YWd�n1�s0Y|jddd�dS)	a[rewrite a revlog to censor some of its content

    General principle

    We create new revlog files (index/data/sidedata) to copy the content of
    the existing data without the censored data.

    We need to recompute new delta for any revision that used the censored
    revision as delta base. As the cumulative size of the new delta may be
    large, we store them in a temporary file until they are stored in their
    final destination.

    All data before the censored data can be blindly copied. The rest needs
    to be copied as we go and the associated index entry needs adjustement.
    r r�sw+b��modeNT)ZtransactionZ	stripping)�index�_docketrr'�minZ
entry_sizerZsidedata_cut_offrZunnamedtempfile�_precompute_rewritten_delta�_setup_new_files�range�len�_rewrite_censor�_rewrite_simple�write)rr9rDr;�	old_index�docket�first_excl_revZfirst_excl_entry�index_cutoff�data_cutoff�sidedata_cutoff�tmp_storage�rewritten_entries�	all_filesZ
open_files�
old_data_file�old_sidedata_file�new_index_file�
new_data_file�new_sidedata_filer&r@r@rArC�s^

��	���DrCcCsBt�|�}i}t|�}|j����
}t|t|��D]�}||vr@q2||}	|	t|vrVq2|	tdkrtt	ddt
f||<q2|j||d�}
tj
|	t|�|	t�|�|	t�|
gt|
�d|	td@d�}|j||||d�}|jj}
t�|
|�\}}|��}|�|jd�|��}|j|||f||<q2Wd�n1�s40Y|S)u�Compute new delta for revisions whose delta is based on revision that
    will not survive as is.

    Return a mapping: {rev → (new_base, data_start, data_end, compression_mode)}
    r)Z_dfN�)r+r<r=Zbtext�textlenZ
cachedeltar2)Zexcluded_basesZ
target_revr)r�
deltacomputerrKZ_segmentfileZ
_open_readrNrOr
r	rrr1r�revisioninforr+r
rrZ
finddeltainforJZdefault_compression_headerZdelta_compression�tellrR�data�base)rrSZ
excluded_revsrYZdcrZrUZdfhr&�entry�text�info�dZdefault_compZ	comp_mode�start�endr@r@rArL�s@

�	�4rLc	s|j}|j�|���}|j�|����|j�|����|j�|����|j�|����|j�|����t	j
|��d�t	j
���d�t	j
���d�|j�|���|j�|���|j�|����|_�|_
�|_|��|j|d�tj��������fdd��}|S)a+

    return a context manager to open all the relevant files:
    - old_data_file,
    - old_sidedata_file,
    - new_index_file,
    - new_data_file,
    - new_sidedata_file,

    The old_index_file is not here because it is accessed through the
    `old_index` object if the caller function.
    )Znb_bytes)rTc3st�d���}t�d���}t�d���}t�d��t}t�d��J}|�dtj�|�dtj�|�dtj�|||||fVWd�n1s�0YWd�n1s�0YWd�n1s�0YWd�n1s�0YWd�n1�s0YdS)N�rbzr+br)�open�seek�os�SEEK_END)r\r]r^r_r`�rWrVZnew_data_filepathZnew_index_filepathZnew_sidedata_filepathZold_data_filepathZold_sidedata_filepathrXr@rA�all_files_openerBs"��z*_setup_new_files.<locals>.all_files_opener)rJr(�joinZindex_filepathZ
data_filepathZsidedata_filepathr^r_r`r�copyfileZ
register_file�	index_end�data_end�sidedata_endr6r7�
contextlib�contextmanager)rrVrWrXrTZold_index_filepathrtr@rsrArMs2�rMcCsn|\}}}}	}
||}|td@}|td?}
||vrd|�|
�|t}|�|�}|t}|t}n,||\}}}}||}|�|�|�|�}|	��}|	�|�|t}|
��}d|kr�|t	}|�|�|�|�}|
�|�|t
}|t}tj
||||||t|t|t|t||||d�
}|j�|�|j�|�}|�|�|��|j_|	��|j_|
��|j_dS)z@append a normal revision to the index after the rewritten one(s)rarFr�
r2Zdata_offsetZdata_compressed_length�data_uncompressed_length�data_delta_base�link_revZparent_rev_1Zparent_rev_2Znode_idZsidedata_offsetZsidedata_compressed_lengthZdata_compression_modeZsidedata_compression_modeN)rrpr�readr
rrerRrrr	rrrhrr
rrrI�append�entry_binaryrJrwrxry)rrSr[r&rZrYr\r]r^r_r`rhr2Zold_data_offset�
new_data_sizeZnew_datar~Zd_comp_moderlrm�new_data_offsetZ
sidedata_sizeZnew_sidedata_offsetZold_sidedata_offsetZnew_sidedatar}Zsd_com_mode�	new_entry�	entry_binr@r@rArQ^sr�


�





�
rQcCs�|\}}}}}	||}
t|�}|��}|�|�|
t}
|
t}|
t}tjtj	|||||
|||
t
ddttd�
}|j�
|�|j�|�}|�|�|��|j_|��|j_dS)z&rewrite and append a censored revisionrr|N)rOrerRrr
rrrhrrrrrIr�r�rJrwrx)rrSr[r&r;r\r]r^r_r`rhr�r�rr<r=r�r�r@r@rArP�sD�
�
rPcCsF|�dd�d�dd�}t|�dkr>td�}||;}t�|��|dS)N�.rr�/rs,cannot recognize filelog from filename: '%s')�rsplit�splitrOrrr.)�pathZ	path_part�msgr@r@rA� _get_filename_from_filelog_index�s
r�cCsddlm}|�|j|�}|S)zAReturns the filelog for the given `path`. Stolen from `engine.py`r)�filelog)r%r�Zsvfs)�repor�r��flr@r@rA�_filelog_from_filename�sr�cCs�ddlm}|�|j�dur*d}t�|��|jj}|j|}t	|�}	|d|d|	d<|	d<|j
|	dd��}
|�|�|�|
�dS)zASwaps p1 and p2 and overwrites the revlog entry for `rev` in `fp`r��parsersNz*repo needs to be locked to rewrite parents���)
�purer�Z_currentlockZ_lockrefr�ProgrammingError�IndexObject�index_formatrI�list�packrprR)r�r8r&�offset�fpr�r�r�rhr�Zpackedr@r@rA�_write_swapped_parents�s


r�c
Cs�ddlm}|j}|j}|jtjkr8d|j}t�|��|j	}|d}t
d�}	|����4�ztj
|j�|�|j�|�|jd�|j|dd���}
|jr�|�|
���}|��D]8}||vr�|�|�}
t||||
|
�|�|	||f�q�n>|jj}|D]0}||j}
t||||
|
�|�|	||f�q�Wd	�n1�s<0Y|j�||�|��|��Wt�|�nt�|�0Wd	�n1�s�0Yd	S)
z�
    Swaps p1 and p2 for all `to_fix` revisions of filelog `fl` and writes the
    new version to disk, overwriting the old one with a rename.
    rr�z+expected version 1 revlog, got version '%d's.tmp-parents-fixs%repaired revision %d of 'filelog %s'
)Z
checkambigsr+rGN)r�r��ui�_revlogr)rrrr�r3rZuninterruptiblerrvr(ruZ_checkambigr4ZInlinedIndexObjectr�r*Z_calculate_indexr�rRr�r��sizer5r6r7Z	tryunlink)r�r��to_fixr�r�r8r�Z
index_fileZ
new_file_pathZrepaired_msgr�rIr&r�r�r@r@rA�_reorder_filelog_parentssB



�

4
r�cs*��fdd�}��fdd�}t||�|�S)Ncs�j���S�N)r�r1r@��filerevr�r@rA�<lambda>8rz'_is_revision_affected.<locals>.<lambda>cs�j���Sr�)r��
parentrevsr@r�r@rAr�9r)�_is_revision_affected_inner)r�r��metadata_cache�	full_text�parent_revsr@r�rA�_is_revision_affected7s
�r�cCslz
|�}Wntjy YdS0t|dd��dk}|durF|||<|rh|�\}}|tkrh|tkrhdSdS)a�Mercurial currently (5.9rc0) uses `p1 == nullrev and p2 != nullrev` as a
    special meaning compared to the reverse in the context of filelog-based
    copytracing. issue6528 exists because new code assumed that parent ordering
    didn't matter, so this detects if the revision contains metadata (since
    it's only used for filelog-based copytracing) and its parents are in the
    "wrong" order.FNrs
T)rZCensoredNodeError�bytesr)r�Zparents_revsr�r�Zraw_textZhas_metar<r=r@r@rAr�?s

r�c	s`|j���fdd�}��fdd�}��fdd�}��fdd�}��fdd�}t|||||�|�S)Ncs
����Sr�)r/r@�r�r8r@rAr�^rz,_is_revision_affected_fast.<locals>.<lambda>cs
����Sr�)r-r@r�r@rAr�_rcs
����Sr�)r0r@r�r@rAr�`rcs
����Sr�)r1r@r�r@rAr�arcs
����Sr�)r�r@r�r@rAr�br)r�� _is_revision_affected_fast_inner)	r�r�r�r��is_censored�
delta_base�deltar�r�r@r�rA�_is_revision_affected_fast\s�r�cCs�|�rd||<dS|�\}}|tks,|tkr0dS|�}	|�|	�}
|
durVt||||�S|�}t|�sh|
Sd}t|�|kr�t�td���t�d|d|��\}
}}|
dkr�t||||�}|S|
||<|
S)aGOptimization fast-path for `_is_revision_affected`.

    `metadata_cache` is a dict of `{rev: has_metadata}` which allows any
    revision to check if its base has metadata, saving computation of the full
    text, instead looking at the current delta.

    This optimization only works if the revisions are looked at in order.FN�spatch cannot be decodeds>lllr)	r�getr�rOrr.r�struct�unpack)r�r�r�r�r�r�r�r<r=Zdelta_parentZparent_has_metadata�chunkZ
header_lengthrlZ_endZ_length�is_affectedr@r@rAr�ns@

��r�c

s`|�td�|�|���0t|dd���}|���d�D]�}|sDq:|�dd�\}}t||��t�fdd�|�d	�D��}	t�}
|	D]Z}t�|�r�d
}|�|||f�q�td�}|t	�
��|��|f;}|�|�|
�|�q�|	|
}	|	�std�}|�||�q:|s:t
|�t|	��q:Wd
�n1�s20YWd
�n1�sR0Yd
S)a
    Fix the revisions given in the `from_report` file, but still checks if the
    revisions are indeed affected to prevent an unfortunate cyclic situation
    where we'd swap well-ordered parents again.

    See the doc for `debug_fix_issue6528` for the format documentation.
    sloading report file '%s'
rnrG�
� rc3s|]}��t�|��VqdSr�)r&�binasciiZ	unhexlify)�.0�n�r�r@rA�	<genexpr>�sz_from_report.<locals>.<genexpr>�,�,found affected revision %d for filelog '%s'
s)revision %s of file '%s' is not affected
s*no affected revisions were found for '%s'
N)rRrror�r�r��setr��warnr��hexlifyr+�addr��sorted)
r�r��context�from_report�dry_run�f�lineZ	filenodes�filenamer�Zexcludedr�r�r@r�rA�_from_report�s4
�

r�c	#sHi}t��
��t|t�
��D�]$\}}|\���}}��}�
j�|�sZt�|�
jt	d����
�
|���
j���s�t���
jt	d����
�
����
j���s�t���
jt	d����
�
���	�fdd�}��
fdd���fdd����	fdd�}	��������
fdd�}
t|��fd	d�|
|	||�}|�r<���||��|f}|Vqd
S)z7filter incomind deltas to repaire issue 6528 on the flysunknown parentcst�t@�Sr�)�boolrr@)r2r@rAr��rz(filter_delta_issue6528.<locals>.<lambda>cs
����Sr�)r&r@)r�rr@rAr��rcs�Sr�r@r@)�base_revr@rAr��rcs��fSr�r@r@)�p1_rev�p2_revr@rAr��rc	sVt�������}t����dg|��f��}�jr@�jd}n
�jd}��||�S)Nrr)rZpatchedsizer�rrdr4Z_writinghandlesZ	buildtext)rbZrevinfoZfh)r�r�rcr2r+�p1_node�p2_noderr@rAr��s�
z)filter_delta_issue6528.<locals>.full_textcs�Sr�r@r@)r�r@rAr�rN)rrc�	enumeraterOrIZhas_noder�LookupErrorr"rr&r�)rZdeltas_iterr�r&rkZlinknodeZ	deltabaseZsidedatar�r�r�r�r@)r�r�r�rcr2r+r�r�r�r�rrA�filter_delta_issue6528�sb

��



�	�
r�Fc
sDddlm�tj���fdd��}|r6t|�||��Sg}|����t�fdd��j��D��}|jtd�td�t	|�d	�}	d
}
|D�]\}}|�
d�r�|�j@s�q�|	��t
|�}
t�|
�}t�}i}|��D]�}t�|||�}|�r&t||�}||k�r&td�}t�|�|��}t�||
|f��|r�d
}|�|||f�d}
�sЈ�rf|�t�|�|���q�|�|�q�|r�t|�}��r�|�|
|f�q�t�||�q�|
�r�|�td����r|�rt�dd��8}|D]"\}}|�dd�|�|f��q�Wd�n1�s0Y|	� �Wd�n1�s60YdS)Nr��storec	3sj�s�rdVnV����>����dVWd�n1s>0YWd�n1s\0YdSr�)Zwlock�lockr@)r�r��	to_reportr@rAr�-sz!repair_issue6528.<locals>.contextc3s0|](\}}}|�d�r|�j@r||fVqdS)�.iN)�endswith�FILEFLAGS_FILELOG)r��	file_typer�Z_sr�r@rAr�;s�z#repair_issue6528.<locals>.<genexpr>slooking for affected revisionssfilelogs)Zunit�totalTr�s)paranoid check failed for '%s' at node %sr�Fs!no affected revisions were found
�wbrGs%s %s
r�)!r%r�rzr{r�r�Z	datafilesZmakeprogressrrOr�r�Z	incrementr�r�r�r*r�r�r�r�r+rr.r�r�r�r�r�rRroruZcomplete)r�r�r�r�r�Zparanoidr�Zreport_entries�filesZprogressZ
found_nothingr�r�r�r�r�r�r�ZaffectedZslowr�r+r�r@)r�r�r�r�rA�repair_issue6528(sr
����
�

<r�)r)r)r)N)N)FNNF)4r�rzrqr�r+rrrrrrr	r
rrr
rrrrrrrZi18nrr%rrrrrZutilsrrrBrErCrLrMrQrPr�r�r�r�r�r�r�r�r�r�r�r@r@r@rA�<module>
s:H
N
	
R5JP3	0
�
@(S�

Youez - 2016 - github.com/yon3zu
LinuXploit