ROOTPLOIT
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: ws67150586 (67150586)
PHP: 8.3.36
Disabled: NONE
Upload Files
File: //kunden/kunden/kunden/lib/python3/dist-packages/mercurial/__pycache__/revlog.cpython-313.pyc
�

6�hY��X�SrSSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSK	JrJ
r
JrJr SSKJrJrJrJrJrJr SSKJr SSKJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1 SS	K2J3r3J4r4J5r5J6r6J7r7J8r8J9r9 SS
K:J;r; \	Rx(a
SSK;r;SSK=J>r> SSK?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrJ SS
KKJLrL SSKFJMrNJOrPJQrQJRrSJTrTJUrUJVrVJWrX SSKYJZrZJ[r[ \) \* \, \ \$ \# \. \/ \0 \+ \- \8 \4 \7 \5 \3 \6 \9 \DR�"S5r]\DR�"SSS9r_\DR�"SSS9r`\DR�"SSS9ra\R�rcSrdSreSrfSrg\e\f\g4rhSri\aSL=(d	 \j"\]S5rk\;R�"SS9"SS\LR�55rn\;R�"SS9"S S!\LR�55rpS"rqS#rrS$rs\j"\]S%5(aS&rtOSrtS'ru\"S(5rvS)rw"S*S+5rx\;R�"5"S,S-\x55ry\;R�"5"S.S/\x55rz\;R�"5"S0S1\x55r{"S2S35r|\	Rx(a\>r}O\~r}"S4S5\}5r"S6S75r�"S8S5r�g)9z�Storage back-end for Mercurial.

This provides efficient delta storage with O(1) retrieve and append
and O(changes) merge between branches.
�)�annotationsN)�Iterable�Iterator�Optional�Tuple�)�bin�hex�nullrev�sha1nodeconstants�short�wdirrev)�_)�	ALL_KINDS�CHANGELOGV2�COMP_MODE_DEFAULT�COMP_MODE_INLINE�COMP_MODE_PLAIN�DELTA_BASE_REUSE_NO�DELTA_BASE_REUSE_TRY�
ENTRY_RANK�FEATURES_BY_VERSION�FLAG_GENERALDELTA�FLAG_INLINE_DATA�INDEX_HEADER�KIND_CHANGELOG�KIND_FILELOG�RANK_UNKNOWN�REVLOGV0�REVLOGV1�REVLOGV1_FLAGS�REVLOGV2�REVLOGV2_FLAGS�REVLOG_DEFAULT_FLAGS�REVLOG_DEFAULT_FORMAT�REVLOG_DEFAULT_VERSION�SUPPORTED_FLAGS)�REVIDX_DEFAULT_FLAGS�REVIDX_ELLIPSIS�REVIDX_EXTSTORED�REVIDX_FLAGS_ORDER�REVIDX_HASCOPIESINFO�REVIDX_ISCENSORED�REVIDX_RAWTEXT_CHANGING_FLAGS)�attr)�BaseIndexObject)
�ancestor�dagop�error�mdiff�policy�pycompat�revlogutils�templatefilters�util�vfs)�
repository)�deltas�docket�flagutil�nodemap�randomaccessfile�revlogv0�rewrite�sidedata)�storageutil�
stringutil�parsersr1T)�pyo3r2�revlogic�
�US4$�NF���rl�texts  �2/usr/lib/python3/dist-packages/mercurial/revlog.py�ellipsisreadprocessorrP������;��c�
�US4$rJrKrLs  rO�ellipsiswriteprocessorrT�rQrRc��grJrKrLs  rO�ellipsisrawprocessorrV�s��rRc�^�U(aUSRU5 gURU5 g)zyVerify the integrity of the given revlog ``node`` while providing a hook
point for extensions to influence the operation.�skipreadN)�add�revision)rM�	skipflags�state�nodes    rO�_verify_revisionr^�s(���
�k����t�$�	���D�rRr0)�slotsc��\rSrSr\R
"\S9r\R
"\S9r\R
"\S9r	\R
"\S9r
\R
"\S9r\R
"\
\S9r\R
"\
\S9r\R
"\
\S9r\R
"\
\S9r\R
"\S9r\R
"S\
\S9rSrg)�revlogrevisiondelta�)�typeN��defaultrcrK)�__name__�
__module__�__qualname__�__firstlineno__r/�ib�bytesr]�p1node�p2node�basenode�int�flagsr�baserevisionsizerZ�deltarC�protocol_flags�linknode�__static_attributes__rKrRrOrara�s����7�7���D�
�W�W�%�
 �F�
�W�W�%�
 �F��w�w�E�"�H��G�G���E��w�w�H�S�M�2���w�w�H�U�O�,�H��G�G��%��)�E��w�w�H�U�O�,�H��W�W�#�&�N��w�w�t�(�5�/�:�HrRra)�frozenc��\rSrSr\R
"S\\S9r\R
"S\\S9r	\R
"S\\S9r
Srg)�
revlogproblem��NrdrK)rfrgrhrir/rjrrk�warningr3r]rurKrRrOrxrx�s>���g�g�d��%��9�G��G�G�D�x���7�E��7�7�4�h�u�o�6�DrRrxc�8�[RXU5up4X44$�N)rF�parse_index2��data�inline�uses_generaldelta�index�caches     rO�parse_index_v1r��s���'�'��6G�H�L�E��<�rRc�>�[RXU[S9up4X44$�N)�format)rFr}r"r~s     rO�parse_index_v2r��s+���'�'��'��(��L�E��<�rRc�>�[RXU[S9up4X44$r�)rFr}rr~s     rO�parse_index_cl_v2r��s+���'�'��'��(��L�E��<�rR�parse_index_devel_nodemapc�8�[RXU5up4X44$r|)rFr�r~s     rO�parse_index_v1_nodemapr��s$���8�8��+�
����|�rRi���sNcannot read from revlog %s;  expected %d bytes from offset %d, data size is %ds0123456789abcdefABCDEFc��\rSrSrSrSrg)�_Configic�:�UR"S0URD6$)NrK)�	__class__�__dict__��selfs rO�copy�_Config.copys���~�~�.��
�
�.�.rRrKN)rfrgrhrir�rurKrRrOr�r�s��/rRr�c�,^�\rSrSrSr\R"SS9r\R"\R"\	5S9r
\R"SS9r\R"SS9r\R"SS9r
\R"SS9r\R"SS9rU4SjrSrU=r$)�
FeatureConfigiz=Hold configuration values about the available revlog featuresszlib�reFc�b>�[TU]5nURR5UlU$r|)�superr��compression_engine_options)r��newr�s  �rOr��FeatureConfig.copys*����g�l�n��)-�)H�)H�)M�)M�)O��&��
rRrK)rfrgrhri�__doc__r/rj�compression_engine�Factory�dictr��
censorable�
has_side_data�compute_rank�canonical_parent_order�enable_ellipsisr�ru�
__classcell__)r�s@rOr�r�s����G�����1��!%������d�1C�!D������'�J��G�G�E�*�M��7�7�5�)�L�"�W�W�U�3���g�g�e�,�O��rRr�c��\rSrSrSr\R"SS9r\R"SS9r\R"SS9r	\R"SS9r
\R"SS9r\R"SS9r\R"SS9r
\R"SS9r\R"SS9r\R"SS9r\R"SS9r\R"SS9rS	rg)
�
DataConfigi%z;Hold configuration value about how the revlog data are readFr�N�g�?irK)rfrgrhrir�r/rj�try_pending�	try_split�check_ambig�mmap_large_index�mmap_index_threshold�chunk_cache_size�uncompressed_cache_factor�uncompressed_cache_count�with_sparse_read�sr_density_threshold�sr_min_gap_size�generaldeltarurKrRrOr�r�%s���E��'�'�%�(�K�����&�I��'�'�%�(�K��w�w�u�-���7�7�4�0���w�w�u�-��!%���� 5�� $�w�w�t�4���w�w�u�-���7�7�4�0���g�g�f�-�O��7�7�5�)�LrRr�c�X�\rSrSrSr\R"SS9r\R"SS9r\R"SS9r	\R"SS9r
\R"SS9r\R"SS9r\R"SS9r
\R"SS9r\R"SS9r\R"SS9rS	rg)
�DeltaConfigiIz�Hold configuration value about how new delta are computed

Some attributes are duplicated from DataConfig to help havign each object
self contained.
Fr�N���TrrK)rfrgrhrir�r/rj�
general_delta�
sparse_revlog�
max_chain_len�max_deltachain_span�upper_bound_comp�delta_both_parents�candidate_group_chunk_size�debug_delta�
lazy_delta�lazy_delta_baserurKrRrOr�r�Is�����G�G�E�*�M��G�G�E�*�M��G�G�D�)�M��'�'�"�-���w�w�t�,������.��!%����!3���'�'�%�(�K�����&�J��g�g�e�,�OrRr�c��\rSrSr%SrS\S'S(SjrSrSr\	S5r
\	S	5rS
rSr
SrS
rSrS)Sjr\R&S5r\R&S5rS*SjrS+SjrS,Sjr\R4S5r\	S5r\	S5r\R4S-Sj5rS)SjrSr S)Sjr!Sr"Sr#S)Sjr$S.S jr%S!r&S"r'S#r(S$r)S%r*S&r+S'r,g)/�_InnerRevlogihz�An inner layer of the revlog object

That layer exist to be able to delegate some operation to Rust, its
boundaries are arbitrary and based on what we can delegate to Rust.
�
vfsmod.vfs�openerc��XlX lX0lX@lXPlX`lXplX�lX�lSUl	X�l
SUl[R"URUR
(aUROURURRU
5Ul[R"URURURR5Ul0UlSUlSUlURR&b.[(R*"URR,SS9UlSUlg)Nr�)�maxcost)r�r��
index_file�	data_file�
sidedata_filer��data_config�delta_config�feature_config�_orig_index_file�_default_compression_header�_writinghandlesr@r��_segmentfile�_segmentfile_sidedata�_decompressors�_revisioncache�_uncompressed_chunk_cacher�r9�lrucachedictr��
_delay_buffer)r�r�r�r�r�r�r�r�r�r��chunk_cache�default_compression_headers            rO�__init__�_InnerRevlog.__init__qs����&+�
�$��"��*����&��(��,��!%���+E�(�
 $���,�=�=��K�K� $���T�_�_�������-�-��	
���&6�%F�%F��K�K�������-�-�&
��"�!���"���*.��&����5�5�A�-1�->�->�� � �9�9��.�D�*�
"��rRc�,�[UR5$r|��lenr�r�s rO�__len__�_InnerRevlog.__len__�����4�:�:��rRc���UR(aeSUlURbURR5 URR5 URR5 gr|)�is_delayingr�r��clearr��clear_cacher�r�s rOr��_InnerRevlog.clear_cache�s[���#�#�#�#�"����)�)�5��*�*�0�0�2����%�%�'��"�"�.�.�0rRc�L�URbUR$UR$r|)r�r�r�s rO�canonical_index_file�!_InnerRevlog.canonical_index_file�s$��� � �,��(�(�(����rRc�H�URSL=(d URSL$)z�is the revlog is currently delaying the visibility of written data?

The delaying mechanism can be either in-memory or written on disk in a
side-file.N)r�r�r�s rOr��_InnerRevlog.is_delaying�s*���"�"�$�.�
��!�!��-�	
rRc�>�[URUSS-	5$)z.the offset of the data chunk for this revisionr��ror��r��revs  rO�start�_InnerRevlog.start�s���4�:�:�c�?�1�%��+�,�,rRc�&�URUS$)z.the length of the data chunk for this revisionr�r�r�s  rO�length�_InnerRevlog.length�s���z�z�#��q�!�!rRc�H�URU5URU5-$)z+the end of the data chunk for this revision�r�r�r�s  rO�end�_InnerRevlog.end�s���z�z�#�����S�!1�1�1rRc��URUSnX!:Xa[$URR(aU$US-
$�z(return deltaparent of the given revision�r�r�rr�r��r�r��bases   rO�deltaparent�_InnerRevlog.deltaparent��;���z�z�#��q�!���;��N�
�
�
�
,�
,��K���7�NrRc��URR(dURU5[:H$[	UR
S5(a,UR
RUlUR
U5$U[:XagUR
UnUSnX1:XagU[:XagUSnURU5S:Xa0URU5nXT:XaOUnURU5S:XaM0USnURU5S:Xa0URU5nXV:XaOUnURU5S:XaM0X4:XdX6:XagUR
U5$)�tells whether rev is a snapshot�
issnapshotTr�r�F)r�r�rr�hasattrr�r	r�)r�r��entryr�p1�b�p2s       rOr	�_InnerRevlog.issnapshot�s9��� � �.�.��#�#�C�(�G�3�3�
�T�Z�Z��
.�
.�"�j�j�3�3�D�O��?�?�3�'�'��'�>���
�
�3����Q�x���;���7�?��
�1�X���k�k�"�o��"�� � ��$�A��w���B�	�k�k�"�o��"�
�1�X���k�k�"�o��"�� � ��$�A��w���B�	�k�k�"�o��"�
�:�������t�$�$rRNc��URRX5$![a Of=f/nURnURRnUnXFnXgS:wa;Xb:wa6URU5 U(aUSnOUS-nXFnXgS:waXb:waM6Xb:XaSnOURU5 SnUR
5 X84$)a'Obtain the delta chain for a revision.

``stoprev`` specifies a revision to stop at. If not specified, we
stop at the base of the chain.

Returns a 2-tuple of (chain, stopped) where ``chain`` is a list of
revs in ascending order and ``stopped`` is a bool indicating whether
``stoprev`` was hit.
rrTF)r��
deltachain�AttributeErrorr�r��append�reverse)	r�r��stoprev�chainr�r��iterrev�e�stoppeds	         rO�_deltachain�_InnerRevlog._deltachains���	��:�:�(�(���
���	��	�����
�
���(�(�6�6�����N���1��o�'�"4��L�L��!���A�$���1�����A�
�1��o�'�"4����G��L�L��!��G�
�
�
���~�s��
*�*c��[RURRnUR	URR
5$r|)r9�compenginesr�r��revlogcompressorr�)r��engines  rO�_compressor�_InnerRevlog._compressor1s@���!�!�$�"5�"5�"H�"H�I���&�&����:�:�
�	
rRc�p�URcgURnURU5nUR$)zthe default decompressorN)r��_get_decompressor�
decompress)r��t�cs   rO�
_decompressor�_InnerRevlog._decompressor8s8���+�+�3���,�,���"�"�1�%���|�|�rRc�v�URUnU$![a� [RR	U5nURURR5nX RU'U$![a7 [R"[S5[R"U5-5ef=ff=f)Nsunknown compression type %s)
r��KeyErrorr9r�forrevlogheaderr r�r�r3�RevlogErrorr�binascii�hexlify)r�r'�
compressorr!s    rOr%�_InnerRevlog._get_decompressorAs���	��,�,�Q�/�J�����
	�	
��)�)�9�9�!�<��#�4�4��'�'�B�B��
�*4�#�#�A�&�
���	�
��'�'��4�5��8H�8H��8K�K���
��
	�s��
B8�AA3�3AB4�4B8c��U(dSU4$URRU5nU(aSU4$USSS:XaSU4$SU4$)z6Generate a possibly-compressed representation of data.rRrr��u)r"�compress)r�r�
compresseds   rOr6�_InnerRevlog.compressQsT�����9���%�%�.�.�t�4�
���
�?�"���!�9�����9���T�z�rRc�t�U(dU$USSnUS:Xa[U5$US:XaU$US:Xa[R"US5$URU5nURU5$![Ra;n[R"[	S5[
R"U5-5eSnAff=f)z�Decompress a revlog chunk.

The chunk is expected to begin with a header identifying the
format type so it can be routed to an appropriate decompressor.
rr�xsrevlog decompress error: %sNr4r5)�_zlibdecompress�zlibr3r.rrE�forcebytestrr9�bufferr%r&)r�rr'rr1s     rOr&�_InnerRevlog.decompress`s�����K�.
��1�I����9�
�&�t�,�,��%�Z��K�
�$�Y��;�;�t�Q�'�'��+�+�A�.�
��$�$�T�*�*���:�:�
��'�'��4�5� �-�-�a�0�1����
�s�
A(�(B7�<6B2�2B7c#�# �[UR5S:XaSv� gURb)UR(aSn[R
"U5eURR5 URR5 Sv� SSS5 SSS5 g!,(df   N=f!,(df   g=f7f)zCContext manager that keeps data and sidedata files open for readingrN�.revlog with delayed write should not be inline)	r�r�r�r�r3�ProgrammingErrorr��readingr��r��msgs  rOrC�_InnerRevlog.reading�s�����t�z�z�?�a���
�
�
�
+����B�C��(�(��-�-��"�"�*�*�,��/�/�7�7�9��:�-�,�9�9��-�,�s6�A/C�1B3�B"�B3�	C�"
B0	�,B3�3
C�=Cc��URSL$)z!True is a writing context is openN)r�r�s rO�
is_writing�_InnerRevlog.is_writing�s���#�#�4�/�/rRc�h�URR=(d URR$)zSTrue if any file handle is being held

Used for assert and debug in the python code)r��is_openr�r�s rOrK�_InnerRevlog.is_open�s'��
� � �(�(�N�D�,F�,F�,N�,N�NrRc#�N# �UR(aSv� gS=n=pV[UR5nSnU(aURUS-
5nSnUR(d|URURSS9nUc!URS[R5 O!URU[R5 URURU5 URbaUceUceURURSS9nURU[R5 URURU5 XpRR-n	UR5nUR(aURUR X�-5 OURUR U	5 XEU4UlUR(aUOUUR$lX`R(lSv� SUlSUR$lSUR(lUbUR+5 UbUR+5 UbUR+5 gg![a URURSS9nGN�f=f![a URURSS9nGN�f=f!SUlSUR$lSUR(lUbUR+5 UbUR+5 UbUR+5 ff=f7f)z_Open the revlog files for writing

Add content to a revlog should be done within such context.
Nrr�r+��mode�w+)rHr�r�r�r�r�r��seek�os�SEEK_END�SEEK_SET�FileNotFoundErrorrYr��
entry_size�_InnerRevlog__index_write_fpr�r�r��writing_handler��close)
r��transaction�data_end�sidedata_end�ifh�dfh�sdfh�r�dsize�isizes
          rO�writing�_InnerRevlog.writing�s�����?�?��#�#�C�#�#�3
 ���
�
�O����� �H�H�Q��U�O�E����{�{�F�"�k�k�$�.�.�u�k�E��#�+��H�H�Q����4��H�H�X�r�{�{�;� �O�O�D�N�N�E�:��%�%�1�'�3�3�3��?�*�?�K�#�{�{�4�+=�+=�E�{�J������r�{�{�;� �O�O�D�$6�$6��E��J�J�1�1�1���+�+�-���;�;��O�O�D�O�O�U�]�C��O�O�D�O�O�U�;�(+�$�'7��$�:>�+�+�3�3��!�!�0�<@�*�*�9��'+��$�37��!�!�0�<@��*�*�9��?��I�I�K��#��J�J�L��?��I�I�K�#��I-�F�"�k�k�$�.�.�u�k�E��F��-�K�#�{�{�4�+=�+=�E�{�J��K��"(,��$�37��!�!�0�<@��*�*�9��?��I�I�K��#��J�J�L��?��I�I�K�#�st�L%�AJ=�%=I'�"J=�# I'�4J=�8:J�2CJ=�A$L%�'$J�J=�J�J=�$J:�6J=�9J:�:J=�=A%L"�"L%c��URc0URURSURRS9nO7[
R"URURSUR5nUc"URS[R5 U$URU[R5 U$![ax URc1URURSURRS9s$[
R"URURSUR5s$f=f)zpinternal method to open the index file for writing

You should not use this directly and use `_writing` instead
rN�rP�
checkambigrrQ)r�r�r�r�r�r@�appenderrRrSrTrUrV)r��	index_end�fs   rO�__index_write_fp�_InnerRevlog.__index_write_fp�s��
	��!�!�)��K�K��O�O��#�/�/�;�;� ���%�-�-��K�K����%��9K�9K���� ����q�"�+�+�&��H����y�"�+�+�.��H�� �
	��!�!�)��{�{��O�O��#�/�/�;�;�#���(�0�0��K�K����%��9K�9K���
	�s�BB=�!B=�=AD?�7D?�>D?c�`�URURSURRS9$)z|internal method to create a new index file for writing

You should not use this unless you are upgrading from inline revlog
�wrg)r�r�r�r�r�s rO�__index_new_fp�_InnerRevlog.__index_new_fps3��
�{�{��O�O���'�'�3�3��
�	
rRc���URbeSnURbISnURSnUR5 UR5 SUlSURlUR
URSS9nURS5 UR5 [[UR55H&nURURXw5S5 M( UR5 SSS5 UbX0lUR!5nSUl[[UR55HTnURR%U5n	US:XaURR'U5n
X�-n	URU	5 MV SSS5 [(R("URURUR*R,5UlU(a+UR/5nX�S4UlX`RlSnUbUR5 UR$!,(df   GND=f!,(df   N�=f!UbUR5 ff=f)z@split the data of an inline revlog into an index and a data fileNFTrrQrOr)r�r��flushrZr�rYr�r��truncaterC�ranger�r��write�get_segment_for_revsr��_InnerRevlog__index_new_fpr��entry_binary�pack_headerr@r�r�rX)r��tr�header�new_index_file_path�existing_handles�fp�new_dfhra�ir�
packed_headerr^s            rO�split_inline�_InnerRevlog.split_inlines���!�!�)�)�)� �����+�#���%�%�a�(�B��H�H�J��H�H�J�$(�D� �/3�D���,�
�+�+�d�n�n�5�+�9�������%	 ������s�4�:�:��/�A��M�M�$�";�";�A�"A�!�"D�E�0��
�
�� �
#�.�"5���$�$�&�"�#����s�4�:�:��/�A��
�
�/�/��2�A��A�v�(,�
�
�(>�(>�v�(F�
�)�-���H�H�Q�K�0�'�!1� A� A�������� � �1�1�!�D�� ��+�+�-��(+�d�';��$�3:�!�!�0���
�"��
�
������K ���'�&��8�"��
�
��#�s?�I�$AH:�=!I�A>I�A?I�:
I	�I�
I�I�I3c�n�URnX1n[USS-	5nX:XaXTS-nOX2n[USS-	5US-nUR(a<XQS-URR--
nXbS-URR--
nXe-
nXPRRXX54$)a�Obtain a segment of raw data corresponding to a range of revisions.

Accepts the start and end revisions and an optional already-open
file handle to be used for reading. If the file handle is read, its
seek position will not be preserved.

Requests for data may be satisfied by a cache.

Returns a 2-tuple of (offset, data) for the requested range of
revisions. Offset is the integer offset from the beginning of the
revlog and data is a str or buffer of the raw byte data.

Callers will need to call ``self.start(rev)`` and ``self.length(rev)``
to determine where each revision's data begins and ends.

API: we should consider making this a private part of the InnerRevlog
at some point.
rr�r)r�ror�rWr��
read_chunk)	r��startrev�endrevr��istartr�r��iendr�s	         rOrw�!_InnerRevlog.get_segment_for_revsUs���*�
�
������F�1�I��O�$������)�#�C��=�D��d�1�g��m�$�t�A�w�.�C��;�;���l�d�j�j�&;�&;�;�;�E��Q�J�$�*�*�"7�"7�7�7�C�����'�'�2�2�5�A�A�ArRc���URb URRU5nUbU$URUSnURX5SnU[:XaUnOTU[
:XaUR
U5nO8U[:XaURU5nOSnXS-n[R"U5eURb#URRX[U5S9 U$)aObtain a single decompressed chunk for a revision.

Accepts an integer revision and an optional already-open file handle
to be used for reading. If used, the seek position of the file will not
be preserved.

Returns a str holding uncompressed data for the requested revision.
�
r�unknown compression mode %d)�cost)
r��getr�rwrrr)rr&r3r.�insertr�)r�r��uncomp�compression_moderrEs      rO�_chunk�_InnerRevlog._chunkzs����)�)�5��3�3�7�7��<�F��!��
��:�:�c�?�2�.���(�(��2�1�5����.��F�
�!2�
2��'�'��-�F�
�!1�
1��_�_�T�*�F�0�C��#�C��#�#�C�(�(��)�)�5��*�*�1�1�#�C��K�1�P��
rRc	��U(d/$URnURnURnURRn[
Rn/nURn	/n
U
RnURcUnO:UH4nURRU5n
U
c
U	"U5 M+U"X�45 M6 U(dSnO5URR(dU4nO[R"UUUS9nUGH-nUSnUSSS2HnU"U5S:wdM O URUW5unnUR"nUR$nUH�nU"U5nU(aUUS-U--
nU"U5nURUSnU"WUW-
U5nU[&:XaUnOCU[(:Xa	U"U5nO0U[*:Xa	U"U5nOSnUU-n[,R."U5eU"UU45 URcM�URR1UU[3U55 M� GM0 U
R55 U
Vs/sHnUSPM
 sn$![a% UHnU"X�R!U545 M GNJf=fs snf)	a'Obtain decompressed chunks for the specified revisions.

Accepts an iterable of numeric revisions that are assumed to be in
ascending order.

This function is similar to calling ``self._chunk()`` multiple times,
but is faster.

Returns a list with decompressed data for each requested revision.
NrK��
targetsizerr�rr�r�)r�r�r�r�rWr9r>rr�r�r�r��	deltautil�
slicechunkrw�
OverflowErrorr�r&r)rrrr3r.r�r��sort)r��revsr�r�r�r��iosizer>�fetched_revs�fadd�chunks�laddr��cached_value�slicedchunks�	revschunk�firstrev�lastrev�offsetr�decomp�
def_decomp�
chunkstart�chunklength�	comp_moder(rE�xs                            rO�_chunks�_InnerRevlog._chunks�s{����I��
�
�������������&�&���������"�"�����}�}���)�)�1��L���#�=�=�A�A�#�F���'���I��#�,�-����L��!�!�2�2�(�?�L�$�/�/���%��L�&�I� ��|�H�$�T�r�T�?���'�?�a�'��+�
2�#�8�8��7�K�����_�_�F��+�+�J� ��"�3�Z�
���3��7�f�"4�4�J�$�S�k�� �J�J�s�O�B�/�	��4��f�!4�k�B����/��A��"2�2��q�	�A��"3�3�"�1�
�A�8�C��9�$�C��+�+�C�0�0��c�1�X���1�1�=��2�2�9�9�#�q�#�a�&�I�'!�%&�N	���
�$�%�f���!��f�%�%��?!�
2�%�C��#�{�{�3�/�0�1�%�
2��>&s�"I�J�+J�Jc��SnSnUR(aURSnURX#S9upVU(aURSnSUlSnURUSnSU::aSU-nURbCURR
n	X�-n
X�RR:�aX�RlURXWS9nUc[US5nUSSn[R"XK5nAU$)zHreturn the possibly unvalidated rawtext for a revision

returns rawtext
Nr�r�r�r�)r�rr�r�r�r�r�r�rkr4�patches)
r�r]r��	cachedrev�basetextrrr��rawsize�factor�candidate_size�bins�rawtexts
             rO�raw_text�_InnerRevlog.raw_text�s���	�������+�+�A�.�I��)�)�#�)�A�����*�*�1�-�H�#����
��*�*�S�/�!�$����<��W��J��)�)�5��%�%�?�?�F�$�-�N�� >� >� F� F�F�9G�.�.�6��|�|�E�|�9�����T�!�W�~�H����8�D��-�-��/����rRc�d�URUnUSnUSnUR(aX@RRSU---
nUS:Xa0$X$U-:a3URnUnUnUn	[XiX�4-n
[
R"U
5eURRXE5nURUSnU[:XaUn
OTU[:XaURU5n
O8U[:XaURU5n
OSnX�-n[
R"U5e[R"U
5nU$)�0Return the sidedata for a given revision number.��	rr�r�)r�r�rWr��FILE_TOO_SHORT_MSGr3r.r�r�rrr)rr&�sidedatautil�deserialize_sidedata)r�r�r]�index_entry�sidedata_offset�
sidedata_size�filenamer�r�r��m�comp_segment�comp�segmentrErCs                rOrC�_InnerRevlog.sidedatas1���j�j��o��%�a�.��#�A��
��;�;��z�z�4�4��C��@�@�O��A���I��M�9�9��)�)�H��C�$�F�"�F�"�h��%D�D�A��#�#�A�&�&��1�1�<�<��
���z�z�#��r�"���?�"�"�G�
�&�
&��(�(��6�G�
�%�
%��o�o�l�3�G�0�C��K�C��#�#�C�(�(��4�4�W�=���rRc���URcSn[R"U5eURup�nUc!URS[R
5 O URU[R5 U
(aDU	c!U
RS[R
5 O U
RU	[R5 U(a URU
[R5 [UR5S-
nUR(d�URURU5 UR(aURURU5 URURU[U5-5 US(aU
RUS5 U
RUS5 U(aURU5 URcURU5 O�URR!U5 O�URbSn[R"U5eX_URR"--
nURURU5 U(aeURU5 URUS5 URUS5 UR%5U
(aU
R%5OSU(aUR%54$S4$)N�1adding revision outside `revlog._writing` contextrrs&invalid delayed write on inline revlog)r�r3rBrRrSrTrUr�r�r�rYr�r�r�rvr�rrW�tell)r�r[r
r�linkr�rCr�rjr\r]rEr^r_r`�currs                rO�write_entry�_InnerRevlog.write_entryDs#��2���'�F�C��(�(��-�-��-�-���$����H�H�Q����$��H�H�Y����,��������B�K�K�(�����2�;�;�/���I�I�l�B�K�K�0��4�:�:���"���{�{��O�O�D�N�N�F�3��!�!����� 2� 2�O�D��O�O�D�5�5�t�c�%�j�7H�I��A�w��	�	�$�q�'�"��I�I�d�1�g����
�
�8�$��!�!�)��	�	�%� ��"�"�)�)�%�0�
�
�
�
+�;�C��(�(��-�-��T�Z�Z�2�2�2�2�F��O�O�D�5�5�v�>���<��I�I�e���I�I�d�1�g���I�I�d�1�g���H�H�J��C�H�H�J�4��D�I�I�K�
�	
�&*�
�	
rRc�n�URnURS5(aURSSnUS-$)Ns.s���s.a)r��endswith)r�r�s  rO�
_divert_index�_InnerRevlog._divert_index�s9���_�_�
�
���u�%�%�����"�-�J��E�!�!rRc�0�UR(aeUR(aSn[R"U5eURc
UR
bg[
UR5S:Xa�URUlUR5UlUR
ceURceURRUR5(a%URRUR5 UR$/Ulg)NrAr)
rKr�r3rBr�r�r�r�r�r�r��exists�unlinkrDs  rO�delay�_InnerRevlog.delay�s����<�<����;�;�B�C��(�(��-�-����)�T�-B�-B�-N��
����_��
!�$(�O�O�D�!�"�0�0�2�D�O��(�(�4�4�4��?�?�.�.�.��{�{�!�!�$�/�/�2�2����"�"�4�?�?�3��?�?�"�!#�D��rRc�@�UR(aeUR(aSn[R"U5eURbgSnUR5nURRU5(aURRU5 [R"URRUR5URRU55 UR(agUR
US5nURS[R 5 UR#SRUR55 SSS5 SnSUl
URUlX0lURU4$!,(df   N<=f)NrA�NTFrNrrRT)rKr�r3rBr�r�r�r�r�r9�copyfile�joinr�r�rRrSrTrv)r�rE�any_pending�pending_index_filer^s     rO�
write_pending�_InnerRevlog.write_pending�s3���<�<����;�;�B�C��(�(��-�-�� � �,����!�/�/�1���;�;���0�1�1��K�K���1�2��
�
��K�K���T�_�_�-��K�K���/�0�	
�������/��7�3�����B�K�K�(��	�	�#�(�(�4�#5�#5�6�7�8��K�!��� $�����,������+�+�8�7�s
�AF�
Fc�j�UR(aeUR(aSn[R"U5eURSLnUR
SLnU(aU(aS5eU(a�UR(aoUR
URS5nURS[R5 URSRUR55 SSS5 SUlUR$U(a}URRUR5(a/URRURUR
SS9 UR
UlSUlUR$Sn[R"U5e!,(df   N�=f)	NrA�unreachablerNrrRT�rhs(not delay or divert found on this revlog)rKr�r3rBr�r�r�r�rRrSrTrvr�r��renamer�)r�rEr��divertr^s     rO�finalize_pending�_InnerRevlog.finalize_pending�sS���<�<����;�;�B�C��(�(��-�-��"�"�$�.���&�&�d�2���V�'�-�'�5�
��!�!��[�[����%�8�C��H�H�Q����,��I�I�c�h�h�t�'9�'9�:�;�9�"&�D���(�(�(���{�{�!�!�$�/�/�2�2����"�"��O�O��)�)�#�#��
#�3�3�D�O�$(�D�!��(�(�(�>�C��(�(��-�-�9�8�s
�"AF$�$
F2)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r	r�r��r�r�r|)r'rk�rrk�returnzTuple[bytes, bytes])rrk�NN)r�rk)-rfrgrhrir��__annotations__r�r�r��propertyr�r�r�r�r�rr	rr9�
propertycacher"r)r%r6r&�
contextlib�contextmanagerrCrHrKrdrXrxr�rwr�r�r�rCr�r�r�r�r�rurKrRrOr�r�hs_���
��@"��@"�D�1�����
�
��
�-�"�2��%�@)�V
���
��
�
������� 
�0+�d���
��
��0��0��O��O����< ��< �|#�J	
�9�v#B�J�<V&�p,�\$�LF
�P"��(,�2)rRr�c�<�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)�RustIndexProxyi�a�Wrapper around the Rust index to fake having direct access to the index.

Rust enforces xor mutability (one mutable reference XOR 1..n non-mutable),
so we can't expose the index from Rust directly, since the `InnerRevlog`
already has ownership of the index. This object redirects all calls to the
index through the Rust-backed `InnerRevlog` glue which defines all
necessary forwarding methods.
c��Xlgr|��inner�r�r�s  rOr��RustIndexProxy.__init__�s���
rRc�4�[URSU35$)N�_index_��getattrr��r��names  rO�__getattr__�RustIndexProxy.__getattr__�s���t�z�z�W�T�F�#3�4�4rRc�6�URR5$r|)r��_index___len__r�s rOr��RustIndexProxy.__len__�s���z�z�(�(�*�*rRc�8�URRU5$r|)r��_index___getitem__�r��keys  rO�__getitem__�RustIndexProxy.__getitem__����z�z�,�,�S�1�1rRc�8�URRU5$r|)r��_index___contains__r
s  rO�__contains__�RustIndexProxy.__contains__s���z�z�-�-�c�2�2rRc�8�URRU5$r|)r��_index___delitem__r
s  rO�__delitem__�RustIndexProxy.__delitem__rrRr�N)rfrgrhrir�r�rr�rrrrurKrRrOr�r��s%����
5�+�2�3�2rRr�c�>�\rSrSrSrSrSS	SjjrSrSrg)
�RustVFSWrapperi
zoUsed to wrap a Python VFS to pass it to Rust to lower the overhead of
calling back multiple times into Python.
c��Xlgr|r�r�s  rOr��RustVFSWrapper.__init__s���
rRc��URRXX4S9n[R"UR	55U(a
UR
4$S4$)N)�pathrP�
atomictemprh)r��__call__rS�dup�fileno�	_tempname)r�rrPr rh�fds      rOr!�RustVFSWrapper.__call__sL���Z�Z�
 �
 ��Z�!�
��
���r�y�y�{�#�Z�R�\�\�J�J�T�J�JrRc�.�[URU5$r|rrs  rOr�RustVFSWrapper.__getattr__ s���t�z�z�4�(�(rRr�N)srbFF)rrkrPrk)	rfrgrhrir�r�r!rrurKrRrOrr
s6�������K��K��K�)rRrc�l�\rSrSr%Sr\RrS\S'S\S'\	S5r
S\S	'SzS{SjjrS
rS|Sjr
S}SjrS|SjrSrSrSr\R(S5r\R(S5rS~SjrSrSrSrSrSSjrS�SjrSrSrSr S}S�S jjr!S!r"S"r#S#r$S$r%S%r&S&r'S'r(S(r)S)r*S*r+S+r,S,r-\-r.S-r/S.r0S/r1S0r2S1r3S|S2jr4S�S3jr5S4r6S�S5jr7S|S6jr8S�S7jr9S�S8jr:S�S9jr;S�S:jr<S;r=S<r>S=r?S�S>jr@S?rAS@rBSArCSBrDSCrESDrFS}SEjrGSFrHSGrISHrJSIrKS�SJjrLSKrMSLrNSMrOSNrPSOrQSPrRSQrSSRrTS}SSjrUSTrVSUrWSVrXS�SWjrY\ZSX5r[SYr\SZr]\^R�S[5r`\^R�S\5ra\ZS]5rbS^rcS
S
\dS
S
4S_jreS�S`jrfS�SajrgSbrhS�ScjriSdrjSerkS�SfjrlSgrmShrnSiroSjrpSkrqSlrrS
SS\sR�S
S
4SmjruSnrvSorwSprxSqry1SrkrzS
\wS
S
4Ssjr{Str|S�Sujr}S�Svjr~S�SwjrSxr�Syr�g
)�rHi$a�
the underlying revision storage object

A revlog consists of two parts, an index and the revision data.

The index is a file with a fixed record size containing
information on each revision, including its nodeid (hash), the
nodeids of its parents, the position and offset of its data within
the data file, and the revision it's based on. Finally, each entry
contains a linkrev entry that can serve as a pointer to external
data.

The revision data itself is a linear collection of data chunks.
Each chunk represents a revision and is usually represented as a
delta against the previous chunk. To bound lookup time, runs of
deltas are limited to about 2 times the length of the original
version data. This makes retrieval of a version proportional to
its size, or O(1) relative to the number of revisions.

Both pieces of the revlog are written to in an append-only
fashion, which means we never need to rewrite a file to insert or
remove data, and can use some simple techniques to avoid the need
for locking while reading.

If checkambig, indexfile is opened with checkambig=True at
writing, to avoid file stat ambiguity.

If mmaplargeindex is True, and an mmapindexthreshold is set, the
index will be mmapped rather than read if it is larger than the
configured threshold.

If censorable is True, the revlog can have censored revisions.

If `upperboundcomp` is not None, this is the expected maximal gain from
compression for the data content.

`concurrencychecker` is an optional function that receives 3 arguments: a
file handle, a filename, and an expected position. It should check whether
the current position in the file handle is valid, and log/warn/fail (by
raising).

See mercurial/revlogutils/contants.py for details about the content of an
index entry.
r��_innerr�r�c��[U5S:Xag[R"U5SnUS-nUS-n[UnUS"U5$)zCDetermine if a revlog is inline from the initial bytes of the indexrT�����inline)r�r�unpackr)�header_bytesr|�
_format_flags�_format_version�featuress     rO�is_inline_index�revlog.is_inline_indexWsV���|���!���$�$�\�2�1�5����(�
� �6�/��&��7���	�"�=�1�1rRzOptional[bytes]�_docket_fileNFc�z�X0lSUlSUlSUlSUlSUlX@lX�lX�lUUl	SUl
XlU	(a[R"U5UlUS[;de[U5S:XdeX lUbUR#5UlOVSURR&;a-URR&SR#5UlO[)5UlXpR$lX�R$lUbUR#5UlOVSURR&;a-URR&SR#5UlO[15UlXPR.lX`R.lUbUR#5UlOVSURR&;a-URR&SR#5UlO[95UlX�R6l[<R>"S5Ul SUl!SUl"SUl#0Ul$[K[LRN5Ul(SUl)URU5unnURWUU5 X�l,g)	a�
create a revlog object

opener is a function that abstracts the file opening operation
and can be used to implement COW semantics or the like.

`target`: a (KIND, ID) tuple that identify the content stored in
this revlog. It help the rest of the code to understand what the revlog
is about without having to resort to heuristic and index filename
analysis. Note: that this must be reliably be set by normal code, but
that test, debug, or performance measurement code might not set this to
accurate value.
NFrr�sfeature-configsdata-configsdelta-config�d)-�radixr6�
_indexfile�	_datafile�
_sidedatafile�
_nodemap_file�postfix�_trypending�
_try_split�_may_inline�	uses_rustr��nodemaputil�get_nodemap_filerr��targetr�r��optionsr�r�r�r�r�r�r�r�r�r�r9r��_chainbasecacher��_docket�_nodemap_docket�_pcacher�r>�flagprocessors�_flagprocessors�
_adding_group�
_loadindex�_load_inner�_concurrencychecker)r�r�rEr9r>rh�mmaplargeindexr��upperboundcomp�persistentnodemap�concurrencychecker�
trypendingr�r�r�r�r��
may_inliner�r�s                    rOr��revlog.__init__gs?��D�
� ���������!���!�����%��#��%���������!,�!=�!=�d�!C�D���a�y�I�%�%�%��6�{�a�������%�"0�"5�"5�"7�D��
�$�+�+�"5�"5�
5�"&�+�+�"5�"5�6G�"H�"M�"M�"O�D��"/�/�D��)3���&�5K���2��"�*�/�/�1�D��
�t�{�{�2�2�
2�#�{�{�2�2�>�B�G�G�I�D��)�|�D��'1���$�,:���)��#� ,� 1� 1� 3�D��
���� 3� 3�
3� $��� 3� 3�O� D� I� I� K�D�� +�
�D��-;���*� $�0�0��5���04��
����#������ $�H�$;�$;�<���!���!�_�_�.���{������,�#5� rRc���URRnSU;a=UR[:Xa)[nURSS5nX0RlOjSU;a[nO]SU;a0[nUR(a	U[-nSU;a	U[-nO'SURR;a[nO[nSnURR (aURR"nURR$(a[&UR([*'URS	05R-5H&upV[.R0"XVUR(5 M( URR2nUS
::a"[4R6"[9S5U-5eXwS-
-(a"[4R6"[9S
5U-5eURSS5nX$U4$)a�process options (from above/config) to setup associated default revlog mode

These values might be affected when actually reading on disk information.

The relevant values are returned for use in _loadindex().

* newversionflags:
    version header to use if we need to create a new revlog

* mmapindexthreshold:
    minimal index size for start to use mmap

* force_nodemap:
    force the usage of a "development" version of the nodemap code
schangelogv2schangelogv2.compute-rankTsrevlogv2srevlogv1�generaldeltasrevlogv0Nsflagprocessorsrs0revlog chunk cache size %r is not greater than 0rs.revlog chunk cache size %r is not a power of 2sdevel-force-nodemapF)r�rF�revlog_kindrrr�r�r�r"r rArrrr&r�r�r�r��ellipsisprocessorrLr)�itemsr>�insertflagprocessorr�r3r.r)	r��opts�
new_headerr��mmapindexthreshold�flag�	processorr��
force_nodemaps	         rO�
_init_opts�revlog._init_opts�s��� �{�{�"�"���T�!�d�&6�&6�.�&H�$�J��8�8�$?��F�L�/;���,�
�D�
 �!�J�
�D�
 �!�J�����.�.�
��$�&��/�/�
��
�D�K�K�/�/�
/�!�J�/�J�!�����,�,�!%�!1�!1�!F�!F�����.�.�4E�D� � ��1� $�x�x�(9�2�>�D�D�F�O�D��(�(��$�:N�:N�O� G� �+�+�<�<���q� ��#�#��E�F�"�#��
��A�!5�
6��#�#��C�D�"�#��
����!7��?�
��}�<�<rRc�^�URU5nUb�URRU5RnXR:�a�URRU5(awUb[	XS5nUc3[
R"[
R"U55sSSS5 $[
R"[
R"XC55sSSS5 $UcUR5sSSS5 $URU5sSSS5 $!,(df   g=f![a gf=f)zZreturn a file content with or without mmap

If the file is missing return the empty stringNrR)
r��fstat�st_size�is_mmap_safe�minr9r>�mmapread�readrV)r��filepath�mmap_threshold�sizer�	file_sizes      rO�	_get_data�revlog._get_datas���	����X�&�"�!�-� $��� 1� 1�"� 5� =� =�I�!�3� �K�K�4�4�X�>�>��+�#&�y�#7�D� �<�#'�;�;�t�}�}�R�/@�#A�'�&�$(�;�;�t�}�}�R�/F�#G�'�&� �<��7�7�9�#'�&�&�7�7�4�=�''�&�&��(!�	��	�sS�D�BD�	D�%)D�	D�D�*	D�4D�	D�
D�D�D�
D,�+D,c�X^^^^
�[T5m
TRnT
S:�aUT
S-
SnXA:aO
T
S-
m
T
S:�aMT
S:Xa/$T
UR-mTRT
S-
5mTR(a-UUU4SjnU"5n[U5 TRUTT-4/$U(a,U
U4SjnU"5n[U5 TRUTT-4/$UU4SjnUU4SjnU"5n	[U	5 U"5n
[U
5 TRU
T4TRU	T4/$)u�return a list of streams that represent this revlog

This is used by stream-clone to do bytes to bytes copies of a repository.

This streams data for all revisions that refer to a changelog revision up
to `max_linkrev`.

If `force_inline` is set, it enforces that the stream will represent an inline revlog.

It returns is a list of three-tuple:

    [
        (filename, bytes_stream, stream_size),
        …
    ]
rrr�c3�># �TRTRSS9nSv� TT-nUS::aURU5v� O[R"XS9Shv�N SSS5 gN
!,(df   g=f7f�N�rrOr���limit�r�r:rlr9�
filechunkiter)rro�	data_size�
index_sizer�s  ���rO�
get_stream�&revlog.get_streams.<locals>.get_streamKsj�����[�[����t�[�<���J�%�	�1�D��u�}� �g�g�d�m�+�#'�#5�#5�b�#E�E�E�
=�<�F�
=�<�s.�A:�;A)�A'�A)�	A:�'A)�)
A7�3A:c3�># �TR5 Sv� [T5H�nTRRU5nUS:XaPTRcCTR
nUTR-nU[-nTRRU5nX!-nUv� TRRX5Sv� M� SSS5 g!,(df   g=f7f)Nrr)rCrur�ryrHr1r2rrzr*rw)r��idxr|�nr�s   ��rOr}r~[s������\�\�^��J�$�Q�x��"�j�j�5�5�c�:���!�8����(<�%)�%7�%7�F�"�d�&:�&:�:�F�"�&6�6�F�%)�Z�Z�%;�%;�F�%C�F�"(�,�C�!�	�"�k�k�>�>�s�H��K�K� (�$�^�^�s�C�B,C	�	C�	
C�Cc3��># �TRTRSS9nSv� TS::aURT5v� O[R"UTS9Shv�N SSS5 gN
!,(df   g=f7frury)rr|r�s ��rO�get_index_stream�,revlog.get_streams.<locals>.get_index_streamrsd�����[�[����t�[�<���J�!�U�*� �g�g�j�1�1�#'�#5�#5�b�
�#K�K�K�=�<�
L�=�<�s.�A6�7A%�A#�A%�	A6�#A%�%
A3�/A6c3��># �TR5nSv� TS::aURT5v� O[R"UTS9Shv�N SSS5 gN
!,(df   g=f7f)Nr�rw)�_datafprlr9rz)rr{r�s ��rO�get_data_stream�+revlog.get_streams.<locals>.get_data_streamzsW�����\�\�^�r��J� �E�)� �g�g�i�0�0�#'�#5�#5�b�	�#J�J�J�$�^�
K�$�^�s.�A,�7A�A�A�	A,�A�
A)�%A,)r�r�rWr��_inline�nextr:r;)r��max_linkrev�force_inliner��linkrevr}�
inline_streamr�r��index_stream�data_streamr{r|r�s`          @@@rO�get_streams�revlog.get_streams sE���"
��I���
�
���!�e��A��E�l�1�o�G��$���A��A��!�e�
��6��I���)�)�)�
��H�H�Q��U�O�	��<�<�
F�'�L�M�������-��i�1G�H��
��
L� '�L�M�������-��i�1G�H��
�

L�
K�,�-�L����)�+�K��������i�8����,�
�;��
rRc�.�UR5up#nURbSURUR4-nO�UR(a=URRSUR-5(aSUR-nOWUR(a7URRUR5(a
URnOSUR-nUbXlXPl	GOSUl
URXS5n[U5S:�a$[R"USS5SnSUl
OUnUS-UlUS	-Ul["R$"UR 5nUc;['S
5n	X�R UR(4-n	[*R,"U	5eURU)-(aK['S5n	URS-	n
X�UR UR(4-n	[*R,"U	5e[.UR nUS
"UR5UlUS"UR5UR2lUR2R4UR6lUSUR:lUS(d	XPlUnOWXPl	UR(a[@RB"X5UlO$[@RD"XURS9UlURb�URRG5UlSnURRHn
U
S:�adURUR>X=S9n[U5U
:a;['S5n	X�R([U5U
4-n	[*R,"U	5eSUlSUR2lSUR6lSUl%URb?URRM5Ul'URRQ5Ul)OBURcSUR-Ul'O SURUR4-Ul'[TUl+URVRXUl,UR2R4(dSUR2l-SUl.URJ=(a U=(a [^SLnSnURJSLnU=(d UR`S[b:HnU=(a [eURSS5n[fbU(aSnUR [h:waSn[kURS5(aUURRlnURRn(dSn[qU[rRl5(dSnOSn[tUl;UR [x:Xa[zR|Ul;ORUR [~:Xa[�Ul;O2UR [�:Xa[�Ul;OU(a[^Ul;U(aWSnnSUlCOHURwWUR0UR2R45nUunnUR�U5 [�R�"S5UlIUU4$![�[�4a- [*R,"['S5UR(-5ef=f)Ns%s.i.%ss%s.i.as%s.iTrr�Fr,r-s!unknown version (%d) in revlog %ss-unknown flags (%#04x) in version %d revlog %sr�r.rYssidedatasdocket)�use_pendingrR)ros.too few index data for %s: got %d, expected %ds%s.ds%s.d.%s�rust_compatible�fncachesindex %s is corrupted��)Jrdr>r9r?r�r�r@�_split_index_filerHr6�
_initemptyrqr�rr/r1r2r'r�r�
display_idr3r.rr�r�r�r�r�r�r�r:�
docketutil�default_docket�parse_docket�index_filepathrjr=�
data_filepathr;�sidedata_filepathr<r�
nodeconstants�nullidr��_storedeltachainsr�rErr�
rustrevlogr rr:�uses_dotencode�
isinstance�vfsmodr��_parse_indexrrA�parse_index_v0r"r�rr�rB�_register_nodemap_info�
ValueError�
IndexErrorr9r��_chaininfocache)r�r=r_r`rc�entry_point�
entry_datar|�supported_flagsrE�display_flagr3�
index_datar|�
devel_nodemap�use_rust_index�rust_applicabler:r��
chunkcache�ds                     rOrN�revlog._loadindex�s���8<���8I�5�
�
��<�<�#�$��
�
�D�L�L�'A�A�K�
�
�
�$�+�+�"4�"4�Y����5K�"L�"L�#�d�j�j�0�K�
�_�_����!3�!3�D�4J�4J�!K�!K��0�0�K�!�D�J�J�.�K���!�L� +��"�D�O�����H�J��:���"�%�,�,�Z���^�<�Q�?��"'���#��!'�'�!1�D��#)�F�?�D� �-�1�1�$�2F�2F�G�O��&��<�=���,�,�d�o�o�>�>���'�'��,�,��#�#��&6�6��H�I��#�1�1�R�7���d�&:�&:�D�O�O�L�L���'�'��,�,�*�4�+?�+?�@�H�#�I�.�t�/A�/A�B�D�L�.6��.G��"�"�/�D���+�-1�,=�,=�,K�,K�D���)�08��0E�D���-��I�&�"-��'�
�$/�!��?�?�#-�#<�#<�T�#J�D�L�#-�#:�#:��d�6F�6F�$�D�L��<�<�#�"�l�l�9�9�;�D�O��J����/�/�J��A�~�!�^�^��O�O�%7�,��
��z�?�Z�/��M�N�C��O�O�S��_�j�I�I�C��+�+�C�0�0� �D�L�.2�D���+�,0�D���)�"&�D���<�<�#�!�\�\�7�7�9�D�N�!%���!?�!?�!A�D��
�\�\�
!�$�t�z�z�1�D�N�'�4�:�:�t�|�|�*D�D�D�N�.����(�(�/�/���� � �.�.�.3�D���+�!%���
���
3��
3�&�d�2�	����,�,�D�8��)�K�T�[�[��^�|�-K��)�
�g��K�K�*�D�/
���!�o�"�N��#�#�x�/�!&���4�;�;�	�*�*��+�+�/�/�C��;�;�-�-�!&���c�6�:�:�.�.�!&���#�N�*������8�+� (� 7� 7�D��
�
!�
!�X�
-� .�D��
�
!�
!�[�
0� 1�D��
� 6�D���!+�T�:�E�!�D�N�	
��%�%�����d�.?�.?�.M�.M���%&�!��z��+�+�E�2� $�0�0��5����j� � ���
�+�
��'�'��.�/�$�/�/�A���
�s
�1A[�=\c�$�URcSnOURRnUR(GaUSnSn[URS5(aRURn[U[R5(aSnURnURnURnOURnURnUcS5e[RUUUUURURURUR UR"UR$UR&UUUR(SUR*SLS9Ul[/UR,5UlUR3UR05 SUlg[5URUURURURUR UR"UR$UR&UUS9UlUR,R0Ulg)NFr:Tz%Rust only supports repos with fncacher)�vfs_baser��vfs_is_readonlyr�r�r�r�r�r�r�r�r�r��revlog_type�use_persistent_nodemap)r�r�r�r�r�r�r�r�r�r�r�)rHr�rBrr�r�r��readonlyvfsr:r�rr��InnerRevlogr:r;r<r�r�r�r�rEr=r*r�r�r�r�)r�r�r�r�r�r�r:r�s        rOrO�revlog._load_inner-s����<�<��)-�&�)-���)P�)P�&��>�>�>�#�O��G��t�{�{�E�*�*��k�k���c�6�#5�#5�6�6�&*�O��'�'�C��+�+���g�g���k�k���x�x�H��&�O�(O�O�&�$�0�0�!�� /� ��?�?��.�.�"�0�0��|�|� �,�,�!�.�.�#�2�2�'�+E� �K�K��N�'+�'9�'9��'E�1��D�K�"(����4�D�J��'�'��
�
�3�!�D�N�&��{�{���?�?��.�.�"�0�0��|�|� �,�,�!�.�.�#�2�2�'�+E��D�K����*�*�D�JrRc�b�UR(+=(a! URSL=(a [US5nU(ao[R"U5nUbUUSn[U5UR:�a6XRSUR:XaX@lUR"U6 ggggg)N�update_nodemap_datar�)
r�r=rrC�persisted_datar��tip_rev�tip_noderIr�)r�r��use_nodemap�nodemap_datar=s     rOr��revlog._register_nodemap_infohs�������
6��"�"�$�.�
6���4�5�	�
�&�5�5�d�;�L��'�%�a�����J����/��n�n�-�a�0�F�O�O�C�,2�(��-�-�%��	D�0�(�rRc��U$)z<simple function to mirror API of other not-really-revlog APIrKr�s rO�
get_revlog�revlog.get_revlog|s���rRc� �URS$�Nr)rEr�s rOrZ�revlog.revlog_kind�s���{�{�1�~�rRc�`�UR[:XaURS$UR$)z;The public facing "ID" of the revlog that we use in messager)rZrrEr9r�s rOr��revlog.display_id�s,�����|�+��;�;�q�>�!��:�:�rRc�6�URURUS9$)z&file object for the revlog's data filerO)r�r;)r�rPs  rOr��revlog._datafp�s���{�{�4�>�>��{�5�5rRc�2�[UR5S-
$�Nrr�r�s rO�tiprev�
revlog.tiprev�s���4�:�:���"�"rRc�@�URUR55$r|)r]r�r�s rO�tip�
revlog.tip�s���y�y�����'�'rRc�>�SUs=:*=(a [U5:$s $r�)r�r�s  rOr�revlog.__contains__�s���C�#�#�#�d�)�#�#�#�#rRc�,�[UR5$r|r�r�s rOr��revlog.__len__�r�rRc�<�[[[U555$r|)�iterrur�r�s rO�__iter__�revlog.__iter__�s���E�#�d�)�$�%�%rRc�>�[R"[U5XS9$)z8iterate over all rev in this revlog (from start to stop)�r��stop)rD�iterrevsr��r�r�r�s   rOr��revlog.revs�s���#�#�C��I�U�F�FrRc�H�URU5 g![a gf=f)NTF)r�r,�r�r]s  rO�hasnode�revlog.hasnode�s'��	��H�H�T�N����	��	�s��
!�!c�z�URU5[-(dURU5[-(agg)z;whether two revisions (baserev, rev) can be delta-ed or notFT)rpr.)r��baserevr�s   rO�	_candelta�revlog._candelta�s-��
�J�J�w��"?�?��J�J�s�O�;�;��rRc��URb1Uc[R"U5 g[R"X5 gg)zbupdate on disk cache

If a transaction is passed, the update may be delayed to transaction
commit.N)r=rC�update_persistent_nodemap�setup_persistent_nodemap�r�r[s  rO�
update_caches�revlog.update_caches�s7��
���)��"��5�5�d�;��4�4�[�G�	*rRc���URR5 URR5 0UlSUlURR5 UR(+=(a+ URSL=(a [URS5nU(a>[R"U5nUb$USUlURR"U6 ggg)zClear in-memory cachesNr�r)rGr�r*r�rJrIr��clearcachesr�r=rrCr�r�)r��clear_persisted_datar�r�s    rOr��revlog.clearcaches�s������"�"�$������!����#����
�
��� �����
;��"�"�$�.�
;���
�
�$9�:�	�
�&�5�5�d�;�L��'�'3�A���$��
�
�.�.�!��(�rRc�V�URRU5$![a e[Ram XR
R:XdXR
R;a[Re[R"XR[S55ef=f)z5return the revision number associated with a <nodeid>�no node)r�r��	TypeErrorr3r.r��wdirid�wdirfilenodeids�WdirUnsupported�LookupErrorr�rr�s  rOr��
revlog.rev�s���	J��:�:�>�>�$�'�'���	��� � �	J��*�*�1�1�1��-�-�=�=�=��+�+�+��#�#�D�/�/�1�Z�=�I�I�	J�s
��BB(c�>�[URUSS-	5$)Nrr�r�r�s  rOr��revlog.start�s���4�:�:�c�?�1�%��+�,�,rRc��URUSnUS:waU$SU::a0URUnUSS:waUSUS-$US-nSU::aM0g)Nr�rr�rr�)r�r��
sd_cut_offrs    rO�sidedata_cut_off�revlog.sidedata_cut_off�sk���Z�Z��_�Q�'�
���?����3�h��
�
�3��A���t�q�y���t�a��d�{�"��1�H�C�	�3�h�
rRc�,�URUSS-$)Nrr-r�r�s  rOrp�revlog.flagss���z�z�#��q�!�F�*�*rRc�&�URUS$r�r�r�s  rOr��
revlog.length����z�z�#��q�!�!rRc�^�URR(dgURUS$)Nrr�)r�r�r�r�s  rO�sidedata_length�revlog.sidedata_lengths'���"�"�0�0���z�z�#��q�!�!rRc�n�URUSnUS:�aU$URU5n[U5$)z?return the length of the uncompressed text for a given revisionr�r)r��rawdatar�)r�r��lr's    rOr��revlog.rawsizes7���J�J�s�O�A�����6��H��L�L�����1�v�
rRc��URU5nU[R[--S:XaUR	U5$[UR
U55$)z=length of non-raw text (processed by a "read" flag processor)r)rpr>�REVIDX_KNOWN_FLAGSr)r�r�rZ)r�r�rps   rOro�revlog.sizesL���
�
�3����H�/�/�/�A�B�a�G��<�<��$�$��4�=�=��%�&�&rRc��URU[nUR[:wd
U[:XagU[
:XagU$)a�Return the rank of a revision if already known, or None otherwise.

The rank of a revision is the size of the sub-graph it defines as a
head. Equivalently, the rank of a revision `r` is the size of the set
`ancestors(r)`, `r` included.

This method returns the rank retrieved from the revlog in constant
time. It makes no attempt at computing unknown values for versions of
the revlog which do not persist the rank.
Nr)r�rr2rrr)r�r��ranks   rO�	fast_rank�revlog.fast_ranks=���z�z�#��z�*�����;�.�$�,�2F���'�>���rRc��URRU5nUbU$URnUnX4SnX$:waUnX4SnX$:waMX RU'U$)Nr)rGr�r�)r�r�rr�rs     rO�	chainbase�revlog.chainbase1so���#�#�'�'��,�����K��
�
�����~�a� ���o��G��>�!�$�D��o�%)���S�!��rRc�&�URUS$)Nr�r�r�s  rOr��revlog.linkrev@r
rRc���URUnUR
R(aUS[:Xa
USUS4$USUS4$![a U[:Xa[Reef=f)Nr
r)r�r�rr3rr�r�r)r�r�r
s   rO�
parentrevs�revlog.parentrevsCs}��	��J�J�s�O�E����5�5�%��(�g�:M���8�U�1�X�%�%���8�U�1�X�%�%���	��g�~��+�+�+��	�s�A
�
&A3c�z�URUS$![a U[:Xa[Reef=f)Nr�)r�r�rr3rr�s  rOr]�revlog.nodeSs?��	��:�:�c�?�1�%�%���	��g�~��+�+�+��	�s��&:c�H�URU5URU5-$r|r�r�s  rOr��
revlog.end]s���z�z�#�����S�!1�1�1rRc���URnX RU5nURR(a'USUR:XaX#SSX#SS4$X#SSX#SS4$)Nr
rr�)r�r�r�r�r�)r�r]r�r�s    rO�parents�revlog.parents`sw���J�J��
�h�h�t�n������5�5�!�A�$�$�+�+�:M��q�T�7�1�:�q�1��w�q�z�)�)��q�T�7�1�:�q�1��w�q�z�)�)rRc�*�URU5S$r�)�
_chaininfor�s  rO�chainlen�revlog.chainlenis�����s�#�A�&�&rRc�<�URnX;aX!$URnURRnUnX5nSnSnXVS:waDUS-
nX�S-
nU(aUSnOUS-nXR;aX%n	XyS-
nX�S-
nOX5nXVS:waMDX�S-
nXx4n
X�U'U
$)Nrrr)r�r�r�r�)r�r��chaininfocacher�r�rr�clen�compresseddeltalenr'ras           rOr,�revlog._chaininfols����-�-��� �!�&�&��
�
���(�(�6�6�����N�������1��o��A�I�D��A�$�&����A�$���1����(�"�+���!����"��d�*�"����A��1��o� 
�A�$�&��
�&���s���rRc�4�URRXS9$)Nr�)r*r)r�r�rs   rOr�revlog._deltachain�s���{�{�&�&�s�&�<�<rRc��[U5nURnUHnU"U5 M
 [b8URR(a[R
nURnO[RnURnU"XqX#S9$)z�Generate the ancestors of 'revs' in reverse revision order.
Does not generate revs lower than stoprev.

See the documentation for ancestor.lazyancestors for more details.)r�	inclusive)	�listr]�rustancestorr��rust_ext_compat�
LazyAncestorsr1�
lazyancestors�_uncheckedparentrevs)r�r�rr7�checkrevrar<�args        rO�	ancestors�revlog.ancestors�sr���D�z���9�9���A��Q�K���#��
�
�(B�(B�(�6�6�M��*�*�C�$�2�2�M��+�+�C��S��M�MrRc�X�[R"XRUR5$r|)r2�descendantrevsr�r")r�r�s  rO�descendants�revlog.descendants�s���#�#�D�)�)�T�_�_�E�ErRc�^
�Uc
UR/nUcUR5nUVs/sHo0RU5PM nnUVs/sHo0RU5PM nn"SS5nU"URU55m
T
R	[
5 T
R
U5 [5n[R"U
4SjU55nU(abUR5nXu;aMUR	U5 URU5HnUT
;dMURU5 M U(aMb[U5nUR5 T
UV	s/sHo�RU	5PM sn	4$s snfs snfs sn	f)a�Return a tuple of the ancestors of common and the ancestors of heads
that are not ancestors of common. In revset terminology, we return the
tuple:

  ::common, (::heads) - (::common)

The list is sorted by revision number, meaning it is
topologically sorted.

'heads' and 'common' are both lists of node IDs.  If heads is
not supplied, uses all of the revlog's heads.  If common is not
supplied, uses nullid.c�2�\rSrSrSrSrSrSrSrSr	g)	�)revlog.findcommonmissing.<locals>.lazyseti�c�.�[5UlXlgr|)�set�addedvalues�
lazyvalues)r�rLs  rOr��2revlog.findcommonmissing.<locals>.lazyset.__init__�s��#&�5�� �",�rRc�H�XR;=(d XR;$r|�rKrL�r��values  rOr�6revlog.findcommonmissing.<locals>.lazyset.__contains__�s��� 0� 0�0�L�E�_�_�4L�LrRc3�z# �URnUHnUv� M	 URHnX!;dM
Uv� M g7fr|rO)r��addedras   rOr��2revlog.findcommonmissing.<locals>.lazyset.__iter__�s7����(�(���A��G�����A��:���)�s�,;�	;c�:�URRU5 gr|)rKrYrPs  rOrY�-revlog.findcommonmissing.<locals>.lazyset.add�s��� � �$�$�U�+rRc�:�URRU5 gr|)rK�update)r��valuess  rOrY�0revlog.findcommonmissing.<locals>.lazyset.update�s��� � �'�'��/rRrON)
rfrgrhrir�rr�rYrYrurKrRrO�lazysetrH�s��
-�
M�
 �
,�
0rRr\c3�6># �UHoT;dM
Uv� M g7fr|rK)�.0ra�hass  �rO�	<genexpr>�+revlog.findcommonmissing.<locals>.<genexpr>�s����!C�U��s�l�!�!�U�s�	�	)r��headsr�r@rYrrYrJ�collections�deque�popleftr"rr8r�r])r��commonrbr�r\�missing�visitra�p�missr_s          @rO�findcommonmissing�revlog.findcommonmissing�s?����>��k�k�]�F��=��J�J�L�E�'-�.�v�!�(�(�1�+�v��.�&+�,�e����!��e��,�	0�	0�,�d�n�n�V�,�-��������
�
�6���%���!�!�!C�U�!C�C����
�
��A��|�����A������+�A���|����Q��,�
�e��w�-��������9���Y�Y�t�_��9�9�9��Y/��,��V:s�E=�	F�Fc���Uc[/n[b;URR(a [R	URU5$[
R"URU5$)aReturn an object that can be used to incrementally compute the
revision numbers of the ancestors of arbitrary sets that are not
ancestors of common. This is an ancestor.incrementalmissingancestors
object.

'common' is a list of revision numbers. If common is not supplied, uses
nullrev.
)rr9r�r:�MissingAncestorsr1�incrementalmissingancestorsr")r�rfs  rO�incrementalmissingrevs�revlog.incrementalmissingrevs�sP���>��Y�F��#��
�
�(B�(B��0�0����V�D�D��3�3�D�O�O�V�L�LrRc�|�Uc[/nUcUR5nURUS9nURU5$)a(Return the revision numbers of the ancestors of heads that
are not ancestors of common.

More specifically, return a list of revision numbers corresponding to
nodes N such that every N satisfies the following constraints:

  1. N is an ancestor of some node in 'heads'
  2. N is not an ancestor of any node in 'common'

The list is sorted by revision number, meaning it is
topologically sorted.

'heads' and 'common' are both lists of revision numbers.  If heads is
not supplied, uses all of the revlog's heads.  If common is not
supplied, uses nullid.�rf)r�headrevsrp�missingancestors)r�rfrb�incs    rO�findmissingrevs�revlog.findmissingrevs�sD�� �>��Y�F��=��M�M�O�E��)�)��)�8���#�#�E�*�*rRc�d�Uc
UR/nUcUR5nUVs/sHo0RU5PM nnUVs/sHo0RU5PM nnURUS9nUR	U5Vs/sHoPRU5PM sn$s snfs snfs snf)a�Return the ancestors of heads that are not ancestors of common.

More specifically, return a list of nodes N such that every N
satisfies the following constraints:

  1. N is an ancestor of some node in 'heads'
  2. N is not an ancestor of any node in 'common'

The list is sorted by revision number, meaning it is
topologically sorted.

'heads' and 'common' are both lists of node IDs.  If heads is
not supplied, uses all of the revlog's heads.  If common is not
supplied, uses nullid.rs)r�rbr�rprur])r�rfrbr�rvras      rO�findmissing�revlog.findmissing	s����>��k�k�]�F��=��J�J�L�E�'-�.�v�!�(�(�1�+�v��.�&+�,�e����!��e��,��)�)��)�8��&)�&:�&:�5�&A�B�&A��	�	�!��&A�B�B��	/��,��Cs�B#�B(�B-c�H�///4nUb?[U5nU(dU$[UVs/sHo@RU5PM sn5nOUR/n[nU[:XaIUcFUVs/sHo`RU5PM snUR/[UR
554$Uc[U5S-
nSn0nGO�[U5nU(dU$[5n[RUS5n[U5n	[U	Vs/sHo@RU5PM sn5nU	(a�U	R5nX@R:XaM(URU5nXe:�aoXH;aTURU5 U	RURU5V
s/sHo�UR:wdMU
PM sn
5 OXB;aURU5 U	(aM�U(dU$U[:�aMUVs/sHo�U;dM
UPM nnU(a+[UVs/sHo�RU5PM sn5nOU$[nUR/n[U5nUR!5n/n
UR#[US5US-S9GHnURU5nSnU[:XaSnO�XL;aESnXA;a=[%URU55n
U
SU;d	U
SU;aUR'U5 O?[%URU55n
U
SU;d	U
SU;aURU5 SnU(dM�UbXH;dM�U
R)U5 UbXB;aSX$'M�UbM�SX$'URU5Hn
URU
S5 M GM UR+5VVs/sHunnU(dMUPM nnn[U5nU
(deU(deU(deX�U4$s snfs snfs snfs sn
fs snfs snfs snnf)a Return a topological path from 'roots' to 'heads'.

Return a tuple (nodes, outroots, outheads) where 'nodes' is a
topologically sorted list of all nodes N that satisfy both of
these constraints:

  1. N is a descendant of some node in 'roots'
  2. N is an ancestor of some node in 'heads'

Every node is considered to be both a descendant and an ancestor
of itself, so every reachable node in 'roots' and 'heads' will be
included in 'nodes'.

'outroots' is the list of reachable nodes in 'roots', i.e., the
subset of 'roots' that is returned in 'nodes'.  Likewise,
'outheads' is the subset of 'heads' that is also in 'nodes'.

'roots' and 'heads' are both lists of node IDs.  If 'roots' is
unspecified, uses nullid as the only root.  If 'heads' is
unspecified, uses list of all of the revlog's heads.NrFrr�T)r8rjr�r�rr]rbr�rJr��fromkeys�max�poprYrYr)r�r��tuple�removerr\)r��rootsrb�nonodesr��	lowestrevra�
highestrevr@�
nodestotagri�rootrD�
orderedout�isdescendant�headras                 rO�nodesbetween�revlog.nodesbetween(	s���*�r�2�,������K�E�����%�8�%�Q�X�X�a�[�%�8�9�I��[�[�M�E��I��� �u�}�(,�,�t�!���1��t�,����
��T�Z�Z�\�"��
�
�=��T��Q��J��I��E���K�E������I��M�M�%��/�E��U��J��:�>�:�a�h�h�q�k�:�>�?�J���N�N�$�����#���H�H�Q�K���>��)�"�
�
�a�(�"�)�)�(,���Q��L��1����;K�Q��L�����	�	�!��+�*�,���
�7�"�
+0�E�%�$�9�3D��%��E�� #��$F���X�X�d�^��$F� G�I�#�N�$�	����
���%�j��� � �"���
�����Y��!2��a���H�A��	�	�!��A� �L��G�#�#���!�#���:��d�l�l�1�o�.�A��!���+��1���1D����Q����$�,�,�q�/�*���a�D�K�'�Q�q�T�[�-@��O�O�A�&�#'�L��|�)�"3����!�!�!�$��)��
� $�E�H��&� $�E�H�!�\�\�!�_���	�	�!�T�*�-�MI�P).���
�>�
�*�$����
��>��U�����z���u���u��5�)�)��I9��-��0?��"M��"F��%G��v?s;�P�,P�
P
� P�7P�;	P�P� P�;P�
Pc��UcURRSU5$[b;URR(a [RURU5$[R"XR
5$r|)r�rt�	rustdagopr:r2r=)r�r��stop_revs   rOrt�revlog.headrevs�	s\���<��:�:�&�&�t�X�6�6�� �T�Z�Z�%?�%?��%�%�d�j�j�$�7�7��~�~�d�$=�$=�>�>rRc��URRX5$![a$ [R"URX5s$f=fr|)r��headrevsdiffrr2r=r�s   rOr��revlog.headrevsdiff�	sN��	N��:�:�*�*���
���	N��%�%�d�&?�&?��M�M�	N�s��+A�
Ac�8�URRU5$r|)r��computephasesmapsets)r�r�s  rO�
computephases�revlog.computephases�	s���z�z�.�.��
�	
rRc���URR5$![a8 UR5Vs/sHoR	U5PM Os snfsns$f=fr|)r��
head_node_idsrrtr])r�ras  rO�_head_node_ids�revlog._head_node_ids�	sJ��	;��:�:�+�+�-�-���	;�*.�-�-�/�:�/�Q�I�I�a�L�/��:�:�	;�s��A�A�	A�Ac��Uc0Uc-[U5(d
UR/$UR5$Uc[nOUR	U5nU=(d /Vs1sHo0R	U5iM nn[
R"URURXS9nUVs/sHo`RU5PM sn$s snfs snf)z�return the list of all nodes that have no children

if start is specified, only heads that are descendants of
start will be returned
if stop is specified, it will consider all the revs from stop
as if they had no children
)r��stoprevs)
r�r�r�rr�r2�headrevssubsetr�r"r])r�r�r�r�r�r�r�s       rOrb�revlog.heads�	s����=�T�\��t�9�9����}�$��&�&�(�(��=��E��H�H�U�O�E�)-����4��A�H�H�Q�K���4��#�#��I�I�t����
��+/�/�$�3�	�	�#��$�/�/��
5��0s�C�&Cc��URX5up4UVs/sHoPRU5PM snUVs/sHoPRU5PM sn4$s snfs snf)zqreturn the nodes that make up the difference between
heads of revs before `start` and heads of revs before `stop`)r�r])r�r�r��removedrTras      rO�	diffheads�revlog.diffheads�	sQ���*�*�5�7���&-�.�g��	�	�!��g�.�u�0M�u�!���1��u�0M�M�M��.��0Ms
�A�Ac��/nURU5nURUS-S9H�nURU5Vs/sHoU[:wdMUPM nnU(a2UH*nXS:XdM
UR	URU55 M, MhU[:XdMtUR	URU55 M� U$s snf)z!find the children of a given noder)r�)r�r�r"rrr])r�r]r(rira�pr�prevss       rO�children�revlog.children
s������H�H�T�N������Q���'�A�"&�/�/�!�"4�F�"4�B�g�
�R�"4�E�F���B��w�������1��.� ��g��������1��&�(����Gs�
C�
Cc��URU5URU5p!URX5n[R"URU5$)z@calculate all the heads of the common ancestors of nodes a and b)r��_commonancestorsheadsr6�maplistr]�r��ar�ancss    rO�commonancestorsheads�revlog.commonancestorsheads
s@���x�x��{�D�H�H�Q�K�1��)�)�!�/������	�	�4�0�0rRc��URR"U6nU$![[4a% [R"UR
/UQ76nU$f=f)z7calculate all the heads of the common ancestors of revs)r�r�rr�r1r")r�r�r�s   rOr��revlog._commonancestorsheads
s\��	I��:�:�2�2���D�
����
�.�	I��0�0����H�4�H�D���	I�s��1A�Ac�f�URU5URU5p!URX5$)z_return True if node a is an ancestor of node b

A revision is considered an ancestor of itself.)r��
isancestorrev�r�r�rs   rO�
isancestor�revlog.isancestor
s,���x�x��{�D�H�H�Q�K�1��!�!�!�'�'rRc	�h�U[:XagX:XagX:�ag[URX/U/SS95$)z�return True if revision a is an ancestor of revision b

A revision is considered an ancestor of itself.

The implementation of this is trivial but the use of
reachableroots is not.TF)�includepath)r�bool�reachablerootsr�s   rOr��revlog.isancestorrev&
s?��
��<��
�V��
�U���D�'�'��3����'�G�H�HrRc��URRXX45$![a% [R"UR
XX$5s$f=f)zdreturn (heads(::(<roots> and <roots>::<heads>)))

If includepath is True, return (<roots>::<heads>).)r��reachableroots2rr2�_reachablerootspurer")r��minrootrbr�r�s     rOr��revlog.reachableroots5
sR��	��:�:�-�-����
���	��,�,�������
�	�s��,A
�A
c�N�URU5URU5p!URRX5nU(a[[URU55$UR$![[4a$ [
R"URX5nNef=f)z5calculate the "best" common ancestor of nodes a and b)r�r�r@rr�r1r"rj�mapr]r�r�s    rOr1�revlog.ancestorB
s����x�x��{�D�H�H�Q�K�1�	=��:�:�'�'��-�D���s�4�9�9�d�+�,�,��{�{����
�.�	=��%�%�d�o�o�q�<�D�	=�s�A0�01B$�#B$c��[U[5(aURU5$[U5URR
:XaUnUR
U5 U$[U5nSU-U:wa[eUS:a[U5U-nUS:dU[U5:�a[eURU5$![Ra Nqf=f![[4a Of=f[U5SURR
-:XaI[U5nUR
U5 U$![R[R4a gf=fg)Ns%drr�)r�ror]r�r��nodelenr�r3rr�r�r	r/�Error)r��idr]r�s    rO�_match�
revlog._matchO
s<���b�#����9�9�R�=� ��r�7�d�(�(�0�0�0�
����������	��b�'�C��s�{�b� � � ��Q�w��$�i�#�o���Q�w�#��T��*� � ��9�9�S�>�!���$�$�
��
���M�*�	��	���r�7�a�$�,�,�4�4�4�4�
��2�w�����������N�N�E�$5�$5�6�
��
��
5s7�B;�!AC�;C�C�C(�'C(�D0�0$E�Ec��URRRU5nSnURR	U5nU(a"URU5(aU(aSnOU$U(a[RegU(a*[R"XR[S55eXR;aURU$[!U5S::Ga�[!U5S-S-n[!U5S-S:�aUS[";ag[%USU5nURVs/sH"owS	RU5(dMUS	PM$ nnUV	s/sH>n	['U	5RU5(dM$URU	5(dM<U	PM@ nn	URR(RU5(aUR+UR,5 [!U5S:�aW[!U5S
:XaU(dUSURU'US$[R"XR[S55eU(a[Regg![Ra [USS5(dSnGN[[4a GN$f=fs snfs sn	f![.R0a gf=f)NFT�filteredrevssambiguous identifier�(r�rr�r�r)r��wdirhex�
startswithr��partialmatchr�r3rr.rrr��AmbiguousPrefixLookupErrorr�rrJr��	hexdigitsr	r
�nullhexrr�r/r�)
r�r��	maybewdir�	ambiguous�partialr�prefixr�nlr�s
          rO�
_partialmatch�revlog._partialmatchq
sg���&�&�.�.�9�9�"�=�	��	�	��j�j�-�-���G��4�<�<��0�0�� $�I�"�N���+�+�+����2�2��O�O�Q�'>�%?��
������<�<��#�#��r�7�b�=��B��1��q� �A�
��r�7�Q�;��?��r�F�i�/�#��R���V���%)�J�J�J�J�q�A�$�/�/�&�2I�d�a��d�J��J�!��!�!�S��V�%6�%6�r�%:�A�t�|�|�A��A�r����%�%�-�-�8�8��<�<��I�I�d�k�k�*��r�7�Q�;��2�w�!�|�I�+-�a�5����R�(�!�!�u���:�:��O�O�Q�/F�-G�����/�/�/��9��#� � �	!��4���6�6� �	���
�+�	��	��0K����	�>�>�
��
�sZ�AI,�+I,�-I,�6J7�J7�2J-�	J-�!#J2�J2� J2�,(J*�J*�)J*�7K�
Kc��URU5nUbU$URU5nU(aU$[R"XR[S55e)zclocate a node based on:
- revision number or str(revision number)
- nodeid or subset of hex nodeid
sno match found)r�r�r3rr�r)r�r�r�s   rO�lookup�
revlog.lookup�
sP��

�K�K��O���=��H����r�"����H�����O�O�Q�7H�5I�J�JrRc�^^^	�UU4SjnSm	[T5nU	4Sjn[TSS5(d/TRRT5n[	Xb5nU"XG5$TTRR:Xa5[U[U5S-5HnUSUnU"U5(dMUs $ [U[U5S-5HnUSUnU"U5(dMU"XG5s $ g![
RaH TTRR:wa+[
R"TTR[S55eN�[a N�f=f)z7Find the shortest unambiguous prefix that matches node.c��>�TRU5nUc+[R"TTR
[
S55eg![Ra g[Ra gf=f)NFTr�)r�r3r�rrr�r)r��matchednoder]r�s  ��rO�isvalid� revlog.shortest.<locals>.isvalid�
sk���
�"�0�0��8���"��'�'��d�o�o�q��}�M�M����3�3�
���(�(�
��
�s�A�A/�A/�.A/c�N�[S[R"U555$)Nc3�*# �UH	oS:Hv� M g7f)�fNrK)r^r(s  rOr`�5revlog.shortest.<locals>.maybewdir.<locals>.<genexpr>�
s���G�*F�Q�D�y�*F�s�)�allr6�iterbytestr)r�s rOr��"revlog.shortest.<locals>.maybewdir�
s���G�(�*>�*>�v�*F�G�G�GrRc�p>�[U[U5S-5HnUSUnT"U5(aMUs $ g)zDisambiguate against wdirid.rN)rur�)�hexnode�	minlengthr�r�r�s    �rO�disambiguate�%revlog.shortest.<locals>.disambiguate�
s9����	�3�w�<�!�+;�<�� ��&�)�� ��(�(�!�M�=rRr�Nr�r)r
rr��shortestr~r3r.r�r�rr�rrrur�)
r�r]r�r�r�r�r�r�r�r�s
``       @rOr��revlog.shortest�
sG���
	�	H��d�)��	"��t�^�T�2�2�

��:�:�.�.�����X�1��#�G�4�4��4�%�%�,�,�,��	�3�w�<�!�+;�<�� ��&�)���6�?�?�!�M�=�
�I�s�7�|�a�'7�8�F��W�f�%�F��v���#�G�4�4�9���$�$�
��4�-�-�4�4�4��+�+��d�o�o�q��}���5�"�
��
�s�-C+�+AE�	E�Ec�\�URU5up4[R"X#U5U:g$)z`compare text with a given file revision

returns True if text is different than what is stored.
)r)rD�hashrevisionsha1)r�r]rNrrs     rO�cmp�
revlog.cmp�
s,��
���d�#����+�+�D�b�9�T�A�ArRc��URUSnX!:Xa[$URR(aU$US-
$r�rrs   rOr�revlog.deltaparent�
rrRc�r�URRU5nURRUlU$)r)r*r	)r�r��rets   rOr	�revlog.issnapshot	s,���k�k�$�$�S�)���+�+�0�0����
rRc��URU5(d[R"S5e[URRU5S5S-
$)z/number of snapshot in the chain before this onesrevision %d not a snapshotrr)r	r3rBr�r*rr�s  rO�
snapshotdepth�revlog.snapshotdepthsG�����s�#�#��(�(�)F�G�G��4�;�;�*�*�3�/��2�3�a�7�7rRc���U[:wa9URU5U:Xa$[URR	U55$[
R"URU5URU55$)z�return or calculate a delta between two revisions

The delta calculated is in binary form and is intended to be written to
revlog data directly. So this function needs raw revision data.
)rrrkr*r�r4�textdiffr)r��rev1�rev2s   rO�revdiff�revlog.revdiffsZ���7�?�t�/�/��5��=�����+�+�D�1�2�2��~�~�d�l�l�4�0�$�,�,�t�2D�E�ErRc�$�URU5$)zDreturn an uncompressed revision of a given node or revision
number.
��
_revisiondata�r��	nodeorrevs  rOrZ�revlog.revision s���!�!�)�,�,rRc�v�[U[5(aUnOURU5nURU5$)z�a map of extra data related to the changeset but not part of the hash

This function currently return a dictionary. However, more advanced
mapping object will likely be used in the future for a more
efficient/lazy code.
)r�ror��	_sidedata)r�rr�s   rOrC�revlog.sidedata&s3���i��%�%��C��(�(�9�%�C��~�~�c�"�"rRc��URR(a8URRSU:XaX RRSS4$UcURU5nURRX5nX#S4$)zZreturn the possibly unvalidated rawtext for a revision

returns (rev, rawtext, validated)
rr�TF)r*r�r�r�)r�r]r�rNs    rO�_rawtext�revlog._rawtext4ss���;�;�%�%��{�{�)�)�!�,��4��[�[�7�7��:�D�A�A��;��(�(�4�.�C��{�{�#�#�D�.���5�!�!rRc��[U[5(aUnURU5nOUnSnX@R:XagUR	XC5up5nU(a	U(aU$UcURU5nUR
U5nU(aU[:XaU$U(a[R"XU5nUn	O[R"XU5n
U
up�U(aURX�US9 U(dXCU4URl
U	$)NrR)r�)r�ror]r�r
r�rpr(r>�processflagsraw�processflagsread�	checkhashr*r�)r�r�rawr�r]r��	validatedrp�validatehashrNras           rOr�revlog._revisiondataEs����i��%�%��C��9�9�S�>�D��D��C��;�;���#'�-�-��":���i��9��N��;��(�(�4�.�C��
�
�3�����"6�6��N��#�3�3�D�5�I�L��D��)�)�$��?�A�!"��D���N�N�4�3�N�/��*.�W�)=�D�K�K�&��rRc��URc0$SnURbURRnURR	X5$)r�N)r<rHr]r*rC)r�r�r]s   rOr
�revlog._sidedataqsF�����%��I����<�<�#��<�<�4�4�L��{�{�#�#�C�6�6rRc�"�URUSS9$)zCreturn an uncompressed raw data of a given node or revision number.T)rrrs  rOr�revlog.rawdatazs���!�!�)��!�6�6rRc�0�[R"XU5$)zaCompute a node hash.

Available as a function so that subclasses can replace the hash
as needed.
)rDr�)r�rNrrs    rO�hash�revlog.hash~s���+�+�D�b�9�9rRc��UcUcURU5up4X RXU5:wa�URR(a.URRSU:XaSURlUnUc[R
"[
U55n[R"[S5UR[R"U54-5eg![RaY URR(a<[R "U5(a![R""URX!5eef=f)zuCheck node hash integrity.

Available as a function so that subclasses can extend hash mismatch
behaviors as needed.
Nrsintegrity check failed on %s:%s)r)rr*r�r8r
r
r3r.rr�r6�bytestrr�r�rD�iscensoredtext�CensoredNodeError)r�rNr]rrr��	revornodes       rOr�revlog.checkhash�s��	��z�b�j����d�+����y�y��2�.�.��K�K�.�.����2�2�1�5��=�15�D�K�K�.��	��$� /� 5� 5�c�$�i� @�I��'�'��8�9�����(8�(8��(C�D�E���!/��(� � �	��"�"�-�-�+�2L�2L��3�3��-�-�d�o�o�t�J�J��	�s
�CC � A-E
c���URRS5n[U5S:�a0USS-nUSSnUSS-nU/U-U/-nSRU5$URS-$)z�the path where to expect the index of an ongoing splitting operation

The file will only exist if a splitting operation is in progress, but
it is always expected at the same location.�/rrs-sr�s.is.i.s)r9�splitr�r�)r��partsr��mids�tail�piecess      rOr��revlog._split_index_file�s|���
�
� � ��&���u�:��>���8�e�#�D���2�;�D���9�u�$�D��V�d�]�d�V�+�F��9�9�V�$�$��:�:��'�'rRc�^
^^^
�[U5S-
nURU5URU5-nUR(aUR(aU[
:agURbSn[R"U5eURURR5nUSLnU(dCURS[:wa,[R"[S5UR -5eUR#URRUS9 UR%UR&S5 Sm
UR mUR(m
UR*m[,R."U5m
U
UUU
4SjnUU
4SjnUR1T
5 URSbS	UR-n	OS
URS-n	UR3X�5 UR5X�5 U=R6[8)-slURR;UUR6UR<-T
S9 SUlT
bT
Ul[>R@"X5 g)
z�Check if the revlog is too big for inline and convert if so.

This should be called after revisions are added to the revlog. If the
revlog has grown too large to be an inline revlog, it will convert it
to use multiple index and data files.
rNs&inline revlog should not have a docketrs%s not found in the transaction)�
for_offsetc�>�TRTTSS9 T"5nUb#TUlURURlgg)NTr�)r�r:r*r�)r{�
maybe_selfr}�old_index_file_pathr��	weak_selfs  ����rO�finalize_callback�4revlog._enforceinlinesize.<locals>.finalize_callback�sM����M�M�#�#��
�
�
#��J��%�(;�
�%�/9�/D�/D�
�!�!�,�&rRc�n>�T"5nUb*TUlSURlTURlggr�)r:r*r�r�)r{r/r0r1s  ��rO�abort_callback�1revlog._enforceinlinesize.<locals>.abort_callback�s9���"��J��%�(;�
�%�+/�
�!�!�(�/B�
�!�!�,�&rRs001-revlog-split-%d-%ss001-revlog-split-%d)r}F)!r�r�r�r�rA�
_maxinlinerHr3rB�
findoffsetr*r�rErr.rr:�	addbackuprYr;r�r��weakref�ref�registertmp�addfinalize�addabortr1rr�r2rCr�)r�r{r��
total_sizerE�troffset�pre_touchedr2r5�callback_idr}r0r�r1s          @@@@rO�_enforceinlinesize�revlog._enforceinlinesize�s�����T��Q����Z�Z��'�$�+�+�f�*=�=�
��|�|�� 0� 0�Z�*�5L���<�<�#�;�C��(�(��-�-�
�=�=����!A�!A�B���d�*���t�{�{�1�~��?��#�#��4�5����G��
�	���T�[�[�5�5�+��N�
���t�~�~�q�!�"��"�o�o��"�4�4�������K�K��%�	�		E�		E�	C�	���*�+��;�;�q�>�%�3�d�k�k�A�K�0�4�;�;�q�>�A�K�
���{�6�
���K�0����/�/�/����� � ������!5�!5�5� 3�	!�	
�����*�1�D�O��,�,�R�6rRc��g)z0called when trying to add a node already stored.NrK)r�r[r]s   rO�_nodeduplicatecallback�revlog._nodeduplicatecallbacks�rRc#�|# �URR5 Sv� SSS5 g!,(df   g=f7fr|)r*rCr�s rOrC�revlog.readings#���
�[�[�
 �
 �
"��#�
"�
"�s�<�+�	<�
9�<c#��# �UR(a&SnX R-n[R"U5eURR
(aSv� gSnSnURb,URRnURRnURRUUUS9 Sv� URbURU5 SSS5 g!,(df   g=f7f)Ns)try to write in a `trypending` revlog: %s)r\r])r?r�r3rBr*rHrHr\r]rd�
_write_docket)r�r[rEr\r]s     rO�_writing�revlog._writings�������>�C��?�?�"�C��(�(��-�-��;�;�!�!���H��L��|�|�'��<�<�0�0��#�|�|�8�8�����$�$��!�)�%��
��<�<�+��&�&�{�3����s�B0C/�2#C�	C/�
C,�(C/c�.�URR$r|)r*r�r�s rOr��revlog.is_delaying+s���{�{�&�&�&rRc�:�URRU5 g)z�write the current docket on disk

Exist as a method to help changelog to implement transaction logic

We could also imagine using the same transaction logic for all revlog
since docket are cheap.N)rHrvr�s  rOrK�revlog._write_docket/s��	
�����;�'rRc
���U[:Xa,[R"[S5UR-5eU
c0n
OAU
(a:UR
R(d[R"[S55eU(aU=(d URXU5n[R"XU5up�X�:waSn[U5[:�a7[R"[S5UR[U54-5eU=(d URX�U5nURRU5n
U
bU
$U(aURX�XES9 UR!UUUUUUUUU	U
S9
$)aCadd a revision to the log

text - the revision data to add
transaction - the transaction object used for rollback
link - the linkrev data to add
p1, p2 - the parent nodeids of the revision
cachedelta - an optional precomputed delta
node - nodeid of revision; typically node is not specified, and it is
    computed by default as hash(text, p1, p2), however subclasses might
    use different hashing method (and override checkhash() in such case)
flags - the known flags to set on the revision
deltacomputer - an optional deltacomputer instance shared between
    multiple calls
s!attempted to add linkrev -1 to %sNs9trying to add sidedata to a revlog who don't support thems;%s: size of %d bytes exceeds maximum revlog storage of 2GiB)rr)�
cachedelta�
deltacomputerrC)rr3r.rr�r�r�rBrr>�processflagswriter��
_maxentrysizer��get_revr�addrawrevision)r�rNr[r�rrrSr]rprTrCr�rr�s              rO�addrevision�revlog.addrevision8sd��6�7�?��#�#��6�7�$�/�/�I��
����H�
�d�1�1�?�?��(�(��N�O��
���2�4�9�9�T�r�2�D� (� :� :�4�u� M����?��J��w�<�-�'��#�#��R���?�?�C��L�1�2��
��1�t�y�y��b�1���j�j� � ��&���?��J���N�N�7�R�N�7��"�"��������!�'��#�
�	
rRc��URU5 URUUUUUUUUU	U
S9
sSSS5 $!,(df   g=f)z�add a raw revision with known flags, node and parents
useful when reusing a revision not stored in this revlog (ex: received
over wire, or read from an external bundle).
�rTrCN)rL�_addrevision)r�r�r[r�rrr]rprSrTrCs           rOrX�revlog.addrawrevision�sM��"�]�]�;�
'��$�$���������+�!�%��(�
'�
'�s	�4�
Ac�8�URRU5$r|)r*r6�r�rs  rOr6�revlog.compress�s���{�{�#�#�D�)�)rRc�8�URRU5$r|)r*r&r`s  rOr&�revlog.decompress�s���{�{�%�%�d�+�+rRc��XR:Xa,[R"[S5UR-5eXR
R:XdXR
R;a,[R"[S5UR-5eURR(dSn[R"U5eU/n
[U5nUS-
nURU5nUR(a�URRunnnUR(a7URUUR UX�R"R$--5 OPURUUR X�R"R$-5 URUUR&U5 UR)U5UR)U5nnUc1[*R,"[.R1XS5US5nO[U5nU
c>SnUR2R4(aUR6n[8R:"UUS9n
Ub][U5S:XaNUR2R<(a"UR2R>(a[@nO[BnUSUSU4n[DRF"UUUU
UUU5nU
RIU5n[JnURLb2URLRNn[8RP"UU5nUunn[JnU(a�URRRT(a�[Vn[XRZ"U5nURLR\n URR_U5un!n"U!S	:waXU"SSS
:waO[U"5[U5:a7U!(aeU"SSURLRN:Xa	[`nU"nO
[JnU"nOSnSn [bn#URRRd(a�UU4[f[f4:XaSn#O�U[f:waU[f:XaSURiU5-n#O�U[f:XaU[f:waSURiU5-n#O�[jb=UR"Rl(a"[jRoUR"UU5n#OK[qUU45un$n%SURiU%5-n#U#[sSURuU%/U$/555-
n#[DRv"UUURxUUURzUUUUU [U5UU#S
9n&UR"R}U&5 UR"RU5n'US:XaFURLc9UR�UR�-n(UR"R�U(5n(U(U'-n'UR�UU'UR�UUUU 5 U
SnU	(aUcU
R�U5n[�U5[�:XaXU4URlHUR�UR�U'U$)a�internal function to add revisions to the log

see addrevision for argument descriptions.

note: "addrevision" takes non-raw text, "_addrevision" takes raw text.

if "deltacomputer" is not provided or None, a defaultdeltacomputer will
be used.

invariants:
- rawtext is optional (can be None); if not set, cachedelta must be set.
  if both are set, they must correspond to each other.
s %s: attempt to add null revisions %s: attempt to add wdir revisionr�rNr��write_debugr�r5r4rRc3�&# �UHnSv� M	 g7f)rNrK)r^rs  rOr`�&revlog._addrevision.<locals>.<genexpr>K
s���P�+O�a��+O�s�)rp�data_offset�data_compressed_length�data_uncompressed_length�data_compression_mode�data_delta_base�link_rev�parent_rev_1�parent_rev_2�node_idr��sidedata_compressed_length�sidedata_compression_moder)Kr�r3r.rr�r�r�r�r*rHrBr��_get_data_offsetrPr�r�r:r�rWr;r�r4�patchedsizerHror�r��_reportr�rTr�r�rrr7�revisioninfo�
finddeltainforrHr��delta_compressionr�r�rr��serialize_sidedatar]r6rrr�rrr�r:r�sorted�sumrwr
�deltalenrrryr1r2rz�_writeentryr�	buildtextrcrkr�rrG))r�r]r�r[r�rrrprS�alwayscacherTrCrE�btextr��prevr�r^r_r`�p1r�p2r�textlenrf�delta_base_reuse�revinfo�	deltainfor��default_comprars�serialized_sidedatar��h�
comp_sidedatar�pmin�pmaxrr
r|s)                                         rOr]�revlog._addrevision�s���6�;�;���#�#��5�6����H��
�
�&�&�-�-�-��)�)�9�9�9��#�#��5�6����H��
��{�{�%�%�F�C��(�(��-�-��	���4�y���a�x���&�&�t�,���#�#�!�[�[�8�8�N�C��d��|�|��(�(�����&�4�*�*�:O�:O�3O�*O��
�(�(�����$���1F�1F�*F���(�(��d�n�n�f�E��8�8�B�<����"��S���?��'�'����D�Q�-�0�*�Q�-��G��'�l�G�� ��K�� � �,�,�)�1�1��%�3�3��+��M��!�c�*�o��&:�
�!�!�/�/��%�%�5�5�#7� �#6� �$�Q�-��A��8H�I�J��*�*��������
��"�/�/��8�	�+���<�<�#��<�<�B�B�L��+�+�L�)�D�A�*+�'��i�$4�!���+�+�9�9�(7�%�".�"A�"A�(�"K��"�l�l�7�7�O�#�{�{�3�3�4G�H��A�}��T�	�!�!�A�&�%�/��
�&��-@�)A�A���u�!�!�A�&��|�|�>�>�?�1B�-�*7�'�0@�-�*7�'��"%�� �O������+�+��S�z�g�w�/�/������C�7�N��4�>�>�#�.�.�����C�7�N��4�>�>�#�.�.���(�T�Z�Z�-G�-G�$�>�>�$�*�*�c�3�?�D�!'��c�
�!3�J�D�$��t�~�~�d�3�3�D��C�P�4�+?�+?�����+O�P�P�P�D������#,�#5�#5�%,�"2�%�N�N�����+�'*�+>�'?�&?��
��"	
�
�
���!���
�
�'�'��-���1�9����-��'�'�$�*>�*>�>�F��Z�Z�+�+�F�3�F��U�N�E�������N�N�����	
���(���7�?�#�-�-�g�6�G���=�E�!�*.�g�)>�D�K�K�&�%.�%8�%8����T�"��rRc�j�URcURU5$URR$)a�Returns the current offset in the (in-transaction) data file.
Versions < 2 of the revlog can get this 0(1), revlog v2 needs a docket
file to store that information: since sidedata can be rewritten to the
end of the data file within a transaction, you can have cases where, for
example, rev `n` does not have sidedata while rev `n - 1` does, leading
to `n - 1`'s sidedata being written after `n`'s data.

TODO cache this in a docket file before getting out of experimental.)rHr�r\)r�r�s  rOrt�revlog._get_data_offsetx
s,���<�<���8�8�D�>�!��<�<�(�(�(rRc���S=n=p�URbBURRnURRn	URRn
URRUUUUUUUUU	U
5
nUR
U5 URb<USURlUSURlUSURl[R"X5 g)Nrrr�)	rHrjr\r]r*r�rCrCr�)r�r[r
rr�r�rCr�rjr\r]�	files_ends            rOr~�revlog._writeentry�
s���,/3�2�	�2�H��<�<�#����.�.�I��|�|�,�,�H��<�<�4�4�L��K�K�+�+�����������
�	�	
����,��<�<�#�%.�q�\�D�L�L�"�$-�a�L�D�L�L�!�(1�!��D�L�L�%��,�,�[�?rRc	�,�UR(a[R"S5eUcCURR(a"URR
(a[nO[nSUlSn	URU5 Sn
URR(aURn
[R"UU
US9nUGHnUun
nnnnnnnU"U5nU=(d [nURRU
5nUb&UR!UU5 U(a	U"UU5 Sn	MjX�4HNnURR#U5(aM%[R$"UUR&[)S55e URR#U5(d+[R$"UUR*[)S55eUR-U5nU[.:wa�UR1U5(a�[2R4"S5nUR7U5n[9U5U-
nUSU[:R<"UU5:wa0[R>"UR*URAU55eU(d URCUU5(a	U[D-nURGU
SUUUUUUUU4UUUS	9nU(a	U"UU5 Sn	GM SSS5 SUlU	(+$!,(df   N=f!SUlf=f)
a$
add a delta group

given a set of deltas, add them to the revision log. the
first delta is against its parent, which should be in our
log, the rest are against the previous delta.

If ``addrevisioncb`` is defined, it will be called with arguments of
this revlog and the node that was added.
scannot nest addgroup() callsNT)rf�
debug_infoFsunknown parentsunknown delta bases>lll)r�rTrC)$rMr3rBr�r�r�rrrLr�rvr�rTr(r�rWrF�has_noderr9rr�r�r�
iscensored�struct�calcsizer�r�r4�replacediffheader�CensoredBaseErrorr]�_peek_iscensoredr-r])r�r<�
linkmapperr[r��
addrevisioncb�duplicaterevisioncbr��delta_base_reuse_policy�emptyrfrTrr]rrrt�	deltabaserrrprCr�r�rir��hlen�oldlen�newlens                            rO�addgroup�revlog.addgroup�
s���,����(�(�)H�I�I�#�*��!�!�/�/��%�%�5�5�*>�'�*=�'�!�����X	'����{�+�"���$�$�0�0�"-�"5�"5�K� )� 7� 7�� +�)�!�
�#�D��	���� �!��� �%�h�/�D�!�9�%9�E��*�*�,�,�T�2�C����3�3�K��E�.�/��c�:� %�� � �X��#�z�z�2�2�1�5�5�"'�"3�"3� !�4�:�:�q�1B�/C�#��&� �:�:�.�.�y�9�9�#�/�/�%�t����:O�8P���#�h�h�y�1�G��'�)�d�o�o�g�.F�.F� &���w�7��!%���g�!6��!$�U��d�!2�� ��$�<�5�+B�+B�"�F�,��#(�"9�"9� $������7�1C�#��!�T�%:�%:�7�E�%J�%J��!2�2���+�+���#����� �%�)@�A�$/�&3�!)�,��C�%�%�d�C�0�!�E�W#�,�n"'�D���y��q,�+��n"'�D��s,�8L
�	CK9�FK9�#L
�9
L�L
�
	Lc�j�URR(dgURU5[-$)z%Check if a file revision is censored.F)r�r�rpr-r�s  rOr��revlog.iscensored7s(���"�"�-�-���z�z�#��!2�2�2rRc�|�URR(dg[R"X!UR5$)z6Quickly check if a delta produces a censored revision.F)r�r�rD�deltaiscensoredr�)r�r�rrs   rOr��revlog._peek_iscensored>s+���"�"�-�-���*�*�5�4�<�<�H�HrRc��[R"U[U5S-
UR5URUR
5$)z�find the minimum rev that must be stripped to strip the linkrev

Returns a tuple containing the minimum rev and a set of all revs that
have linkrevs that will be broken by this strip.
r)rD�resolvestripinfor�rtr�r")r��minlinks  rO�
getstrippoint�revlog.getstrippointEs<���+�+����I��M��M�M�O��L�L��O�O�
�	
rRc�:�[U5S:XagURU5up4U[U5:XagURU5nUR(d5UR	UR
U5 X0RR-nOXSURR--nUR(a-URU5nUR	URU5 UR	URU5 URbKX`RlXPRl
WURlURRUSS9 [ R""S5UlUR&R)5 URUS2	g)a�truncate the revlog on the first revision with a linkrev >= minlink

This function is called when we're stripping revision minlink and
its descendants from the repository.

We have to remove all revisions with linkrev >= minlink, because
the equivalent changelog revisions will be renumbered after the
strip.

So we truncate the revlog on the first of these revisions, and
trust that the caller has saved the revisions that shouldn't be
removed and that it'll re-add them after this truncation.
rNT)�	strippingr�r�)r�r�r�r�rYr;r�rWr<rr:rHrjr\r]rvr9r�r�r*r�)r�r�r[r�rr\r�r]s        rO�strip�revlog.stripSs;���t�9��>���#�#�G�,����#�d�)����:�:�c�?���|�|��O�O�D�N�N�H�5��
�
�-�-�-�C��D�J�J�$9�$9�9�:�C�����0�0��5�L��O�O�D�.�.��=��������-��<�<�#�&)�L�L�"�$,�L�L�!�(4�D�L�L�%��L�L���{�d��;� $�0�0��5��������!��J�J�s�2�v�rRc�4�Sn[U5(a'[SUR[U5S-
55nUR5nUR	S[
R5 UR5nSSS5 WU-
nURUR5nUR	S[
R5 UR5nUR5 URRn[SX5-5nX6U--
nUR(a?SnUH!n	U[SURU	55-
nM# SnU[U5U--
U-
nXG4$!,(df   N�=f![a SnN�f=f![a SnXG4$f=f)z�Check size of index and data files

return a (dd, di) tuple.
- dd: extra bytes for the "data" file
- di: extra bytes for the "index" file

A healthy revlog will return (0, 0).
rrN)r�r~r�r�rR�iorTr�rVr�r:rZr�rWr�r�)
r��expectedrk�actual�dd�sr��di�	databytesras
          rO�	checksize�revlog.checksize�s`�����t�9�9��1�d�h�h�s�4�y�1�}�5�6�H�	�����1����q�"�+�+�&������ ��(�"�B�	����D�O�O�,�A�
�F�F�1�b�k�k�"��V�V�X�F�
�G�G�I��
�
�%�%�A��A�v�{�#�A��q�5�!�B��|�|��	��A���Q����A��!7�7�I�����c�$�i�!�m�+�i�7���x��1 ���!�	��B�	��"!�	��B��x��	�s<�E4�1E#�<
E4�
CF�#
E1�-E4�4F�F�F�Fc��UR/nURc.UR(dURUR5 U$URUR5 URURRSS95 URR(aURUR5 URURRSS95 URR(aURUR5 URURRSS95 U$)z-return list of files that compose this revlogF)�
include_empty)
r:r6r�rr;�extendrH�old_index_filepathsr\�old_data_filepathsr]r<�old_sidedata_filepaths)r��ress  rO�files�revlog.files�s�����������$��<�<��
�
�4�>�>�*��
�
�J�J�t�(�(�)��J�J�t�|�|�7�7�e�7�L�M��|�|�$�$��
�
�4�>�>�*��J�J�t�|�|�6�6�U�6�K�L��|�|�(�(��
�
�4�-�-�.��J�J�t�|�|�:�:��:�O�P��
rRc��US;a[R"SU-5eUcURR(dSnUR(d$U[
R:wa[
Rn[R"UUU[URURURURURUUUUUS9$)N)snodes�storageslinearNs"unhandled value for nodesorder: %sr�)
�
deltaparentfn�
candeltafn�	rawsizefn�	revdifffn�flagsfn�	deltamode�revisiondata�assumehaveparentrevisions�sidedata_helpersr�)r3rBr�r�r�r;�CG_DELTAMODE_PREV�CG_DELTAMODE_FULLrD�
emitrevisionsrarr�r�rrp)r��nodes�
nodesorderr�r�r�r�r�s        rOr��revlog.emitrevisions�s����D�D��(�(�5�
�B��
���d�&7�&7�&E�&E�#�J��&�&��Z�9�9�9�"�4�4�I��(�(������*�*��~�~��l�l��l�l��J�J��%�&?�-�!�
�	
rR�always�samerevs�never�fulladd>r�r�r�r�c
���X@R;a[[S5U-5e[U5(a[[S55e[	USS5(a[[S55e[	USS5(a[[S55eUR
nUR
R
5UlX@R:Xa#SUR
lSUR
l	OcX@R:Xa#SUR
lSUR
l	O1X@R:Xa"SUR
lSUR
l	U=(d URnX�R
lUR5 URU5 URUUUUUU5 SSS5 SSS5 Xrlg!,(df   N=f!,(df   N&=f!Xrlf=f)	a=Copy this revlog to another, possibly with format changes.

The destination revlog will contain the same revisions and nodes.
However, it may not be bit-for-bit identical due to e.g. delta encoding
differences.

The ``deltareuse`` argument control how deltas from the existing revlog
are preserved in the destination revlog. The argument can have the
following values:

DELTAREUSEALWAYS
   Deltas will always be reused (if possible), even if the destination
   revlog would not select the same revisions for the delta. This is the
   fastest mode of operation.
DELTAREUSESAMEREVS
   Deltas will be reused if the destination revlog would pick the same
   revisions for the delta. This mode strikes a balance between speed
   and optimization.
DELTAREUSENEVER
   Deltas will never be reused. This is the slowest mode of execution.
   This mode can be used to recompute deltas (e.g. if the diff/delta
   algorithm changes).
DELTAREUSEFULLADD
   Revision will be re-added as if their were new content. This is
   slower than DELTAREUSEALWAYS but allow more mechanism to kicks in.
   eg: large file detection and handling.

Delta computation can be slow, so the choice of delta reuse policy can
significantly affect run time.

The default policy (``DELTAREUSESAMEREVS``) strikes a balance between
two extremes. Deltas will be reused if they are appropriate. But if the
delta could choose a better revision, it will do so. This means if you
are converting a non-generaldelta revlog to a generaldelta revlog,
deltas will be recomputed if the delta's parent isn't a parent of the
revision.

In addition to the delta policy, the ``forcedeltabothparents``
argument controls whether to force compute deltas against both parents
for merges. By default, the current default is used.

See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
`sidedata_helpers`.
s value for deltareuse invalid: %ssdestination revlog is not emptyr�Ns$source revlog has filtered revisionss)destination revlog has filtered revisionsTF)�
DELTAREUSEALLr�rr�rr�r��DELTAREUSEALWAYSr�r��DELTAREUSESAMEREVS�DELTAREUSENEVERr�rCrL�_clone)	r�r{�
destrevlogr��
deltareuse�forcedeltabothparentsr��old_delta_configr�s	         rO�clone�revlog.clone�s���j�/�/�/���5�6��C��
��z�?�?��Q�A�B�C�C��4���.�.��Q�F�G�H�H��:�~�t�4�4��Q�K�L�M�M�&�2�2��",�"9�"9�">�">�"@�
��	7��2�2�2�:>�
�'�'�7�59�
�'�'�2��6�6�6�:?�
�'�'�7�59�
�'�'�2��3�3�3�:?�
�'�'�7�5:�
�'�'�2�&�L�)9�)L�)L�
�:L�#�#�6������!4�!4�R�!8������!��)�$�
�"9��'7�#�"9�!8�����'7�#�s=�C
G/�
G�G
�6G�>G/�
G	�G�
G,�(G/�/G7c�Z�SnURR(aURn[R"UUS9nUR
n	UGH�n
X�nUSS-nUSn
X�SSnX�SSnUSnSnSnX@R:XahURU
5nURU
5nUb*[R"XUU
5unnUUSUS	)--nURUUU
UUUUUUUS
9
 O�URR(aAURU
5nU[:wa&U[UR R#U
554nSnU(d#URU
5nURU
5nUcURU
5nUb*[R"XUU
5unnUUSUS	)--nUR-UUUU
UUUUUUS9
 U(dGM�U"X
U5 GM� g![$R&a&nU[(-(deUR*nSnAN�SnAff=f)zBperform the core duty of `revlog.clone` after parameter processingNrerr-r�r
r�rr)rSr]rprTrCr\)r�r�rvr�rTr��DELTAREUSEFULLADDrrCr��run_sidedata_helpersrYr�rrrkr*r�r3r!r-�	tombstoner])r�r{r�r�r�r�r�rfrTr�r�r
rpr�rrr]rSr�rNrC�	new_flags�dp�censoreds                        rOr��
revlog._cloneQss�������(�(��*�*�K�!�/�/��#�
�
��
�
���C��J�E��!�H�v�%�E��A�h�G��Q�x���#�B��Q�x���#�B���8�D��J��G��3�3�3��)�)�#�.���=�=��-��#�/�,8�,M�,M���#�-�)�X�y�"�I�a�L�I�a�L�=�$@�@�E��&�&������)���"/�%�'���*�*�5�5��)�)�#�.�B��W�}�&(�%����0B�0B�3�0G�*H�%I�
���!�5�"&�"4�"4�S�"9�� $�}�}�S�1�H��#�#�}�}�S�1�H�#�/�,8�,M�,M���#�-�)�X�y�"�I�a�L�I�a�L�=�$@�@�E��'�'���������"/�%�(���}��d��.�U��^!�2�2�5�$�'8�8�8�8�"*�"4�"4���5�s�G0�0H*�H%�%H*c�
�UR[:Xa,[R"[	S5UR-5eUR[
:Xa[R"XX#5 g[R"XX#5 g)Ns%cannot censor with version %d revlogs)	r2rr3r.rr rB�	v1_censor�	v2_censor)r�r{�censor_nodesr�s    rO�censorrevision�revlog.censorrevision�sj�����8�+��#�#��:�;��&�&�'��
��
!�
!�X�
-����d��@����d��@rRc	#��# �UR5up#U(a[[S5U-S9v� U(a[[S5U-S9v� URnXAS:wa&[[S5URXAS4-S9v� [5US'[5US'UH�nUR
U5nURS	S
5nU(aXpRU5-n[XX5 URU5n[URU55n	X�:wa[[S5X�4-US9v� M�M� g![Ra: US
(a,[[S5US9v� USRU5 M�M�[ aWn
[[S5[#U5[$R&"U
54-US9v� USRU5 Sn
A
GMESn
A
ff=f7f)znVerifies the integrity of the revlog.

Yields ``revlogproblem`` instances describing problems that are
found.
sdata length off by %d bytes)r3sindex contains %d extra bytessexpectedversions0warning: '%s' uses revlog format %d; expected %d)rzrXssafe_renameds	skipflagsrs unpacked size is %d, %d expected)r3r]serroroncensoredscensored file datasunpacking %s: %sN)r�rxrr2r�rJr]r�rpr^r�r�rr3r!rY�	Exceptionr
rEr=)r�r\r�r��versionr�r]r[�l1�l2rs           rO�verifyintegrity�revlog.verifyintegrity�s�������!���
��a�(F�&G�"�&L�M�M�
��a�(H�&I�B�&N�O�O��&�&���.�/�/���M�N��?�?�G�3E�-F�G�H��
�
!�U��k��!$���o���C��9�9�S�>�D�d
-�!�I�I�l�A�6�	�����C��0�I� ��%�>��\�\�#�&������d�+�,���8�'�� C�D��x�O�!����{��F�*�*�
1��+�,�'�� 5�6�T����+�&�*�*�4�0�	-�
�
-�#��/�0��T�{�J�$;�$;�A�$>�?�@����
�k�"�&�&�t�,�,��

-�s?�B9G4�<BE�=G4�AG1�G4�	G1�AG,�%G4�,G1�1G4c��^�0nU(aWTRTR4/US'TR(d*USRTRTR45 U(a/US'U(a[T5US'U(a+[
[TR[T555US'U(a&[
U4SjTR555US'U$)Nsexclusivefilesssharedfilessrevisionscountstrackedsizec3�n># �UH*nTRRU5Rv� M, g7fr|)r��statrh)r^rr�s  �rOr`�%revlog.storageinfo.<locals>.<genexpr><s)����#�;G�4���� � ��&�.�.�<�s�25s
storedsize)r�r:r�rr;r�r|r�r�r�r�)r��exclusivefiles�sharedfiles�revisionscount�trackedsize�
storedsizer�s`      rO�storageinfo�revlog.storageinfo#s����
���%)�[�[�$�/�/�$B�#C�A�� ��<�<��#�$�+�+�T�[�[�$�.�.�,I�J�� "�A�n���#&�t�9�A�� �� #�C����d�4�j�$A� B�A�n���"�#�;?�:�:�<�#� �A�m���rRc	��URR(dgUR(aeUS(dUS(dg/nURU5 URR
upgnUR
URR[R5 UR5n	[X4S-5GH�n
URU
n[R"UU0U
S9up�[R "U5n["nU(a�URR(a�[$nURR'U5unnUS:waXUSS:waO[)U5[)U5:a7U(aeUSURR*:Xa	[,nUnO["nUnUSS:wd	USS:waS	n[.R0"U5eUSU
SU
S)--nU	[)U5UU4nUR
U	[R5 UR3U5 UR5U5 U	[)U5-
n	UR5URlGM� UR
X0RR6-5 [9U5H�unnUU-n
URR:"U
/UQ76 URR=U
5nU
S:XaFURc9UR>UR@-nURRCU5nUU-nUR3U5 M� SSS5 g!,(df   g=f)
Nrr�)�storer�rCr�r5rr4r�r�s0rewriting existing sidedata is not supported yet)"r�r�r�rLr*r�rRrHr]rSrUr�rur�r�r�rzrrr6r�r�rr3�AbortrvrrW�	enumerate�replace_sidedata_inforyr1r2rz)r�r[�helpersr�r��new_entriesr^r_r`�current_offsetr�r
�new_sidedatarpr�rsr�r�rE�new_offset_flags�entry_updater�r�packedr|s                         rO�rewrite_sidedata�revlog.rewrite_sidedataBs����"�"�0�0���<�<����q�z�'�!�*����
�]�]�;�
'�!�[�[�8�8�N�C�d��H�H�T�\�\�.�.����<�!�Y�Y�[�N��X��z�2���
�
�3���&2�&G�&G��%,���	'�#��'3�&E�&E� �'�#�-=�)�&�4�+>�+>�+L�+L�0?�-�'+�{�{�';�';�<O�'P�$�A�}��T�	�)�!�,��5��
�.��5H�1I�I�#$��u�)�!�,�#�|�|�F�F�G�9J�5�2?�/�8H�5�2?�/���8�q�=�E�!�H��M�N�C��+�+�c�*�*�$)��8�e�A�h�%��(��.B�#B� �"��+�,�$�-�	 ���	�	�.�"�+�+�6��
�
�.�/��"�"�<�0��#�&9�":�:��,0�I�I�K����)�m3�r
�H�H�X�
�
� 5� 5�5�6�!�+�.���1���l���
�
�0�0��������0�0��5���!�8���� 4�!�/�/�$�2F�2F�F�F�!�Z�Z�3�3�F�;�F�#�f�_�F��	�	�&�!�/�(�
'�
'�s
�K-M�
M)#rMrGr�rPr;rHr6rLr1r2r:r�r�r*rArIr=r�rJr<r�r@r?r�r�r�r�r	r�r�r�r>r9rErB)NFFFNFNFFTNNNTr�r|)F)rv)r�z
Iterator[int])rN)r�r�r��None)rFr�)r)NNNr�)FNN)FNNNN)rR)r�z#Iterable[repository.iverifyproblem])FFFFF)�rfrgrhrir�r3r.�_flagserrorclassr��staticmethodr4r�rdrqr�rNrOr�r�r9r�rZr�r�r�r�rr�r�r�r�r�r�r�r�r�rrpr�rr�rorrr�r"r=r]r�r)r-r,rr@rDrkrprwrzr�rtr�r�r�rbr�r�r�r�r�r�r�r1r�r�r�r�r�rr	r�rrZrCr
rr
rrrr�r�rCrFr�r�rCrLr�rKr(rYrXr6r&r]rtr~r�r�r�r�r�r�r�r;�CG_DELTAMODE_STDr�r�r�r�r�r�r�r�r�r�r	rrurKrRrOrHrH$s���+�Z�(�(�������2��2�"�!����������#�����%`6��`6�D9=�v�8i�V`!�D9+�v�(�
������
������6�#�(�$��&�G���	H��,
J�&-��"+�"�"�
�'��$
�"�&�&���2�*�'��>=�N�*F�>:�@M� +�0C�4^*�@?�N�
�
;�0�2N��1��(�
I��� �D@�DK�45�lB���8�	F�-�#�"�"*�X7�7�:�"�H�(��(�$M7�^?����������4��4�,�'��'�(� �
�"���L
�n����>*�,����K�Z)�.@�j�� �� $��B3�I�
�.�`&�P�(��"'��-�-���'
�R!��$���O�"��B�M��%�"��b7�H\/�|	A�g-�V�����
�>T"rR)�r��
__future__rr/rcr�r�rSr��typingr:r<rrrrr]r	r
rrr
r�i18nr�revlogutils.constantsrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'�revlogutils.flagutilr(r)r*r+r,r-r.�
thirdpartyr/�
TYPE_CHECKING�pure.parsersr0�r1r2r3r4r5r6r7r8r9r:r��
interfacesr;r<r�r=r�r>r?rCr@rArBrCr��utilsrDrE�	importmodrF�
importrustr9r�r�r&r;r7rPrTrVr[r^r�HAS_FAST_PERSISTENT_NODEMAPr��irevisiondeltara�iverifyproblemrxr�r�r�r�rVr�r�r�r�r�r�r��	ProxyBase�objectr�rrHrKrRrO�<module>r/s����#����	�	�
�
���������������4����
����-�����	�	�	��	������������������
�
�
�9�
%��� � ��$�7�����g�D�1�	�
�
�
�x�d�
3�
��/�/���
����
������)��4����
�9��
���d��;�*�3�3�;��;����t��7�J�-�-�7��7�����7�/�0�0��"��
�
��;���

&�	�/�/�
�����G��
��:���� *�� *�
� *�F����-�'�-�
�-�<x
)�x
)�v
����I��I�2�Y�2�@)�)�4r-"�r-"rR