HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/revlogutils/__pycache__/docket.cpython-310.pyc
o

�]Lb�9�@s�ddlmZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlmZddd	�Z
ej�d
�Zer<ddd	�Z
e�ejd�Ze�d
�ZGdd�de�Zdd�Zdd�Zddd�ZdS)�)�absolute_importN�)�encoding�error�node�pycompat�util�)�	constants�cCst�t�|d��S)z_return a new unique identifier.

    The identifier is random and composed of ascii characters.r)r�hex�os�urandom)�id_size�r�>/usr/lib/python3/dist-packages/mercurial/revlogutils/docket.py�make_uid&srsHGTEST_UUIDFILEc
Cs\zttdd��}|����}Wd�n1swYWnty9}z|jtjkr-�d}WYd}~nd}~wwtjrBt	|�}ndd�|D�}d}t
dd�}|D]}|d	?}||@d
>}	||	|}qRt��}
tjrt|
j
|dd�n|
�
|�|
�|d
�}|dks�J�t�d|�}t�|�}
ttd��}|�|
�Wd�|
S1s�wY|
S)N�rb)�modes04css�|]}t|�VqdS�N)�ord)�.0�crrr�	<genexpr>@s�zmake_uid.<locals>.<genexpr>r�#11111111111111111111111111111111111r�#�r	)�version�rz>L�wb)�open�stable_docket_file�read�strip�IOError�errno�ENOENTr�ispy3�iter�int�random�Random�seed�getrandbits�struct�packrr�write)r�fr,�inst�	iter_seed�int_seed�low_mask�i�	high_part�low_part�r�raw�p�newrrrr4sD����




��s
BBBBBBLLLLLLcz>BLc@s�eZdZdZ															d(dd�Zdd	�Zd
d�Zd)d
d�Zdd�Zdd�Z	d)dd�Z
dd�Zdd�Zd)dd�Z
edd��Zejdd��Zedd��Zejd d��Zed!d"��Zejd#d"��Zd*d$d%�Zd+d&d'�ZdS),�RevlogDocketzmetadata associated with revlogFNrrcCs||_t|�|_d|_|j|_|j|_|j|_	||_
||_||_||_
||_|	|_t|�t|�@r3J�t|�t|	�@r=J�t|�t|	�@rGJ�|
|ksMJ�||
ksSJ�||ksYJ�|
|_||_||_|
|_||_||_|rz|j|_|j|_|j|_n|j|_|j|_|j|_||_dS)NF)�_version_header�bool�
_read_only�_dirty�radix�_radix�_docket_file�_path�opener�_opener�_index_uuid�_older_index_uuids�
_data_uuid�_older_data_uuids�_sidedata_uuid�_older_sidedata_uuids�set�_initial_index_end�_pending_index_end�_initial_data_end�_pending_data_end�_initial_sidedata_end�_pending_sidedata_end�
_index_end�	_data_end�
_sidedata_end�default_compression_header)�self�revlog�use_pending�version_header�
index_uuid�older_index_uuids�	data_uuid�older_data_uuids�
sidedata_uuid�older_sidedata_uuids�	index_end�pending_index_end�data_end�pending_data_end�sidedata_end�pending_sidedata_endrXrrr�__init__ss@


zRevlogDocket.__init__cC�"|jdur	t�|_d|j|jfS)z=file path to the current index file associated to this docketN�	%s-%s.idx)rHrrC�rYrrr�index_filepath��
zRevlogDocket.index_filepathcC�*|j|jf}|j�d|�t�|_|��S)z\switch index file to a new UID

        The previous index UID is moved to the "older" list.r)rHrUrI�insertrrm�rY�oldrrr�new_index_file��zRevlogDocket.new_index_fileTcc�2�|jD]\}}|s|dkrd|j|fVqdS)z>yield file path to older index files associated to this docketrrkN)rIrC�rY�
include_empty�uuid�sizerrr�old_index_filepaths�����z RevlogDocket.old_index_filepathscCrj)z<file path to the current data file associated to this docketN�	%s-%s.dat)rJrrCrlrrr�
data_filepath�rnzRevlogDocket.data_filepathcCro)zZswitch data file to a new UID

        The previous data UID is moved to the "older" list.r)rJrVrKrprr}rqrrr�
new_data_file�rtzRevlogDocket.new_data_fileccru)z=yield file path to older data files associated to this docketrr|N)rKrCrvrrr�old_data_filepaths�r{zRevlogDocket.old_data_filepathscCrj)z@file path to the current sidedata file associated to this docketN�	%s-%s.sda)rLrrCrlrrr�sidedata_filepath�rnzRevlogDocket.sidedata_filepathcCro)zbswitch sidedata file to a new UID

        The previous sidedata UID is moved to the "older" list.r)rLrWrMrprr�rqrrr�new_sidedata_file�rtzRevlogDocket.new_sidedata_fileccru)zAyield file path to older sidedata files associated to this docketrr�N)rMrCrvrrr�old_sidedata_filepaths�r{z#RevlogDocket.old_sidedata_filepathscC�|jSr)rUrlrrrrc��zRevlogDocket.index_endcC�||jkr
||_d|_dSdS�NT)rUrA�rY�new_sizerrrrc��

�cCr�r)rVrlrrrre�r�zRevlogDocket.data_endcCr�r�)rVrAr�rrrre�r�cCr�r)rWrlrrrrgr�zRevlogDocket.sidedata_endcCr�r�)rWrAr�rrrrgr�cCs�|jsdS|jrd}||j;}t�|��|s|j|jdd�|j|jddd��}|�|j|d��Wd	�n1s;wY||_dS)
z_write the modification of disk if any

        This make the new content visible to all processFswriting read-only docket: %ssstore)�location�wT)r�
atomictemp)�pendingN)	rAr@rEr�ProgrammingError�	addbackuprGr0�
_serialize)rY�transactionr��	stripping�msgr1rrrr0s

�zRevlogDocket.writec	Cs�|r|j}|j}|j}n	|j}|j}|j}||jksJ�||jks#J�|jt|j�t|j	�t|j
�t|j�t|j�t|j
�||j||j||j|jf}g}|�tj|��|�|j�|j	D]\}}|�t�t|�|��q]|j	D]	\}}|�|�qp|�|j
�|jD]\}}|�t�t|�|��q�|jD]	\}}|�|�q�|�|j�|j
D]\}}|�t�t|�|��q�|j
D]	\}}|�|�q�d�|�S)N�)rOrQrSrUrVrWr>�lenrHrIrJrKrLrMrX�append�S_HEADERr/�	S_OLD_UID�join)	rYr��official_index_end�official_data_end�official_sidedata_end�data�s�uryrrrr�!sT�
zRevlogDocket._serialize)FNNrNrNrrrrrrrN)T)FF�F)�__name__�
__module__�__qualname__�__doc__rirmrsrzr}r~rr�r�r��propertyrc�setterrergr0r�rrrrr=psR
�6
	
	
	






r=cCsD|d@}|tjtjfvrdStj|j��}t|||d�}d|_|S)z?given a revlog version a new docket object for the given revlogi��N)r\rXT)	r
�REVLOGV2�CHANGELOGV2r�compengines�_compengine�revlogheaderr=rA)rZr\�
rl_version�comp�docketrrr�default_docketUs�r�c	CsZg}g}td|�D]}|tj�}|�t�|��q	|D]\}}||�}|�||f�q|S)Nr)�ranger�ryr��unpack)	�get_data�count�	all_sizes�all_uidsr6r:�uid_size�	file_size�uidrrr�_parse_old_uidsds
r�Fcst��dtj��}tjg���fdd�}t|�}t|�}t|�}||�}t|�}	t||	�}
t|�}||�}t|�}
t||
�}t|�}||�}t|�}t||�}t|�}t|�}t|�}t|�}t|�}t|�}t|�}t|f||||
|||||||||||d��}|S)zBgiven some docket data return a docket object for the given revlogNcsf�d|t��krd}|�d|t��f;}t�|����d�d|�}�d|7<|S)z/utility closure to access the `size` next bytesrs'docket is too short, expected %d got %d)r�r�Abort)ryr�r:�r��offsetrrr�xs
zparse_docket.<locals>.get_data)r[r\r]r^r_r`rarbrcrdrerfrgrhrX)r�r�ryr(�nextr�r=)rZr�r[�headerr��iheaderr\�index_uuid_sizer]�older_index_uuid_countr^�data_uuid_sizer_�older_data_uuid_countr`�sidedata_uuid_sizera�older_sidedata_uuid_countrb�
index_size�pending_index_size�	data_size�pending_data_size�
sidedata_size�pending_sidedata_sizerXr�rr�r�parse_docketqsX


��r�)rr�)�
__future__rr%r
r*r.�rrrrrr
r�environ�getr!�Struct�INDEX_HEADER_FMTr�r��objectr=r�r�r�rrrr�<module>s$


6
f