403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.208
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/breezy/bzr/__pycache__/knit.cpython-313.pyc
�

p��g�X���SrSSKrSSKrSSKJr SSKJr \"\"5S5 SSKJrJ	r	J
r
 SSKJr SS	K
JrJrJrJrJrJrJrJrJr SS
K	JrJrJr SSK
JrJrJr SSKJr S
SKJr Sr Sr!Sr""SS\5r#"SS\#5r$"SS\$5r%"SS\#5r&"SS\#5r'"SS\#5r("SS\#5r)"S S!5r*"S"S#\*5r+"S$S%\*5r,"S&S'\*5r-"S(S)\*5r."S*S+\*5r/"S,S-\*5r0"S.S/\5r1"S0S1\5r2S2r3S3r4"S4S55r5"S6S7\55r6"S8S9\55r7"S:S;5r8"S<S=\85r9"S>S?\85r:S@r;SAr<SBr=SCr>"SDSE\5r?"SFSG5r@"SHSI\@5rA"SJSK\@5rB"SLSM5rCSNrD"SOSP5rE"SQSR5rFSSrG"STSU\R�5rIS
SVKJJKrL g!\Ma"rN\
R�"\N5 S
SWKPJQrL SrNCNgSrNCNff=f)XakKnit versionedfile implementation.

A knit is a versioned file implementation that supports efficient append only
updates.

Knit file layout:
lifeless: the data file is made up of "delta records".  each delta record has a delta header
that contains; (1) a version id, (2) the size of the delta (in lines), and (3)  the digest of
the -expanded data- (ie, the delta applied to the parent).  the delta also ends with a
end-marker; simply "end VERSION"

delta can be line or full contents.a
... the 8's there are the index number of the annotation.
version robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad 7 c7d23b2a5bd6ca00e8e266cec0ec228158ee9f9e
59,59,3
8
8         if ie.executable:
8             e.set('executable', 'yes')
130,130,2
8         if elt.get('executable') == 'yes':
8             ie.executable = True
end robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad


whats in an index:
09:33 < jrydberg> lifeless: each index is made up of a tuple of; version id, options, position, size, parents
09:33 < jrydberg> lifeless: the parents are currently dictionary compressed
09:33 < jrydberg> lifeless: (meaning it currently does not support ghosts)
09:33 < lifeless> right
09:33 < jrydberg> lifeless: the position and size is the range in the data file


so the index sequence is the dictionary compressed sequence number used
in the deltas to provide line annotation

�N)�BytesIO�)�lazy_importz�
import patiencediff
import gzip

from breezy import (
    debug,
    diff,
    trace,
    tsort,
    ui,
    )
from breezy.bzr import (
    pack,
    tuned_gzip,
    )

from breezy.bzr import pack_repo
from breezy.i18n import gettext
)�annotate�errors�osutils)�	transport)	�AbsentContentFactory�ConstantMapper�ContentFactory�ExistingContent�UnavailableRepresentation�VersionedFilesWithFallbacks�_KeyRefs�adapter_registry�sort_groupcompress)�InternalBzrError�InvalidRevisionId�RevisionNotPresent)�contains_whitespace�
sha_string�sha_strings)�
NoSuchFile�)�index�.knit�.kndxiPc��\rSrSrSrSrg)�	KnitError�vz
Knit error�N)�__name__�
__module__�__qualname__�__firstlineno__�_fmt�__static_attributes__r!��1/usr/lib/python3/dist-packages/breezy/bzr/knit.pyrrvs���Dr(rc��\rSrSrSrSrSrg)�KnitCorrupt�zz"Knit %(filename)s corrupt: %(how)sc�F�[RU5 XlX lg�N)r�__init__�filename�how)�selfr0r1s   r)r/�KnitCorrupt.__init__}s�����4� � �
��r()r0r1N�r"r#r$r%r&r/r'r!r(r)r+r+zs��/�D�r(r+c��\rSrSrSrSrSrg)�SHA1KnitCorrupt�z�Knit %(filename)s corrupt: sha-1 of reconstructed text does not match expected sha-1. key %(key)s expected sha %(expected)s actual sha %(actual)sc�j�[RU5 XlX lX0lX@lXPlgr.)rr/r0�actual�expected�key�content)r2r0r9r:r;r<s      r)r/�SHA1KnitCorrupt.__init__�s)�����4� � �
��� �
����r()r9r<r:r0r;Nr4r!r(r)r6r6�s��	�	�r(r6c��\rSrSrSrSrSrg)�KnitDataStreamIncompatible�zeCannot insert knit data stream of format "%(stream_format)s" into knit of format "%(target_format)s".c��XlX lgr.��
stream_format�
target_format)r2rCrDs   r)r/�#KnitDataStreamIncompatible.__init__�s��*��*�r(rBNr4r!r(r)r?r?�s��s�D�+r(r?c��\rSrSrSrSrSrg)�KnitDataStreamUnknown�z<Cannot parse knit data stream of format "%(stream_format)s".c��Xlgr.�rC)r2rCs  r)r/�KnitDataStreamUnknown.__init__�s��*�r(rJNr4r!r(r)rGrG�s��J�D�+r(rGc��\rSrSrSrSrSrg)�KnitHeaderError�zBKnit header error: %(badline)r unexpected for file "%(filename)s".c�F�[RU5 XlX lgr.)rr/�badliner0)r2rPr0s   r)r/�KnitHeaderError.__init__�s�����4� ��� �
r(�rPr0Nr4r!r(r)rMrM�s��O�D�!r(rMc�"�\rSrSrSrSrSrSrg)�KnitIndexUnknownMethod�zoRaised when we don't understand the storage method.

Currently only 'fulltext' and 'line-delta' are supported.
zLKnit index %(filename)s does not have a known method in options: %(options)rc�F�[RU5 XlX lgr.)rr/r0�options)r2r0rWs   r)r/�KnitIndexUnknownMethod.__init__�s�����4� � �
��r()r0rWN)r"r#r$r%�__doc__r&r/r'r!r(r)rTrT�s���	W�	�r(rTc��\rSrSrSrSrSrg)�KnitAdapter�z$Base class for knit record adaption.c�n�[SS5Ul[5Ul[	5UlXlg)z�Create an adapter which accesses full texts from basis_vf.

:param basis_vf: A versioned file to access basis texts of deltas from.
    May be None for adapters that do not need to access basis texts.
N)�KnitVersionedFiles�_data�KnitAnnotateFactory�_annotate_factory�KnitPlainFactory�_plain_factory�	_basis_vf)r2�basis_vfs  r)r/�KnitAdapter.__init__�s-��(��d�3��
�!4�!6���.�0���!�r()rardr_rcN�r"r#r$r%rYr/r'r!r(r)r[r[�s
��.�	"r(r[c��\rSrSrSrSrSrg)�FTAnnotatedToUnannotated���7An adapter from FT annotated knits to unannotated ones.c�f�US:wa [URX!R5eURnURRU5upEURRXTS5nURRUS4USUR55upxSRU5$)N�
knit-ft-gzr�r()rr;�storage_kind�_raw_recordr_�_parse_record_uncheckedra�parse_fulltext�_record_to_data�text�join)	r2�factory�target_storage_kind�annotated_compressed_bytes�rec�contentsr<�size�chunkss	         r)�	get_bytes�"FTAnnotatedToUnannotated.get_bytes�s����,�.�+����0�2F�2F��
�&-�%8�%8�"��
�
�:�:�;U�V�
���(�(�7�7��a�&�I���z�z�1�1�3�q�6�)�S��V�W�\�\�^�T����x�x���r(r!N�r"r#r$r%rYr}r'r!r(r)riri�s
��A�	 r(ric��\rSrSrSrSrSrg)�DeltaAnnotatedToUnannotated���4An adapter for deltas from annotated to unannotated.c�~�US:wa [URX!R5eURnURRU5upEURRXTSSS9nURRU5nURRUS4USU5upxSRU5$)N�
knit-delta-gzrT��plainrnr()rr;rorpr_rqra�parse_line_deltarc�lower_line_deltarsru)	r2rvrwrxryrz�deltar{r|s	         r)r}�%DeltaAnnotatedToUnannotated.get_bytes�s����/�1�+����0�2F�2F��
�&-�%8�%8�"��
�
�:�:�;U�V�
���&�&�7�7��a�&�PT�7�U���&�&�7�7��>���z�z�1�1�3�q�6�)�S��V�X�N����x�x���r(r!Nrr!r(r)r�r��s
��>�
 r(r�c��\rSrSrSrSrSrg)�FTAnnotatedToFullText��rkc�v�URnURRU5upEURR	UR
SXQRS5upgUS:XaSRUR55$US;aUR5$[UR
X!R5e�N����fulltextr(��chunked�lines)rpr_rqra�parse_recordr;�_build_detailsrurtrro)r2rvrwrxryrzr<r�s        r)r}�FTAnnotatedToFullText.get_bytes�s���%,�%8�%8�"��
�
�:�:�;U�V�
���/�/�<�<��K�K��O�X�'=�'=�t�
����*�,��8�8�G�L�L�N�+�+�
 �$8�
8��<�<�>�!�'��K�K�,�.B�.B�
�	
r(r!Nrr!r(r)r�r��s
��A�
r(r�c��\rSrSrSrSrSrg)�DeltaAnnotatedToFullText�r�c��URnURRU5upEURR	XTSSS9nUR
Sn[
URRU/SS55nURS:Xa [R"XpR5eURS5n	[X�5n
U
RXdS5 URSU
lUS:XaS	R#U
R%55$US
;aU
R%5$['UR(X!R5e)NrTr�r�	unordered�absentr�r�r(r�)rpr_rqrar��parents�nextrd�get_record_streamrorr�get_bytes_as�PlainKnitContent�apply_deltar��_should_strip_eolrurtrr;)r2rvrwrxryrzr��compression_parent�basis_entry�basis_lines�
basis_contents           r)r}�"DeltaAnnotatedToFullText.get_bytess5��%,�%8�%8�"��
�
�:�:�;U�V�
���&�&�7�7��a�&�PT�7�U��$�_�_�Q�/����N�N�,�,�.@�-A�;�PT�U�
���#�#�x�/��+�+�,>���O�O�!�.�.�w�7��)��I�
��!�!�%�Q��0�*1�*@�*@��*C�
�'��*�,��8�8�M�.�.�0�1�1�
 �$8�
8� �%�%�'�'�'��K�K�,�.B�.B�
�	
r(r!Nrr!r(r)r�r�s
��>�
r(r�c��\rSrSrSrSrSrg)�FTPlainToFullTextiz3An adapter from FT plain knits to unannotated ones.c�v�URnURRU5upEURR	UR
SXQRS5upgUS:XaSRUR55$US;aUR5$[UR
X!R5er�)rpr_rqrcr�r;r�rurtrro)r2rvrw�compressed_bytesryrzr<r�s        r)r}�FTPlainToFullText.get_bytes s���"�.�.���
�
�:�:�;K�L�
���,�,�9�9��K�K��O�X�'=�'=�t�
����*�,��8�8�G�L�L�N�+�+�
 �$8�
8��<�<�>�!�'��K�K�,�.B�.B�
�	
r(r!Nrr!r(r)r�r�s
��=�
r(r�c��\rSrSrSrSrSrg)�DeltaPlainToFullTexti/r�c��URnURRU5upEURR	XTS5 UR
Sn[
URRU/SS55nURS:Xa [R"X`R5eURS5n[X�5n	URRUSXQRU	5up�US:XaSR!U
R#55$US	;aU
R#5$[%UR&X!R5e)
Nrrr�Tr�r�r�r(r�)rpr_rqrcr�r�r�rdr�rorrr�r�r�r�rurtrr;)r2rvrwr�ryrzr�r�r�r�r<�_s            r)r}�DeltaPlainToFullText.get_bytes2s-��"�.�.���
�
�:�:�;K�L�
�����,�,�X�1�v�>�$�_�_�Q�/����N�N�,�,�.@�-A�;�PT�U�
���#�#�x�/��+�+�,>���O�O�!�.�.�w�7��(��I�
��(�(�5�5���F�H�4�4�m�
�
���*�,��8�8�G�L�L�N�+�+�
 �$8�
8��<�<�>�!�'��K�K�,�.B�.B�
�	
r(r!Nrr!r(r)r�r�/s
��>�
r(r�c�8�\rSrSrSrS	SjrSrSrSrSr	g)
�KnitContentFactoryiMzDContent factory for streaming from knits.

:seealso ContentFactory:
Nc	���[R"U5 X@lXlX lUSS:XaSn	OSn	U(aSn
OSn
SRX�5UlXPlX�lX0l	Xpl
g)	a�Create a KnitContentFactory for key.

:param key: The key.
:param parents: The parents.
:param build_details: The build details as returned from
    get_build_details.
:param sha1: The sha1 expected from the full text of this object.
:param raw_record: The bytes of the knit data from disk.
:param annotated: True if the raw data is annotated.
:param network_bytes: None to calculate the network bytes on demand,
    not-none if they are already known.
r�
line-deltar��ft�
annotated-�zknit-{}{}-gzN)rr/�sha1r;r��formatrorp�_network_bytesr��_knit)r2r;r��
build_detailsr��
raw_record�	annotated�knit�
network_bytes�kind�annotated_kinds           r)r/�KnitContentFactory.__init__Sso��.	����%��	��������|�+��D��D��)�N��N�*�1�1�.�G���%��+��+���
r(c�6�SRUR5nURcSnO"SRSUR55nURS(aSnOSnS	URRS
5UUUUR4-nX@lg)z;Create a fully serialised network version for transmission.�N�None:�	c3�D# �UHnSRU5v� M g7f�r�N�ru��.0r;s  r)�	<genexpr>�;KnitContentFactory._create_network_bytes.<locals>.<genexpr>�s���%P�<�C�g�l�l�3�&7�&7�<��� r�N� s
%s
%s
%s
%s%s�ascii)rur;r�r�ro�encoderpr�)r2�	key_bytes�parent_bytes�noeolr�s     r)�_create_network_bytes�(KnitContentFactory._create_network_bytes|s����L�L����*�	��<�<��#�L� �:�:�%P�4�<�<�%P�P�L����q�!��E��E�+����$�$�W�-�������/
�
�
�,�r(c�*�XR:Xa)URcUR5 UR$SUR;aCUS;a=URU4n[R"U5nU"S5nURX5$URb\US;a(URRURS5$US:Xa(URRURS5$[URXR5e)Nz-ft-�r�r�r�r�rr�)ror�r�r�getr}r��	get_linesr;�get_textr)r2ro�adapter_key�adapter_factory�adapters     r)r��KnitContentFactory.get_bytes_as�s����,�,�,��"�"�*��*�*�,��&�&�&��T�&�&�&�<�<
�,
�
 �,�,�l�;�K�.�2�2�;�?�O�%�d�+�G��$�$�T�8�8��:�:�!��3�3��z�z�+�+�D�H�H�Q�K�8�8���+��z�z�*�*�4�8�8�A�;�7�7�'����,�@Q�@Q�R�Rr(c�6�[URU55$r.)�iterr�)r2ros  r)�
iter_bytes_as� KnitContentFactory.iter_bytes_as�s���D�%�%�l�3�4�4r()r�r�r�rpr;r�r�ro�NN)
r"r#r$r%rYr/r�r�r�r'r!r(r)r�r�Ms%�����'�R,�*S�.5r(r�c�*�\rSrSrSrSrSrSrSrg)�LazyKnitContentFactoryi�z_A ContentFactory which can either generate full text or a wire form.

:seealso ContentFactory:
c��XlX lSUlSUlX0lSUlU(dUR
S-UlX@lg)ajCreate a LazyKnitContentFactory.

:param key: The key of the record.
:param parents: The parents of the record.
:param generator: A _ContentMapGenerator containing the record for this
    key.
:param first: Is this the first content object returned from generator?
    if it is, its storage kind is knit-delta-closure, otherwise it is
    knit-delta-closure-ref
Nzknit-delta-closurez-ref)r;r�r�r{�
_generatorro�_first)r2r;r��	generator�firsts     r)r/�LazyKnitContentFactory.__init__�sD��������	���	�#��0���� $� 1� 1�F� :�D���r(c�\�XR:Xa,UR(aURR5$gUS;aLURR	UR
5R
5nUS;aU$SRU5$[UR
XR5e)Nr(r�r�)	ror�r��_wire_bytes�
_get_one_workr;rtrur�r2ror|s   r)r��#LazyKnitContentFactory.get_bytes_as�s����,�,�,��{�{����2�2�4�4���;�;��_�_�2�2�4�8�8�<�A�A�C�F��3�3��
��x�x��'�'�'����,�@Q�@Q�R�Rr(c���US;a>URRUR5R5n[	U5$[
R"URXR5e)Nr�)r�r�r;rtr�rrror�s   r)r��$LazyKnitContentFactory.iter_bytes_as�sX���/�/��_�_�2�2�4�8�8�<�A�A�C�F���<���.�.��H�H�l�$5�$5�
�	
r()r�r�r;r�r�r{roN)	r"r#r$r%rYr/r�r�r'r!r(r)r�r��s���
�*S� 
r(r�c�8�[X5nUR5$)z�Convert a network record to a iterator over stream records.

:param storage_kind: The storage kind of the record.
    Must be 'knit-delta-closure'.
:param bytes: The bytes of the record on the network.
)�_NetworkContentMapGeneratorr�)ro�bytes�line_endr�s    r)�knit_delta_closure_to_recordsr��s��,�E�<�I��&�&�(�(r(c
���UnURSU5n[XURS55nUS-nURSU5nXUnUS:XaSnOL[URS5Vs/sH&nU(dM[URS55PM( sn5nUS-nXUS-S:HnSU;aS	n	OS
n	X�4n
US-nXSnSU;n[UUU
SUUUS9/$s snf)
z�Convert a network record to a record object.

:param storage_kind: The storage kind of the record.
:param bytes: The bytes of the record on the network.
�
r�rr�Nr�r�r�r�r�r�)r�)�find�tuple�splitr�)
ror�r��startr;�parent_liner��segmentr��methodr�r�r�s
             r)�knit_network_to_recordr�s'��
�E��z�z�%��'�H�
��H�%�+�+�G�4�
5�C��q�L�E��z�z�%��'�H��h�'�K��h����� +�0�0��7�
�7�G��.��g�m�m�G�,�-�7�
�
��
�q�L�E��%�!�)�$��,�E��|�������O�M��A�I�E��v��J��|�+�I���������	
�
�
��!
s�-C�<Cc�@�\rSrSrSrSrSrSrSr\	S5r
Srg	)
�KnitContentiz�Content of a knit version to which deltas can be applied.

This is always stored in memory as a list of lines with \\n at the end,
plus a flag saying if the final ending is really there or not, because that
corresponds to the on-disk knit representation.
c��SUlg)NF�r��r2s r)r/�KnitContent.__init__ s
��!&��r(c�,�[UR5e)�4Apply delta to this object to become new_version_id.)�NotImplementedErrorr�)r2r��new_version_ids   r)r��KnitContent.apply_delta#s��!�$�"2�"2�3�3r(c#��# �UR5nUR5n[RSX25nUR5H$upVpxn	US:XaMXgX�-
URX�4v� M& g7f)z9Generate line-based delta from this content to new_lines.N�equal)rt�patiencediff�PatienceSequenceMatcher�get_opcodes�_lines)
r2�	new_lines�	new_texts�	old_texts�s�tag�i1�i2�j1�j2s
          r)�line_delta_iter�KnitContent.line_delta_iter'si����N�N�$�	��I�I�K�	��0�0��y�L��#$�=�=�?��C�R�R��g�~���"�'�9�#3�#3�B�#:�:�:�	$3�s�A0A2c�6�[URU55$r.)�listr#)r2rs  r)�
line_delta�KnitContent.line_delta2s���D�(�(��3�4�4r(c#�4# �[U5nSnSnUHBupgp�Xd-
n
U
nUS:�a'XU-S-
X%U-S-
:waUS-nUS:�aXEU4v� XXU
--
nUnMD X5-
nUS:�a'XU-S-
X%U-S-
:waUS-nUS:�aXEU4v� XCU-
-US4v� g7f)z@Extract SequenceMatcher.get_matching_blocks() from a knit delta.rrN)�len)�
knit_delta�source�target�
target_len�s_pos�t_pos�s_begin�s_end�t_len�	_new_text�true_n�ns            r)�get_line_delta_blocks�!KnitContent.get_line_delta_blocks5s������[�
�����0:�,�G�E��_�F��A��1�u��!�)�a�-�(�F�1�9�q�=�,A�A���F�A��q�5���/�)��V�^�#�E��E�1;�
����q�5��a�i�!�m�$��q�y�1�}�(=�=��Q����1�u��A�o�%��E�)�*�J��9�9�s�BBrN)r"r#r$r%rYr/r�r#r'�staticmethodr7r'r!r(r)r
r
s/���'�4�	;�5��:��:r(r
c�6�\rSrSrSrSrSrSrSrSr	Sr
g	)
�AnnotatedKnitContentiPzAnnotated content.c�N�[RU5 [U5Ulgr.)r
r/r&r�r2r�s  r)r/�AnnotatedKnitContent.__init__Ss�����T�"��5�k��r(c�~�URSSnUR(aUSup#X#RS54US'U$)�6Return a list of (origin, text) for each content line.Nr�r�rr��rstrip)r2r��origin�	last_lines    r)r�AnnotatedKnitContent.annotateWs@�����A����!�!� %�b�	��F��!1�!1�%�!8�9�E�"�I��r(c�\�SnURnUHupVpxX�X5-X6-&X5U-
-U-nM g�rrN�r�	r2r�r�offsetr�r�end�count�delta_liness	         r)r�� AnnotatedKnitContent.apply_delta_s>��������.3�*�E��3>�&�.�6�<�0��s�{�+�e�3�F�/4r(c���URVVs/sHupUPM	 nnnUR(aUSR	S5US'U$s snnf![an[USU35UeSnAff=f)Nz7line in annotated knit missing annotation information: r�r)r�
ValueErrorr+r�rB)r2rCrtr��es     r)rt�AnnotatedKnitContent.textgs~��	�.2�k�k�:�k�l�f�T�k�E�:��!�!��b�	�(�(��/�E�"�I����;���	���O�PQ�s�S���
��		�s'�A�A�A�A�
A1�A,�,A1c�,�[UR5$r.)r;rr
s r)�copy�AnnotatedKnitContent.copyus��#�D�K�K�0�0r(rHN)r"r#r$r%rYr/rr�rtrTr'r!r(r)r;r;Ps���"��4��1r(r;c�6�\rSrSrSrSrSrSrSrSr	Sr
g	)
r�iyz�Unannotated content.

When annotate[_iter] is called on this content, the same version is reported
for all lines. Generally, annotate[_iter] is not useful on PlainKnitContent
objects.
c�F�[RU5 XlX lgr.)r
r/r�_version_id�r2r��
version_ids   r)r/�PlainKnitContent.__init__�s�����T�"���%�r(c�\�URVs/sHoRU4PM sn$s snf)r@�rrX)r2�lines  r)r�PlainKnitContent.annotate�s'��59�[�[�A�[�T�!�!�4�(�[�A�A��As�)c�h�SnURnUHupVpxX�X5-X6-&X5U-
-U-nM X lgrGr]rIs	         r)r��PlainKnitContent.apply_delta�sF��������.3�*�E��3>�&�.�6�<�0��s�{�+�e�3�F�/4�*�r(c�H�[URSSUR5$r.)r�rrXr
s r)rT�PlainKnitContent.copy�s������A���0@�0@�A�Ar(c�x�URnUR(aUSSnUSRS5US'U$)Nr�rrAr=s  r)rt�PlainKnitContent.text�s:�������!�!��!�H�E��b�	�(�(��/�E�"�I��r(r]N)r"r#r$r%rYr/rr�rTrtr'r!r(r)r�r�ys"���&�
B�*�B�r(r�c�$�\rSrSrSrSSjrSrg)�_KnitFactoryi�z(Base class for common Factory functions.c���UupgUS:Xa=U(aUR5nOUnURX!5n	URX�5 OURX!5nSn	XxlX�4$)abParse a record into a full content object.

:param version_id: The official version id for this content
:param record: The data returned by read_records_iter()
:param record_details: Details about the record returned by
    get_build_details
:param base_content: If get_build_details returns a compression_parent,
    you must return a base_content here, else use None
:param copy_base_content: When building from the base_content, decide
    you can either copy it and return a new object, or modify it in
    place.
:return: (content, delta) A Content object and possibly a line-delta,
    delta may be None
r�N)rTr�r�rrr�)
r2rZ�record�record_details�base_content�copy_base_contentrr�r<r�s
          r)r��_KnitFactory.parse_record�sk��"'�
���\�!� �&�+�+�-��&���)�)�&�=�E�����2��)�)�&�=�G��E�$)�!���r(r!N)T)r"r#r$r%rYr�r'r!r(r)rgrg�s��2�SW� r(rgc�P�\rSrSrSrSrSrSrSSjrSr	Sr
S	rS
rSr
Srg
)r`i�z/Factory for creating annotated Content objects.Tc�J�[U5n[[U/U-U55$r.)r*r;�zip)r2r�rZ�	num_liness    r)�make�KnitAnnotateFactory.make�s$����J�	�#�C���y�(@�%�$H�I�Ir(c�*�SU5n[U5$)z�Convert fulltext to internal representation.

fulltext content is of the format
revid(utf8) plaintext\n
internal representation is of the format:
(revid, plaintext)
c3�X# �UH n[URSS55v� M" g7f�r�rN�rr�r�r^s  r)r��5KnitAnnotateFactory.parse_fulltext.<locals>.<genexpr>�s#���@����t�z�z�$��*�+�+����(*)r;)r2r<rZr�s    r)rr�"KnitAnnotateFactory.parse_fulltext�s��A��@��#�E�*�*r(c
�^�/n[U5n0mU4SjnU(apUHhnSURS55upxn	[U	5V
s/sH!n
[U5RSS5SPM# nn
UR	XxX�45 Mj U$UHnnSURS55upxn	[U	5V
s/sH'n
[[U5RSS55PM) nn
UR	XxX�45 Mp U$s sn
fs sn
f)a�Convert a line based delta into internal representation.

line delta is in the form of:
intstart intend intcount
1..count lines:
revid(utf8) newline\n
internal representation is
(start, end, count, [1..count tuples (revid, newline)])

:param plain: If True, the lines are returned as a plain
    list without annotations, not as a list of (origin, content) tuples, i.e.
    (start, end, count, [1..count newline])
c�R>�URSS5upTRX5U4$)Nr�r)r�
setdefault)r^rCrt�caches   �r)�cache_and_return�>KnitAnnotateFactory.parse_line_delta.<locals>.cache_and_return�s+����:�:�d�A�.�L�F��#�#�F�3�T�9�9r(c3�8# �UHn[U5v� M g7fr.��int�r�r6s  r)r��7KnitAnnotateFactory.parse_line_delta.<locals>.<genexpr>�����$H�5G��S��V�V�5G����,r�rc3�8# �UHn[U5v� M g7fr.r�r�s  r)r�r��r�r�)r�r�ranger��appendr)
r2r�rZr��resultr��headerrrKrLr�rzrs
            @r)r��$KnitAnnotateFactory.parse_line_delta�s������U�����	:����$H�V�\�\�$�5G�$H�!��E�CH��<�P�<�a�D��K�-�-�d�A�6�q�9�<��P��
�
�u�5�;�<� ��
�	 ��$H�V�\�\�$�5G�$H�!��E�GL�U�|�T�|�!�E�$�u�+�"3�"3�D�!�"<�=�|��T��
�
�u�5�;�<� ��
��Q��
Us�(D�;.D	c��SU5$)�/Extract just the content lines from a fulltext.c3�J# �UHoRSS5Sv� M g7frv)rrxs  r)r��;KnitAnnotateFactory.get_fulltext_content.<locals>.<genexpr>s���9�5�4�
�
�4��#�A�&�5�s�!#r!r=s  r)�get_fulltext_content�(KnitAnnotateFactory.get_fulltext_content�s
��9�5�9�9r(c#��# �[U5nUHUnURS5n[US5n[U5H$n[	U5RSS5upVUv� M& MW g7f)��Extract just the content from a line delta.

This doesn't return all of the extra information stored in a delta.
Only the actual content lines.
r�rr�rN�r�rr�r�r�)r2r�r�rLr�rCrts       r)�get_linedelta_content�)KnitAnnotateFactory.get_linedelta_contents`����U����F��\�\�$�'�F���q�	�N�E��5�\��#�E�{�0�0��q�9����
�"��s�A(A*c�X�URVVs/sHup#SX#4-PM
 snn$s snnf)zdConvert a fulltext content record into a serializable form.

see parse_fulltext which this inverts.
s%s %srH)r2r<�o�ts    r)�lower_fulltext�"KnitAnnotateFactory.lower_fulltexts)��
/6�n�n�=�n�d�a��A�6�!�n�=�=��=s�&c�~�/nUH4up4pVURSX4U4-5 URSU55 M6 U$)zTConvert a delta into a serializable form.

See parse_line_delta which this inverts.
�	%d,%d,%d
c3�6# �UHupUS-U-v� M g7f)r�Nr!)r�rCrts   r)r��7KnitAnnotateFactory.lower_line_delta.<locals>.<genexpr>"s���F����v��}�t�+��s��r��extend�r2r��outrrK�cr�s       r)r��$KnitAnnotateFactory.lower_line_deltasF����$)� �E���J�J�}��A��6�7��J�J�F��F�F�%*��
r(c���URU5n[U[5(a:USSnUR5n/nUHupxUR	XG4-U45 M U$UR5$�Nr�)�_get_content�
isinstancerrr�)	r2r�r;r<�prefix�originsr�rCr^s	         r)r�KnitAnnotateFactory.annotate%sw���#�#�C�(���c�5�!�!���"�X�F��&�&�(�G��F� '����
�
�v�	�1�4�8�9�!(��M��#�#�%�%r(r!N�F)r"r#r$r%rYr�rrrrr�r�r�r�r�rr'r!r(r)r`r`�s4��9��I�J�
+�$�L:��>��&r(r`c�R�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rg)rbi6z+Factory for creating plain Content objects.Fc��[X5$r.)r�rYs   r)rr�KnitPlainFactory.make;s
����2�2r(c�$�URX5$)z�This parses an unannotated fulltext.

Note that this is not a noop - the internal representation
has (versionid, line) - its just a constant versionid.
)rr)r2r<rZs   r)rr�KnitPlainFactory.parse_fulltext>s���y�y��-�-r(c#�# �Sn[U5nX4:a;XnUS-
nSURS55upgnXgX�X3U-4v� X8-
nX4:aM:gg7f)Nrrc3�8# �UHn[U5v� M g7fr.r�r�s  r)r��9KnitPlainFactory.parse_line_delta_iter.<locals>.<genexpr>Ls���@�-?��S��V�V�-?�r�r�)r*r)	r2r�rZ�currqr�rrKr�s	         r)�parse_line_delta_iter�&KnitPlainFactory.parse_line_delta_iterFsa�������J�	��o��Z�F��1�H�C�@�V�\�\�$�-?�@�M�E���a�s�1�W�!5�5�5��H�C��o�s�AA�Ac�6�[URX55$r.)r&r�rYs   r)r��!KnitPlainFactory.parse_line_deltaPs���D�.�.�u�A�B�Br(c��[U5$)r�)r�r=s  r)r��%KnitPlainFactory.get_fulltext_contentSs���E�{�r(c#�# �[U5nUHAnURS5n[US5n[U5Hn[	U5v� M MC g7f)r�r�rNr�)r2r�r�rLr�s     r)r��&KnitPlainFactory.get_linedelta_contentWsM����U����F��\�\�$�'�F���q�	�N�E��5�\���5�k�!�"��s�AAc�"�UR5$r.)rt)r2r<s  r)r��KnitPlainFactory.lower_fulltextds���|�|�~�r(c�p�/nUH-up4pVURSX4U4-5 URU5 M/ U$)Nr�r�r�s       r)r��!KnitPlainFactory.lower_line_deltags>����$)� �E���J�J�}��A��6�7��J�J�u��%*��
r(c�:�[U5nURU5$r.)�_KnitAnnotator�
annotate_flat)r2r�r;�	annotators    r)r�KnitPlainFactory.annotatens��"�4�(�	��&�&�s�+�+r(r!N)r"r#r$r%rYr�rrrrr�r�r�r�r�r�rr'r!r(r)rbrb6s8��5��I�3�.��C��"���,r(rbc�^^�UU4SjnU$)aCreate a factory for creating a file based KnitVersionedFiles.

This is only functional enough to run interface tests, it doesn't try to
provide a full pack environment.

:param annotated: knit annotations are wanted.
:param mapper: The mapper from keys to paths.
c�T>�[UTSSS5n[UT5n[XTS9$)Nc��gr.r!r!r(r)�<lambda>�4make_file_factory.<locals>.factory.<locals>.<lambda>~s��dr(c��g�NTr!r!r(r)r�r�~s��Dr(c��gr�r!r!r(r)r�r�~s��RVr()r�)�
_KndxIndex�_KnitKeyAccessr^)r	r�accessr��mappers   ��r)rv�"make_file_factory.<locals>.factory}s.����9�f�l�L�,�W���	�6�2��!�%�9�E�Er(r!)r�r�rvs`` r)�make_file_factoryr�ss���F�
�Nr(c�^^^�UUU4SjnU$)aCreate a factory for creating a pack based VersionedFiles.

This is only functional enough to run interface tests, it doesn't try to
provide a full pack environment.

:param graph: Store a graph.
:param delta: Delta compress contents.
:param keylength: How long should keys be.
c�>�T=(d T
nSnT(aUS-
nT
(aUS-
nSnOSn[R"UTS9nURS5n[R	UR
5nUR
5 [USUT
URS9n[R05nURXdUS45 [XxUS9n	XYl
XilU	$)	Nrr��)�reference_lists�key_elements�newpackc��gr�r!r!r(r)r��4make_pack_factory.<locals>.factory.<locals>.<lambda>�s��Dr()r��deltas�add_callback)�max_delta_chain)�
_mod_index�InMemoryGraphIndex�open_write_stream�pack�ContainerWriter�write�begin�_KnitGraphIndex�	add_nodes�	pack_repo�_DirectPackAccess�
set_writerr^�stream�writer)
r	r��
ref_lengthr��graph_indexr�r�rr�r�r��graph�	keylengths
          ���r)rv�"make_pack_factory.<locals>.factory�s�����.�5���
���!�O�J���!�O�J�!�O��O� �3�3�&�Y�
���,�,�Y�7���%�%�f�l�l�3�����������$�.�.�
���,�,�R�0�����&�	�9�/E�F�#�E�?�S���
��
��
r(r!)r�r�r�rvs``` r)�make_pack_factoryr��s����<�Nr(c�l�URR5 URR5 gr.)r��closer�rK)�versioned_filess r)�cleanup_pack_knitr��s&����� � �"������ r(c���0nUnU(aH[5nUH-nXb;aM
X&upxn	X�U'X�;dMURU	5 M/ UnU(aMH[SUR555$)aiDetermine the total bytes to build these keys.

(helper function because _KnitGraphIndex and _KndxIndex work the same, but
don't inherit from a common base.)

:param keys: Keys that we want to build
:param positions: dict of {key, (info, index_memo, comp_parent)} (such
    as returned by _get_components_positions)
:return: Number of bytes to build those keys
c3�*# �UH	oSv� M g7f)rNr!)r��
index_memos  r)r��(_get_total_build_size.<locals>.<genexpr>�s���N�/M��!�}�/M���)�set�add�sum�values)
r2�keys�	positions�all_build_index_memos�
build_keys�	next_keysr;r�r�r�s
          r)�_get_total_build_sizer�s������J�
��E�	��C��#��09��-�A�-�)3�#�&�!�>��
�
�0�1���
��*��N�/D�/K�/K�/M�N�N�Nr(c�l�\rSrSrSrS/SjrSrSrSrS0Sjr	S1S	jr
S
rSrSr
S2S
jrSrSrSrSrSrSrS3SjrS4SjrSrSrS3SjrSrS3Sjr\S5r\4SjrSr Sr!Sr"S r#S!r$S4S"jr%S#r&S5S$jr'S%r(S&r)S'r*S(r+S)r,S*r-S4S+jr.S,r/S-r0S.r1g)6r^i�aStorage for many versioned files using knit compression.

Backend storage is managed by indices and data objects.

:ivar _index: A _KnitGraphIndex or similar that can describe the
    parents, graph, compression and data location of entries in this
    KnitVersionedFiles.  Note that this is only the index for
    *this* vfs; if there are fallbacks they must be queried separately.
Nc��XlX lX0lU(a[5UlO[5Ul/UlXPlg)aJCreate a KnitVersionedFiles with index and data_access.

:param index: The index for the knit data.
:param data_access: The access object to store and retrieve knit
    records.
:param max_delta_chain: The maximum number of deltas to permit during
    insertion. Set to 0 to prohibit the use of deltas.
:param annotated: Set to True to cause annotations to be calculated and
    stored during insertion.
:param reload_func: An function that can be called if we think we need
    to reload the pack listing and try again. See
    'breezy.bzr.pack_repo.AggregateIndex' for the signature.
N)�_index�_access�_max_delta_chainr`�_factoryrb�_immediate_fallback_vfs�_reload_func)r2r�data_accessr�r��reload_funcs      r)r/�KnitVersionedFiles.__init__�s9�� ��"�� /���/�1�D�M�,�.�D�M�')��$�'�r(c�x�SRURRURUR5$)Nz{}({!r}, {!r}))r��	__class__r"rrr
s r)�__repr__�KnitVersionedFiles.__repr__�s.���&�&��N�N�#�#�T�[�[�$�,�,�
�	
r(c��[URURURURR
UR5$)z?Return a clone of this object without any fallbacks configured.)r^rrrrr�rr
s r)�without_fallbacks�$KnitVersionedFiles.without_fallbacks�s<��!��K�K��L�L��!�!��M�M�#�#����
�	
r(c�:�URRU5 g)znAdd a source of texts for texts not present in this knit.

:param a_versioned_files: A VersionedFiles object.
N)rr�)r2�a_versioned_filess  r)�add_fallback_versioned_files�/KnitVersionedFiles.add_fallback_versioned_filess��
	
�$�$�+�+�,=�>r(c	��URR5 URXXx5 UcSnSRU5n	UR	UUUUUUUU	S9$)zSee VersionedFiles.add_lines().r!r(��
line_bytes)r�_check_write_ok�
_check_addru�_add)
r2r;r�r��parent_texts�left_matching_blocks�nostore_sha�	random_id�
check_contentr$s
          r)�	add_lines�KnitVersionedFiles.add_lines
si��	
���#�#�%�����I�=��?��G��X�X�e�_�
��y�y����� ���!��	
�		
r(c��URR5 URnURnUR	USUSS9 UcSnURS5nURS5n	UR
UUUUUUUU	S9$)z!See VersionedFiles.add_content().NF)r,r!r�r�r#)rr%r;r�r&r�r')
r2�content_factoryr(r)r*r+r;r�r�r$s
          r)�add_content�KnitVersionedFiles.add_content,s���	
���#�#�%��!�!��!�)�)������T�9�E��B��?��G��,�,�W�5��$�1�1�*�=�
��y�y����� ���!��	
�		
r(c	�`�[U5n	Xi:Xa[e/n
Uc0nURRU5nUHnX�;dM
U
R	U5 M [U
5S:XdU
SUS:waSn
OUR
U
S5n
[U5n/nSnU(aSURS5(d=UR	S5 SnUc[R"U5nOUSSnUSS-US'Uc[R"U5nUSSH2n[U[5(aM[SRU55e USc
USSS	U	-4-nO2[US[5(d[SRU55eUSnURRUU5nU(aSUlU
(d*URR"(a9[U
5S:�a*UR%UU
UU
URR"U5nU
(aBUR	S
5 URR'W5nUR)XU5unnO�UR	S5 URR*[,La2U/nU(aUR	S5 UR)XUU5unnO0URR/U5nUR)XU5unnUR0R3UUU5nURR5XUU44US9 X�U4$)
afAdd a set of lines on top of version specified by parents.

Any versions not present will be converted into ghosts.

:param lines: A list of strings where each one is a single line (has a
    single newline at the end of the string) This is now optional
    (callers can pass None). It is left in its location for backwards
    compatibility. It should ''.join(lines) must == line_bytes
:param line_bytes: A single string containing the content

We pass both lines and line_bytes because different routes bring the
values to this function. And for memory efficiency, we don't want to
have to split/join on-demand.
NrFr�no-eolTr�z"key contains non-bytestrings: {!r}ssha1:�
line-delta�fulltext)r+)rr
r�get_parent_mapr�r*�_check_should_delta�endswithr�split_linesr�r��	TypeErrorr�rrrr�r��_merge_annotationsr�rsrrbr�r�add_raw_record�add_records)r2r;r�r�r(r)r*r+r$�digest�present_parents�present_parent_map�parentr��text_lengthrW�no_eol�elementrZr<�delta_hunks�store_linesr{�data�dense_lines�access_memos                          r)r'�KnitVersionedFiles._addKs
��6�J�'��� �!�!������L�"�[�[�7�7��@���F��+��&�&�v�.��
���1�$���(:�g�a�j�(H��E�
�,�,�_�Q�-?�@�E��*�o�������j�1�1�%�8�8��N�N�9�%��F��}��+�+�J�7���a����b�	�E�)�E�"�I��=��'�'�
�3�E��3�B�x�G��g�u�-�-�� D� K� K�C� P�Q�Q� ��r�7�?��c�r�(�h��/�1�1�C��C��G�U�+�+��@�G�G��L�M�M���W�
��-�-�$�$�U�J�7���)-�G�%��T�]�]�,�,��_�1E��1I��1�1������
�
�'�'�$�
�K���N�N�=�)��-�-�8�8��E�K��-�-�c�;�G�J�D�$��N�N�;�'��}�}�&�&�*:�:� *�l����&�&�u�-�!�1�1�#�u�k�R�
��d�#�m�m�:�:�7�C��!�1�1�#�{�K�
��d��l�l�1�1�#�t�T�B��������K��
1�3�y�	 �	
��G�+�+r(c�8�URRX5$)zSee VersionedFiles.annotate.)rr�r2r;s  r)r�KnitVersionedFiles.annotate�s���}�}�%�%�d�0�0r(c��[U5$r.)r�r
s r)�
get_annotator� KnitVersionedFiles.get_annotator�s
���d�#�#r(c�N�UcUR5$URUSS5$)zSee VersionedFiles.check().r�T)�_logical_checkr�)r2�progress_barrs   r)�check�KnitVersionedFiles.check�s-���<��&�&�(�(��)�)�$��T�B�Br(c�B�URR5nURU5nUHKnURRU5S:wdM$X#SnXB;dM2[	USRXC55e URHnUR5 M g)Nr�rzMissing basis parent {} for {})rrr7�
get_methodr+r�rrU)r2r�
parent_mapr;r��fallback_vfss      r)rS�!KnitVersionedFiles._logical_check�s���
�{�{���!���(�(��.�
��C��{�{�%�%�c�*�j�8�%/�_�Q�%7�"�%�7�%��8�?�?�.����	�!�8�8�L���� �9r(c��[SU55(d[U5eUSnUb,[U5(a[XP5eUR	U5 U(a#URU5 UR
U5 gg)z0Check that version_id and lines are safe to add.c3�X# �UH n[U[5=(d USLv� M" g7fr.�r�r�)r��xs  r)r��0KnitVersionedFiles._check_add.<locals>.<genexpr>�s#���B�c��:�a��'�4�1��9�4�c�rzr�N)�allr;rr�check_not_reserved_id�_check_lines_not_unicode�_check_lines_are_lines)r2r;r�r+r,rZs      r)r&�KnitVersionedFiles._check_add�sv���B�c�B�B�B��C�.� ���W�
��!�"�:�.�.�'�
�9�9��&�&�z�2�
��)�)�%�0��'�'��.�r(c�P�URU5nURX1S5 U$r�)�
_split_header�_check_header_version)r2r;r^rys    r)�
_check_header� KnitVersionedFiles._check_header�s)��� � ��&���"�"�3�B��0��
r(c�R�USU:wa[USRX!S55eg)z}Checks the header version on original format knit records.

These have the last component of the key embedded in the record.
rz)unexpected version, wanted {!r}, got {!r}N)r+r�)r2ryrZs   r)rh�(KnitVersionedFiles._check_header_version�s8��
�q�6�Z����;�B�B�:�ST�v�V��
� r(c���SnSn[UR5H?nURRU/5nXQnUupx n	Uu p�UcU
n X2:�$X*-
nUnMA g![[
4a  gf=f)a�Iterate back through the parent listing, looking for a fulltext.

This is used when we want to decide whether to add a delta or a new
fulltext. It searches for _max_delta_chain parents. When it finds a
fulltext parent, it sees if the total size of the deltas leading up to
it is large enough to indicate that we want a new full text anyway.

Return True if we should create a new delta, False if we should use a
full text.
rNF)r�rr�get_build_detailsr�KeyError)r2rB�
delta_size�
fulltext_size�_countr��parent_detailsr�r�r�r{s           r)r8�&KnitVersionedFiles._check_should_deltas����
��
��D�1�1�2�F�	
�
!%��� =� =�v�h� G�
�!.�!6��4B�0�J�A�q�#�J�A�q�!�)� $�
���)�)�
��J�(�F�'3�,��'��1�
��
�s� A�A2�1A2c��USUSUS4$)z2Convert a build_details tuple to a position tuple.rnrrr!)r2r�s  r)�_build_details_to_components�/KnitVersionedFiles._build_details_to_components/s ���Q���q�!1�=��3C�C�Cr(c��0nUnU(a�URRU5n[U5n[5nUR5H1upxUup�p�U
bUR	U
5 URU5X7'M3 UR
U5n
U
(a,U(d%[R"U
R5U5eU(aM�U$)a1Produce a map of position data for the components of keys.

This data is intended to be used for retrieving the knit records.

A dict of key to (record_details, index_memo, next, parents) is
returned.

* method is the way referenced data should be applied.
* index_memo is the handle to pass to the data access to actually get
  the data
* next is the build-parent of the version, or None for fulltexts.
* parents is the version_ids of the parents of this version

:param allow_missing: If True do not raise an error on a missing
    component, just ignore it.
)
rrnr�itemsrrv�
differencerr�pop)r2r�
allow_missing�component_data�pending_componentsr��current_componentsr;�detailsr�r�r�rj�missings              r)�_get_components_positions�,KnitVersionedFiles._get_components_positions4s���"��!�� � �K�K�9�9�:L�M�M�!$�%7�!8��!$��� -� 3� 3� 5���LS�I���%�1�&�*�*�+=�>�&*�&G�&G��&P��#�	!6�
)�3�3�M�B�G��}��/�/����
�t�D�D�!� ��r(c��Uc0nURUS5nUb$URU/5(d[X5eU$[X/5nUR	U5$)z>Returns a content object that makes up the specified
version.
N)r�r7r�_VFContentMapGeneratorr�)r2r;r(�cached_versionr�s     r)r��KnitVersionedFiles._get_contentUsh�����L�%�)�)�#�t�4���%��&�&��u�-�-�(��3�3�!�!�*�4��7�	��%�%�c�*�*r(c�*�URU5S$)z�Get a map of the graph parents of keys.

:param keys: The keys to look up parents for.
:return: A mapping from keys to parents. Absent keys are absent from
    the mapping.
r)�_get_parent_map_with_sources�r2rs  r)r7�!KnitVersionedFiles.get_parent_mapds���0�0��6�q�9�9r(c��0nUR/UR-n/n[U5nUH[nU(d X$4$URU5nUR	U5 URU5 UR
[U55 M] X$4$)axGet a map of the parents of keys.

:param keys: The keys to look up parents for.
:return: A tuple. The first element is a mapping from keys to parents.
    Absent keys are absent from the mapping. The second element is a
    list with the locations each key was found in. The first element
    is the in-this-knit parents, the second the first fallback source,
    and so on.
)rrrr7r��update�difference_update)r2rr��sources�source_resultsr�r,�
new_results        r)r��/KnitVersionedFiles._get_parent_map_with_sourcesms������;�;�-�$�">�">�>�����d�)���F���
�%�%�	 �.�.�w�7�J��!�!�*�-��M�M�*�%��%�%�c�*�o�6�
��%�%r(c�B�URXS9nURU5$)aAProduce a dictionary of knit records.

:return: {key:(record, record_details, digest, next)}

    * record: data returned from read_records (a KnitContentobject)
    * record_details: opaque information to pass to parse_record
    * digest: SHA1 digest of the full text after all steps are done
    * next: build-parent of the version, i.e. the leftmost ancestor.
        Will be None if the record is not a delta.

:param keys: The keys to build a map for
:param allow_missing: If some records are missing, rather than
    error, just return the data that could be generated.
�r|)�_get_record_map_unparsed�_raw_map_to_record_map)r2rr|�raw_maps    r)�_get_record_map�"KnitVersionedFiles._get_record_map�s(���/�/��/�R���*�*�7�3�3r(c�d�0nUH'nXupEnURUSU5upxXuX�4X#'M) U$)zOParse the contents of _get_record_map_unparsed.

:return: see _get_record_map.
r�)�
_parse_record)	r2r�r�r;rHrjr�r<r?s	         r)r��)KnitVersionedFiles._raw_map_to_record_map�sJ��
���C�)0��&�D�$�"�0�0��R��$�?�O�G�!�6�?�F�K���
r(c	��URXS9nUR5VVVVs/sHunupVotU4PM nnnnnUR[R"S5S9 0n	URU5HupJX4up�n
X�U
4X�'M U	$s snnnnf![Ra%nURRU5 SnAOSnAff=fM�)z�Get the raw data for reconstructing keys without parsing it.

:return: A dict suitable for parsing via _raw_map_to_record_map.
    key-> raw_bytes, (method, noeol), compression_parent
r�r�r;N)
r�ry�sort�operator�
itemgetter�_read_records_iter_uncheckedr��RetryWithNewPacksr�reload_or_raise)r2rr|�position_mapr;�r�i_mr6�records�raw_record_maprHrjr�r�rQs               r)r��+KnitVersionedFiles._get_record_map_unparsed�s����
0�#�=�=�� >� ��
?K�>P�>P�>R�S�>R�*:�#�{����:�>R��S�����!4�!4�Q�!7��8�!#��!%�!B�!B�7�!K�I�C�9E�9J�6�^��*.��*D�N�'�"L�&�%��T���.�.�
0����,�,�Q�/�/��
0��!s(�$B�B
�AB�
B�C�)C	�	Cc��0n/nUHJn[U5S:XaSnOUSnXR;aX%RU5 M4U/X%'URU5 ML X#4$)a�For the given keys, split them up based on their prefix.

To keep memory pressure somewhat under control, split the
requests back into per-file-id requests, otherwise "bzr co"
extracts the full tree into memory before writing it to disk.
This should be revisited if _get_content_maps() can ever cross
file-id boundaries.

The keys for a given file_id are kept in the same relative order.
Ordering between file_ids is not, though prefix_order will return the
order that the key was first seen.

:param keys: An iterable of key tuples
:return: (split_map, prefix_order)
    split_map       A dictionary mapping prefix => keys
    prefix_order    The order that we saw the various prefixes
rr(r)r*r�)�clsr�split_by_prefix�prefix_orderr;r�s      r)�_split_by_prefix�#KnitVersionedFiles._split_by_prefix�sk��&�����C��3�x�1�}����Q����(��'�.�.�s�3�+.�%��'��#�#�F�+���,�,r(c��[U5 URU5upVURU5upx/n	[5n
Sn/n/n
UH�nX^nURU/5nURRX5nUU-
nU	R
U5 U
RU5 X�:�dMbURX�45 U
RU5 /n	[5n
SnM� U	(a#URX�45 U
RU5 U$)ahFor the given keys, group them into 'best-sized' requests.

The idea is to avoid making 1 request per file, but to never try to
unpack an entire 1.5GB source tree in a single pass. Also when
possible, we should try to group requests to the same pack file
together.

:return: list of (keys, non_local) tuples that indicate what keys
    should be fetched next.
r)	r*r�rr�rrr�r�r�)r2r�non_local_keysr�_min_buffer_size�prefix_split_keysr��prefix_split_non_local_keysr��cur_keys�
cur_non_local�cur_sizer��sizesr��	non_local�	this_sizes                 r)�_group_keys_for_io�%KnitVersionedFiles._group_keys_for_io�s��"	�D�	�*.�*?�*?��*E�'��)-�)>�)>�~�)N�&�#�����
�������"�F�$�,�D�3�7�7���C�I����9�9�$�J�I��	�!�H��O�O�D�!�� � ��+��*��
�
�x�7�8����X�&��� #��
���#���M�M�8�3�4��L�L��"��
r(c#�v# �[U5nU(dgURR(dSnUn[U5nURXU5H"nUR	UR
5 Uv� M$ g![Ra%nURRU5 SnAOSnAff=fM�7f)a�Get a stream of records for keys.

:param keys: The keys to include.
:param ordering: Either 'unordered' or 'topological'. A topologically
    sorted stream has compression parents strictly before their
    children.
:param include_delta_closure: If True then the closure across any
    compression parents will be included (in the opaque data).
:return: An iterator of ContentFactory objects, each of which is only
    valid until the iterator is advanced.
Nr�)
rr�	has_graph�_get_remaining_record_stream�discardr;r�r�rr�)r2r�ordering�include_delta_closure�remaining_keysr0rQs       r)r��$KnitVersionedFiles.get_record_streams�����4�y�����{�{�$�$�"�H����	
0��>�*��'+�'H�'H��$9�(�O�#�*�*�?�+>�+>�?�)�)�	(�
���.�.�
0����,�,�Q�/�/��
0���s/�4B9�AA;�:B9�;B4�B/�*B9�/B4�4B9c#�# �U(aURUSS9nONURRU5nUR5VVs0sHupgX`R	U5_M nnnUR[
U55nU(a�[
5n	0n
UHrnXdUS/nSnUSb3USU
;aX�SnO"URXKSS5 USbM3USSHn
X�U
'M	 U(aMaU	RU5 Mt URU5up�US;ayUS:Xa[RU5nO[U5n/nSnUHGnUH
nUU;dMUn O UWLaURU/45 UnUSSRU5 MI O�US	:wa[S
RU55e/n/n[!U5HGnURU/45 UH+nURU5 USSRU5 M- MI UH,unnUUSLdMURR#UU5 M. U[
U5-
nUHn[%U5v� M U(aFW	U-
nUR'UUU5H)unn[)XUX�S9nUR+5Shv�N M+ gUH�unnUUSLafUVs/sHofXFS4PM
 nnUR-U5H7unnXFunnn[/UX�USUUR0R2S5v� M9 MtUR4UR7U5S-
nUR+XU5Shv�N M� gs snnf![a U	RU5 GMf=f![a U	RUS5 SnGM�f=fGNs snfNb7f)
z;This function is the 'retry' portion for get_record_stream.Tr�rr�N)�topological�
groupcompressr�rr�zVvalid values for ordering are: "unordered", "groupcompress" or "topological" not: {!r}r�r�)r�rrnryrvrzrrorr�r��tsort�	topo_sortr�AssertionErrorr��reversed�_sort_keys_by_ior
r�r�r�r�r�rr�rr) r2rr�r�rr�r;r��absent_keys�needed_from_fallback�reconstructable_keys�chainr��	chain_key�
global_map�parent_maps�present_keys�source_keys�current_sourcerY�
key_sourcer,�sub_keysr��nlkr�r��raw_datarjr�r��vfs                                 r)r��/KnitVersionedFiles._get_remaining_record_stream1sG��� ��6�6�t�4�6�P�I� �K�K�9�9�$�?�M�
%2�$7�$7�$9��$9�L�C��6�6�w�?�?�$9�
���o�o�c�)�n�5��
!�#&�5� �$&� ���� �C�.��"3�4�E����B�i�+��R�y�$8�8�!5�B�i�!@���"�!�L�L���9�)=�a�)@�A�
�B�i�+�"'�s���I�6<��3�",��v�(�,�,�S�1�/�2#'�"C�"C�D�"I��
��7�7��=�(�$���z�:��1�*�=���K�!�N�#��"-�J��j�(�%/�
��#.�"��3��&�&�
�B�'7�8�%/�N��B���"�)�)�#�.�$��;�&�$�O�OU�v� �P����L��K�&�{�3�
��"�"�J��#3�4�%�C� �'�'��,���O�A�&�-�-�c�2�&�4�%0� ����[��^�+��K�K�0�0��9�E�%0��S��_�,���C�&�s�+�+��!�2�K�?�N�!�4�4��n�i��	��c�3���Z��	�%�6�6�8�8�8�
�!,�����[��^�+�CG�H�4�C�Y�^�A�%6�7�4�G�H�)-�)J�)J�7�)S�
��X�:C�.�7���Q�0��&�O�*� �$� �M�M�3�3� ���*T��5�5�k�6G�6G��6O�RS�6S�T�B�!�3�3��(=� ���#!,��I��$ ��(�,�,�S�1���� (�"�0�4�4�U�2�Y�?�%)�F�!�	"��J9��
I��s��AO�	M3�&5O�	M9�%O�?N�O� O�9A'O�$CO�,BO�3O�4O�O�#BO�)O�*O�9N�O�N�O� O�<O�O�O�Oc�t�[U5nURUSS9n0nUR5HupVXR;aMUSXE'M UR[U55 URHInU(d U$URU5nUR
U5 UR[U55 MK U$)zSee VersionedFiles.get_sha1s().Tr�r)rr�ryr�r�	get_sha1sr�)	r2rr��
record_mapr�r;r�r,r�s	         r)r��KnitVersionedFiles.get_sha1s�s����d�)���)�)�'��)�F�
���&�,�,�.�L�C��!��!�!�*�F�K�	/�
	�!�!�#�f�+�.��2�2�F����
� �)�)�'�2�J��M�M�*�%��%�%�c�*�o�6�3��
r(c�
^^�UU4Sjn[5nTRR(aSn/nO8SnS1nTR(a"UR	S5 UR	S5 [5nTR(a@UR	SRU55 UR	SRU55 UR	SRU55 UR
U5n0m0nUGH;n	U	Rn
U
RS5(aPU
RS	5(a:U	RnTRU	RU5up�UR5 S
nU	RnU	RU;aUSnOSnU	RS
:Xa[U	R/T5eU	RU;GaXUb(TR (aUTR";dUT;Ga-U	RU;a-U	RS4nU"U5nUR'U	US5nOU	RnU	R(SR+S5/nU	R(S(aUR-S5 TR.R1U	R[3U5U/5nU	RUUU4nSU;a5UTR";a%UR5U/5nUR-U5 SnU(dTR"R7U/5 O�U	RS;a,TR9U	RX�R;S55 OJTR.R=5 U	R;S5nTR9U	RUU5 U(aGM�U	R/nU(dGM�URES5nUU;aHUUnTR"R7U5 URGUVs/sHnUSPM
 sn5 UU	U(aMhGM> U(a</nUHnUUnURGU5 M TR"R7USS9 gg![$a U	RS4nU"U5nGN�f=f![>a, U	RS4nU"U5nUR'U	S5nGNLf=f![@RBa GNIf=fs snf)z�Insert a record stream into this container.

:param stream: A stream of records to insert.
:return: None
:seealso VersionedFiles.get_record_stream:
c�z>�TU$![a( [R"U5nU"T5nUTU'Us$f=fr.)rorr�)r�r�r��adaptersr2s   ��r)�get_adapter�<KnitVersionedFiles.insert_record_stream.<locals>.get_adapter�sK���
���,�,���
�"2�"6�"6�{�"C��)�$�/��(/���%���	
�s��/:�:r�r�zknit-annotated-ft-gzzknit-annotated-delta-gzzknit-{}delta-gzzknit-{}ft-gzzknit-z-gzFrNr�r�rmrr�r4r6T)r��filer�)�missing_compression_parents)$rrr�rrr��unionro�
startswithr9rp�_parse_record_headerr;r�r�rrrror}r�r�r�rr=r*r~r>r-r��flushrr�RevisionAlreadyPresentr{r�)r2r�r��delta_typesr��convertibles�native_types�
knit_types�buffered_index_entriesrir�r��dfry�bufferedr�r�r�r�r�rWrJ�index_entry�pendingr��
added_keysr;�
index_entries�all_entriesr�s`                            @r)�insert_record_stream�'KnitVersionedFiles.insert_record_stream�s����	��e���=�=�"�"�$�I��L��I�2�3�L��$�$���� 9�:�� � �!:�;��u��� � ����.�5�5�i�@�A��O�O�-�4�4�Y�?�@�����.�.�y�9�:�!�'�'��5�
���"$���F��&�&�D����w�'�'�D�M�M�%�,@�,@�"�-�-���3�3�F�J�J��I������
��H��n�n�G��"�"�k�1�&-�Q�Z�"�%)�"��"�"�h�.�(�&�*�*��t�<�<��%�%��3�"�*��3�3�%����4�%�T�1��&�&�l�:�;�'-�':�':�O�&L��"-�k�":��$�-�-�f�k�!�n�E�E�#�.�.�E�!�0�0��3�:�:�7�C�D���(�(��+��N�N�9�-�#�l�l�9�9��J�J��E�
�U�G��� &�z�z�7�K��I���g�-�*����<�"8�"C�"C�.��#�� ���{�3�#'����K�K�+�+�[�M�:���$�$�(;�;����v�z�z�7�4G�4G��4P�Q����"�"�$�?�"�/�/��8�E�
��N�N�6�:�:�w��>��8�$�j�j�\�
� �j�$�.�.��+�C��4�4�(>�s�(C�
����/�/�
�>�"�)�)�?L�M�}��[��^�}�M��3�3�7�!�j�Q�b"��K�-�� 6�s� ;�
��"�"�=�1�.�
�K�K�#�#�K�T�#�R�"��U$�;�'-�':�':�L�&I��"-�k�":��;��l1�?�"(�"5�"5�w�">�K�)�+�6�G�#�-�-�f�g�>�E�?���4�4�����Ns<�R�R)�S"�S=
� R&�%R&�)2S�S�"S:�9S:c�6�URR5$)a�Return an iterable of keys of missing compression parents.

Check this after calling insert_record_stream to find out if there are
any missing compression parents.  If there are, the records that
depend on them are not able to be inserted safely. For atomic
KnitVersionedFiles built on packs, the transaction should be aborted or
suspended - commit will fail at this point. Nonatomic knits will error
earlier because they have no staging area to put pending entries into.
)r�get_missing_compression_parentsr
s r)�#get_missing_compression_parent_keys�6KnitVersionedFiles.get_missing_compression_parent_keysrs���{�{�:�:�<�<r(c#�j# �Uc[RR5n[U5n[	U5nSnU(Gd/nUR
R
U5nUR5H!upxXq;dMURXxS45 M# [URU55n	U	H�un
up{nUR[S5X�5 XgSn
U
cURRU5nOURRU5nUR!U5 UHnX�4v� M
 M� SnU(dGMU(a&UR*(d[-U[/U55eUR*HWnU(d OO[5nUR1U5Hup�UR3U5 X�4v� M UR5U5 MY UR[S5X35 g!["R$a%nUR&R)U5 SnAN�SnAff=f7f)a6Iterate over the lines in the versioned files from keys.

This may return lines from other keys. Each item the returned
iterator yields is a tuple of a line and a text version that that line
is present in (not introduced in).

Ordering of results is in whatever order is most suitable for the
underlying storage format.

If a progress bar is supplied, it may be used to indicate progress.
The caller is responsible for cleaning up progress bars (because this
is an iterator).

Notes:
 * Lines are normalised by the underlying store: they will all have \\n
   terminators.
 * Lines are returned in arbitrary order.
 * If a requested key did not change any lines (or didn't have any
   lines), it may not be mentioned at all in the result.

:param pb: Progress bar supplied by caller.
:return: An iterator over (line, key).
NFrzWalking contentrT)�ui�
ui_factory�nested_progress_barrr*rrnryr��	enumerate�_read_records_iterr��gettextrr�r��remover�r�rr�rr�repr�#iter_lines_added_or_present_in_keysrr�)r2r�pb�total�done�key_recordsr�r;r��records_iter�key_idxrH�
_sha_valuer��
line_iteratorr^rQr,r�s                   r)r
�6KnitVersionedFiles.iter_lines_added_or_present_in_keys~s����0�:����2�2�4�B��4�y���D�	�����
0�!�� $��� =� =�d� C�
�$1�$7�$7�$9�L�C��{�#�*�*�C���+<�=�%:� )��)@�)@��)M�N��8D�4�G�4�c���I�I�g�&7�8�'�I�)6�);�A�)>�&�)�1�(,�
�
�(J�(J�4�(P�
�)-�
�
�(K�(K�D�(Q�
��K�K��$�
!.��"�i��!.�!9E�$��;�$�H��4�4�%�T�4��:�6�6��2�2�F����%�K�#�G�G��M�	������$��i��N�
�"�"�;�/�3�	�	�	�'�+�,�e�;��%�.�.�
0����,�,�Q�/�/��
0�s>�AH3�5G7�>B?G7�=H3�B0H3�7H0�H+�&H3�+H0�0H3c
��/nUR5HEnUSS:XaMURUSUSUSUS-
URUSUS45 MG U$)z5Generate a line delta from delta_seq and new_content.rrrr�rn)rr�r)r2�	delta_seq�new_content�
diff_hunks�ops     r)�_make_line_delta�#KnitVersionedFiles._make_line_delta�st���
��'�'�)�B��!�u��������A���1��r�!�u�r�!�u�}�k�.@�.@��A���A��.O�P�
�*��r(c�6�Uc0nUb[RU5nOSnU(Ga
UH�nURX�5n	X�S:XaUbUn
O3[R	SU	R5UR55n
U
R
5H.up�n
U
S:XaMU	RX�U
-URX�U
-&M0 M� UR(a\URSSRS5(d6URSSS-nURSSU4URS'U(a`UcLURUSU5nUR5nUR5n[R	SUU5nURXq5$g)z�Merge annotations for content and generate deltas.

This is done by comparing the annotations based on changes to the text
and generating a delta on the resulting full texts. If annotations are
not being created then a simple delta is created.
Nrr�rr)
�diff�_PrematchedMatcherr�rrrt�get_matching_blocksrr9r)r2r<r�r(r�r�r)r�
parent_key�
merge_content�seq�i�jr6r^�reference_contentrrs                  r)r<�%KnitVersionedFiles._merge_annotations�s������L��+��/�/�0D�E�I��I��%�
� $� 1� 1�*� K�
����+�	�0E�#�C�&�>�>��m�0�0�2�G�L�L�N��C� #�6�6�8�G�A�!��A�v� �1>�0D�0D�Q�Q��0O�G�N�N�1�1�u�-�
 9�&�"�~�~�g�n�n�R�&8��&;�&D�&D�U�&K�&K��~�~�b�)�!�,�u�4��&-�n�n�R�&8��&;�T�%B����r�"��� �$(�$5�$5�g�a�j�,�$O�!�#�L�L�N�	�-�2�2�4�	�(�@�@��)�Y��	��(�(��<�<�r(c�V�URU5up4URX15 XCS4$)zoParse an original format knit record.

These have the last element of the key only present in the stored data.
rn)rqrh)r2rZrHry�record_contentss     r)r�� KnitVersionedFiles._parse_records2��
 $�;�;�D�A����"�"�3�3��A��&�&r(c��[RS[U5S9nURXR	55nX44$![
a1n[
USUSURRSU<S35UeSnAff=f)z}Parse a record header for consistency.

:return: the header and the decompressor stream.
         as (stream, header_record)
�rb��mode�fileobjzWhile reading {z} got �(�)N)	�gzip�GzipFilerri�readline�	Exceptionr+rr")r2r;r�r�ryrQs      r)r��'KnitVersionedFiles._parse_record_headers����]�]��g�h�.?�]�
@��	��$�$�S�+�+�-�8�C�
�w���	�	���(���W�Q�[�[�5I�5I�4J�!�A�5�PQ�R���
��	�s�A�
A<�,A7�7A<c�x�[RS[U5S9nUR5nURS5nURU5nUR5n[U5[US5:wa6[US	R[U5[US5US
U55eUSUS
-:wa[USRXvS
55eSSS5 Xc4$![a2n[USU<SURRSU<S35UeSnAff=f!,(df   WW4$=f)
Nr+r,zCorrupt compressed record z, got r/r0rrz8incorrect number of lines {} != {} for version {{{}}} {}rsend %s
z-unexpected version end line {!r}, wanted {!r})
r1r2r�	readlinesr4r+rr"r{rgr*r�r�)r2rHr�r(rQr�ryrDs        r)rq�*KnitVersionedFiles._parse_record_unchecked(sX��
�]�]��g�d�m�]�
<��
�"$�,�,�.��%�(�(��+�F��$�$�V�,�C�'�+�+�-�I��?�#�s�3�q�6�{�2�!��N�U�U��O�,�c�#�a�&�k�3�q�6�?�����K�#�a�&�0�0�!��C�J�J�!�q�6����1�%=�2�#�#��-�
�!��0����q�{�{�?S�?S�>T�TU�VW�UZ�Z[�\�����
��=�
<�2�O�#�#�s.�D(�C)�B-D(�)
D%�3-D � D%�%D(�(
D9c#�N# �U(dg[[U5[R"S5S9nU(dgURRUVVs/sHup4UPM	 snn5n[
X%5H%uup6nURUSU5up�X8U	4v� M' gs snnf7f)ajRead text records from data file and yield result.

The result will be returned in whatever is the fastest to read.
Not by the order requested. Also, multiple requests for the same
record will only yield 1 response.

:param records: A list of (key, access_memo) entries
:return: Yields (key, contents, digest) in the order
         read, not the order requested
Nrr�r�)�sortedrr�r�r�get_raw_recordsrpr�)
r2r��needed_recordsr;r�r��_index_memorHr<r?s
          r)r�%KnitVersionedFiles._read_records_iterHs������ ��G��(�2E�2E�a�2H�I�����<�<�/�/�/=�>�~�O�C�Z�~�>�
��),�N�(E�$��S��"�0�0��R��$�?�O�G���&�&�)F��
?�s�AB%�B
�"AB%c#�# �URU5H1up#URX#5upEUR5 X#US4v� M3 g7f)z�Read text records from data file and yield raw data.

This unpacks enough of the text record to validate the id is
as expected but thats all.

Each item the iterator yields is (key, bytes,
    expected_sha1_of_full_text).
rnN)r�r�r�)r2r�r;rHr�rys      r)�_read_records_iter_raw�)KnitVersionedFiles._read_records_iter_rawesK����:�:�7�C�I�C��/�/��:�G�B��H�H�J��S��V�#�#�D�s�AA
c#��# �[U5(a1UVVs/sHup#UPM	 nnnURRU5nUHup&[W5nX'4v� M gs snnf7f)zlRead text records from data file and yield raw data.

No validation is done.

Yields tuples of (key, data).
N)r*rr;r�)r2r�r;r��needed_offsets�raw_recordsr=rHs        r)r��/KnitVersionedFiles._read_records_iter_uncheckedus^����w�<�<�@G�H��_�S�j��N�H��,�,�6�6�~�F�K� '��C���$�D��)�O�!(��I�s�A&�A �AA&c���SUS[U5U4-/nURU=(d U5 URSUS-S-5 UH;n[U[5(aM[SR
[U555e U(a3USRS5(d[SR
U55e[RU5n[[55U4$)akConvert key, digest, lines into a raw data block.

:param key: The key of the record. Currently keys are always serialised
    using just the trailing component.
:param dense_lines: The bytes of lines but in a denser form. For
    instance, if lines is a list of 1000 bytestrings each ending in
    \\n, dense_lines may be a list with one line in it, containing all
    the 1000's lines and their \\n's. Using dense_lines if it is
    already known is a win because the string join to create bytes in
    this function spends less time resizing the final string.
:return: (len, chunked bytestring with compressed data)
sversion %s %d %s
r�send r�data must be plain bytes was {}zcorrupt lines value {!r})r*r�r�r�r�r�r��typer9rP�
tuned_gzip�chunks_to_gzipr�map)r2r;r?r�rIr|�chunk�compressed_chunkss        r)rs�"KnitVersionedFiles._record_to_data�s���(�3�r�7�C��J��*G�G�H���
�
�k�*�U�+��
�
�g��B��'�%�/�0��E��e�U�+�+�$�5�<�<�T�%�[�I����
��r��+�+�E�2�2��7�>�>�u�E�F�F�&�5�5�f�=���3�s�-�.�/�1B�B�Br(c�\�UR5n[U5S:wa[US5eU$)Nrz.unexpected number of elements in record header)rr*r+)r2r^rys   r)rg� KnitVersionedFiles._split_header�s+���j�j�l���s�8�q�=��d�$T�U�U��
r(c���S[R;a[RSS5 UR/UR
-n[
5nUH"nURUR55 M$ U$)zSee VersionedFiles.keys.�evilrz keys scales with size of history)	�debug�debug_flags�trace�mutter_callsiterrrr�r)r2r�r�r,s    r)r�KnitVersionedFiles.keys�s_���U�&�&�&��!�!�!�%G�H��;�;�-�$�">�">�>������F��M�M�&�+�+�-�(���
r()rrrrrr)r�FN)NNNFT)NNNFr�r�r.)NNNN)2r"r#r$r%rYr/rrr r-r1r'rrPrUrSr&rirhr8rvr�r�r7r�r�r�r��classmethodr��_STREAM_MIN_BUFFER_SIZEr�r�r�r�r�r�r
rr<r�r�rqrr@r�rsrgrr'r!r(r)r^r^�s8���UY�(�4
�

�?��!����
�D�!���

�>v,�p1�$�C�!�(/�"�
	�&*�PD�
�B
+�:�&�.4�$
�0�@�-��-�DAX�*�X0�B�B�&kS�Z
=�M<�^	����!�5=�n'�� $�@'�:$� �$C�4�r(r^c�@�\rSrSrSrSSjrSrSrSrSr	Sr
S	rg
)�_ContentMapGeneratori�z7Generate texts or expose raw deltas for a set of texts.c��Xlgr.)�	_ordering)r2r�s  r)r/�_ContentMapGenerator.__init__�s��!�r(c��XR;a?[UR55nURS5n[	X2R
5$UR
U5$)zGet the content object for key.r�)�
nonlocal_keysr�r�r�r�r;r�)r2r;rir�s    r)r��!_ContentMapGenerator._get_content�sU���$�$�$��$�0�0�2�3�F��'�'��0�E�#�E�:�:�6�6��%�%�c�*�*r(c#�@# �UR5Shv�N gN7f)z;Get a record stream for the keys requested during __init__.N)�_workr
s r)r��&_ContentMapGenerator.get_record_stream�s����:�:�<���s���c#�R# �URc*URRUR5UlURn[U5nURRH`nU(d OXURX RS5H4nURS:XaMURUR5 Uv� M6 Mb URc[S5eSnURH1nX`R;aM[X`RUX5v� SnM3 g7f)z�Produce maps of text and KnitContents as dicts.

:return: (text_map, content_map) where text_map contains the texts for
    the requested versions and content_map contains the KnitContents.
NTr�z'_raw_record_map should have been filledF)r�r�r7rr`rrr�r]rorr;�_raw_record_mapr�r�)r2r`�missing_keysr,rir�r;s       r)rc�_ContentMapGenerator._work�s�����?�?�"�"�g�g�4�4�T�Y�Y�?�D�O��*�*�
��=�)���g�g�5�5�F���!�2�2�<���QU�V���&�&�(�2���#�#�F�J�J�/���
W�6����'� �!J�K�K����9�9�C��(�(�(��(��o�o�c�.B�D�P�P��E�	�s�D%D'c
��XR;aURU$[UR5S:gnURc*URRUR5UlURnURGHnX@R;aM/nUnUbGX6upxp�URXgX�45 U
nX`R;aURUSSS45 OUbMGSn[U5H_up�p�X�R;aURU
nM&URRUSUUUUS9up�U(dMQX�RU
'Ma UR5n[U5nUW	:wdM�[!UUX�U5e U(aURU$W$![an[X`5UeSnAff=f)Nrr��rl)�
_contents_mapr*r�_record_mapr�r�rfr`rorr�r�rr�rtrr6)r2�
requested_key�multiple_versionsr�r;�
components�cursorrirjr?r�rQr<�component_idr�rt�
actual_shas                 r)r��"_ContentMapGenerator._get_one_work�s����.�.�.��%�%�m�4�4� ��	�	�N�a�/�����#�#�w�w�=�=�d�>R�>R�S�D���%�%�
��9�9�C��(�(�(���J��F��$�B�;E�;M�8�F�F��!�!�6�>�"J�K����/�/�/��%�%�v�t�T�4�&@�A���$��G�@H��@T�<��n��#5�#5�5�"�0�0��>�G�%)�]�]�%?�%?��B���&��*;�&@�&�N�G�)�(�;B�*�*�<�8�AU��<�<�>�D�$�T�*�J��V�#�%�d�J��T�J�J�K�L��%�%�m�4�4��N��A �B�,�V�:��A��B�s�#F$�$
F?�.F:�:F?c�P^�/nURS5 TRRR(aURS5 OURS5 URSR	U4SjTR
555 /nTRR5H�ununupVnSR	U5nTRRUS5n	U	cSn
OSR	S	U	55n
URS
5nU(aSnOSnU(aSR	U5n
OSn
URS
R	UU
UUU
S[U5-U/55 M� SR	U5nURU5 S
R	U5nU$)a�Get the bytes to put on the wire for 'key'.

The first collection of bytes asked for returns the serialised
raw_record_map and the additional details (key, parent) for key.
Subsequent calls return just the additional details (key, parent).
The wire storage_kind given for the first key is 'knit-delta-closure',
For subsequent keys it is 'knit-delta-closure-ref'.

:param key: A key from the content generator.
:return: Bytes to put on the wire.
sknit-delta-closure�	annotatedr(r�c3�h># �UH'oTR;dMSRU5v� M) g7fr�)r`ru)r�r;r2s  �r)r��3_ContentMapGenerator._wire_bytes.<locals>.<genexpr>@	s.�����-6�c�T�EW�EW�:W�!����S�!�!�Y�s�2�2r�Nr�c3�D# �UHnSRU5v� M g7fr�r�r�s  r)r�rwT	s���)O�w��'�,�,�s�*;�*;�w�r�r��T�Fr�%d)r�r�rr�rurrfryr�r�r�r*)r2r��
map_byte_listr;�record_bytesrr�r�r�r�r��method_bytes�noeol_bytes�
next_bytes�	map_bytesr�s`               r)r�� _ContentMapGenerator._wire_bytes*	s|�����
���*�+��7�7���%�%��L�L��&��L�L���
����J�J��-1�Y�Y��
�	
��
�;?�:N�:N�:T�:T�:V�6�C�6�,�������S�)�I��o�o�)�)�#�t�4�G���'��$�z�z�)O�w�)O�O��!�=�=��1�L��"��"���$�\�\�$�/�
� �
�� � ��
�
�!�$�$�#�"���L� 1�1�$��
�
�!;W�:�H�H�]�+�	�
���Y���
�
�5�!���r()r]rlr�N)r�)r"r#r$r%rYr/r�r�rcr�r�r'r!r(r)r[r[�s&��A�"�+� �#�J:�xDr(r[c�*�\rSrSrSrSSjrSrg)r�iq	z;Content map generator reading from a VersionedFiles object.Nc�Z�[RXS9 Xl[U5UlUc[5UlO[U5UlX@l0Ul	0Ul
SUlUc URRUSS9Ul
OXPl
URRUlg)a!Create a _ContentMapGenerator.

:param versioned_files: The versioned files that the texts are being
    extracted from.
:param keys: The keys to produce content maps for.
:param nonlocal_keys: An iterable of keys(possibly intersecting keys)
    which are known to not be in this knit, but rather in one of the
    fallback knits.
:param global_map: The result of get_parent_map(keys) (or a supermap).
    This is required if get_record_stream() is to be used.
:param raw_record_map: A unparsed raw record map to use for answering
    contents.
r�NTr�)r[r/r�r&rrr`�	frozensetr��	_text_maprkrlr�rfr)r2r�rr`r�r�r�s       r)r/�_VFContentMapGenerator.__init__t	s���,	�%�%�d�%�>�!����J��	�� �!$��D��!*�=�!9�D��$�������� ����!�#'�7�7�#C�#C��D�$D�$�D� �$2� ����(�(��
r()	rkrrfrlr�r�rr`r�)NNNr�rgr!r(r)r�r�q	s��E�����0)r(r�c�*�\rSrSrSrSrSrSrSrg)r�i�	z4Content map generator sourced from a network stream.c��Xl0Ul0Ul0UlSUl/Ul[
SS5UlUnURSU5nXUnUS-nUS:Xa[5Ul
O[5Ul
URSU5nXUnUS-nURS5Vs/sH%oU(dM[URS55PM' snUl[U5nX6:Ga_URSU5n[XURS55nUS-nURSU5nXUnUS:XaSnO![SURS555nX�RU'US-nURSU5nXUnUR!S	5n	US-nURSU5nXUnUS
:Hn
US-nURSU5nXUnU(dSnO[XURS55nUS-nURSU5nXUn[#U5nUS-nXX<-n
X<-nX�U
4U4URU'X6:aGM^ggs snf)z;Construct a _NetworkContentMapGenerator from a bytes block.Nrrrur�r�r�c3�h# �UH(nU(dM[URS55v� M* g7fr�rw)r�rs  r)r��7_NetworkContentMapGenerator.__init__.<locals>.<genexpr>�	s-��� �#4���2�E�'�-�-��0�1�1�#4�s�2�!2r�ry)�_bytesr�rfrkrlr`r^r�rr`rrbrrrr*�decoder�)r2r�r�rr^rrKr;r�rr�r�rLr}s              r)r/�$_NetworkContentMapGenerator.__init__�	s��������!������������$�T�4�0������:�:�e�U�+���8�$���1����<��/�1�D�M�,�.�D�M��:�:�e�U�+���8�$���1���9=���E�9J�
�9J�g�g�)�E�'�-�-��(�)�9J�
��	��%�j���k��z�z�%��/�H���H�-�3�3�G�<�=�C��q�L�E��z�z�%��/�H��x�(�D��x����� �#'�:�:�e�#4� ���
$+�O�O�C� ��q�L�E��z�z�%��/�H��x�(�D��[�[��)�F��q�L�E��z�z�%��/�H��x�(�D��D�L�E��q�L�E��z�z�%��/�H��x�(�D�����U��2�8�8��A�B���q�L�E��z�z�%��/�H��x�(�D���I�E��q�L�E� ���7�L��M�E�)5����(M�D� � ��%�[�k�k��
s�+
I�9Ic#�p# �SnURH n[X RUX5v� SnM" g7f)z=Get a record stream for for keys requested by the bytestream.TFN)rr�r�)r2r�r;s   r)r��-_NetworkContentMapGenerator.get_record_stream�	s3������9�9�C�(��o�o�c�.B�D�P�P��E��s�46c��UR$r.)r�r
s r)r��'_NetworkContentMapGenerator._wire_bytes�	s���{�{�r()	r�rkrrfrlr�rr`r�N)	r"r#r$r%rYr/r�r�r'r!r(r)r�r��	s��>�KN�Z�r(r�c���\rSrSrSrSrSrSSjrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSr\R*rSSjrSrSr\R4rSrSrSrSr\ r Sr!Sr"g)r�i
a�
Manages knit index files.

The index is kept in memory and read on startup, to enable
fast lookups of revision information.  The cursor of the index
file is always pointing to the end, making it easy to append
entries.

_cache is a cache for fast mapping from version id to a Index
object.

_history is a cache for fast mapping from indexes to version ids.

The index data format is dictionary compressed when it comes to
parent references; a index entry may only have parents that with a
lover index number.  As a result, the index is topological sorted.

Duplicate entries may be written to the index for a single version id
if this is done then the latter one completely replaces the former:
this allows updates to correct version and parent information.
Note that the two entries may share the delta, and that successive
annotations and references MUST point to the first entry.

The index file on disc contains a header, followed by one line per knit
record. The same revision can be present in an index file more than once.
The first occurrence gets assigned a sequence number starting from 0.

The format of a single line is
REVISION_ID FLAGS BYTE_OFFSET LENGTH( PARENT_ID|PARENT_SEQUENCE_ID)* :\n
REVISION_ID is a utf8-encoded revision id
FLAGS is a comma separated list of flags about the record. Values include
    no-eol, line-delta, fulltext.
BYTE_OFFSET is the ascii representation of the byte offset in the data file
    that the compressed data starts at.
LENGTH is the ascii representation of the length of the data file.
PARENT_ID a utf-8 revision id prefixed by a '.' that is a parent of
    REVISION_ID.
PARENT_SEQUENCE_ID the ascii representation of the sequence number of a
    revision id already in the knit that is a parent of REVISION_ID.
The ' :' marker is the end of record marker.

partial writes:
when a write is interrupted to the index file, it will result in a line
that does not end in ' :'. If the ' :' is not present at the end of a line,
or at the end of the file, then the record that is missing it will be
ignored by the parser.

When writing new records to the index file, the data is preceded by '\n'
to ensure that records always start on new lines even if the last write was
interrupted. As a result its normal for the last line in the index to be
missing a trailing newline. One can be added with no harmful effects.

:ivar _kndx_cache: dict from prefix to the old state of KnitIndex objects,
    where prefix is e.g. the (fileid,) for .texts instances or () for
    constant-mapped things like .revisions, and the old state is
    tuple(history_vector, cache_dict).  This is used to prevent having an
    ABI change with the C extension that reads .kndx files.
s# bzr knit index 8
c�n�XlX lX0lX@lXPlUR5 SUlg)z.Create a _KndxIndex on transport using mapper.TN)�
_transport�_mapper�
_get_scope�
_allow_writes�
_is_locked�_reset_cacher�)r2r	r��	get_scope�allow_writes�	is_lockeds      r)r/�_KndxIndex.__init__?
s/��#����#��)��#��������r(c�T�U(a([SU55n[R"X@5e0nUHRnUSnUSSnURR	U5S-n	URX�/45n
U
SR
U5 MT [U5GHyn	XYup�URU/5 /nURUSSSnURUSR5n
U
H�up~unnnn[SU55(d[U5eUcSnS	RS
US-SRU5SU-SU-URU5S
/5n[U[5(d#[!SR#[%U555eUR
U5 UR'X~UUU5 M� [)U5(a.UR*R-U	SRU55 GMhUR/X�5 GM| g! X�4URU'e=f)a�Add multiple records to the index.

:param records: a list of tuples:
                 (key, options, access_memo, parents).
:param random_id: If True the ids being added were randomly generated
    and no check for existence will be performed.
:param missing_compression_parents: If True the records being added are
    only compressed against texts already in the index (or inside
    records). If False the records all refer to unavailable texts (or
    texts inside records) as compression parents.
c3�*# �UH	oSv� M g7f)rNr!)r�ris  r)r��)_KndxIndex.add_records.<locals>.<genexpr>X
s���:�'���)�'�rrNr�rrc3�B# �UHn[U[5v� M g7fr.r^)r��options  r)r�r�j
s���O�w�V�z�&�%�8�8�w�s�r!r�rr�r{�:zdata must be utf8 was {}r()r:rrr�rKr~r��_load_prefixes�_kndx_cacherTrar;ru�_dictionary_compressr�r�r�r�rH�
_cache_keyr*r��append_bytes�_init_index)r2r�r+r�r�pathsrir;r��path�	path_keysr��orig_history�
orig_cacherWr��posr{r�r^s                    r)r>�_KndxIndex.add_recordsI
s#��'��:�'�:�:�D��+�+�D�7�7����F���)�C���"�X�F��<�<�#�#�C�(�7�2�D��(�(���|�<�I��a�L����'���5�M�D� %���F������)��E��+�+�F�3�A�6�q�9�L��)�)�&�1�!�4�9�9�;�J�
�=F�9�C�.�1�c�4�'��O�w�O�O�O�'��0�0���"$���9�9�!�C��G�O� �I�I�g�.�!�C�K�!�D�L� �5�5�g�>� �
�	�D�&�d�E�2�2�,�6�=�=�d�4�j�I����L�L��&��O�O�C�#�t�W�E�+>G�,�|�$�$��O�O�0�0��s�x�x���G��$�$�T�1�C"��D
�,6�+E�� � ��(��s�)DH�=H�H'c�,�[UR5e)z+See _KnitGraphIndex.scan_unvalidated_index.)r�scan_unvalidated_index)r2r�s  r)r��!_KndxIndex.scan_unvalidated_index�
s��"�$�"=�"=�>�>r(c�,�[UR5e)z4See _KnitGraphIndex.get_missing_compression_parents.)rr�r
s r)r��*_KndxIndex.get_missing_compression_parents�
s��"�$�"F�"F�G�Gr(c��USSnUSn[SU55nUH&n	U	SSU:wdM[SRX55e URUup�Xz;a[	U5nURU5 OX�SnXrX4X�4X�'g)z�Cache a version record in the history array and index cache.

This is inlined into _load_data for performance. KEEP IN SYNC.
(It saves 60ms, 25% of the __init__ overhead on local 4000 record
 indexes).
Nr�c3�*# �UH	oSv� M g7f)r�Nr!)r�rBs  r)r��(_KndxIndex._cache_key.<locals>.<genexpr>�
s���=��v�r�
��rz"mismatched prefixes for {!r}, {!r}�)rrPr�r�r*r�)
r2r;rWr�r{�parent_keysr�rZr�rBr�historyrs
             r)r��_KndxIndex._cache_key�
s����S�b�����W�
��=��=�=��!�F��c�r�{�f�$� �8�?�?��Q���"�
�)�)�&�1����"���L�E��N�N�:�&��%�a�(�E�'�#�W�L��r(c��UR5nUS:Xa[R"U5eX R:wa	[	X S9eg)Nr(rR)r3�_mod_transportr�HEADERrM)r2�fpr^s   r)�check_header�_KndxIndex.check_header�
sA���{�{�}���3�;�!�+�+�D�1�1��;�;��!�$�>�>�r(c��UR5(d[R"U5eUR5UR:waUR5 ggr.)r�r�ObjectNotLockedr��_scoper�r
s r)�_check_read�_KndxIndex._check_read�
sD����� � ��(�(��.�.��?�?�����+�����,r(c��UR5(d[R"U5eUR5UR:waUR5 URS:wa[R"U5eg)z#Assert if not writes are permitted.�wN)r�rr�r�r�r��_mode�ReadOnlyObjectDirtiedErrorr
s r)r%�_KndxIndex._check_write_ok�
sa����� � ��(�(��.�.��?�?�����+������:�:����3�3�D�9�9�r(c�,�URU5n0nUHznXB;aM
URU5n[U[5(d[	U5eX$nUS:XaSnOUSnSURU5;nUR
U5n	X�XeU44X4'M| U$)a6Get the method, index_memo and compression parent for keys.

Ghosts are omitted from the result.

:param keys: An iterable of keys.
:return: A dict of key:(index_memo, compression_parent, parents,
    record_details).
    index_memo
        opaque structure to pass to read_records to extract the raw
        data
    compression_parent
        Content that this record is built upon, may be None
    parents
        Logical parents of this node
    record_details
        extra information about the content which needs to be passed to
        Factory.parse_record
r�Nrr4)r7rXr��strr;�get_options�get_position)
r2rrYr�r;rr�r�r�r�s
          r)rn�_KndxIndex.get_build_details�
s���&�(�(��.�
����C��$���_�_�S�)�F��f�c�*�*���'�'� �o�G���#�%)�"�%,�Q�Z�"���!1�!1�#�!6�6�E��*�*�3�/�J�%�7�U�O�T�F�K���
r(c�V�URU5nSU;agSU;ag[X5e)�+Return compression method of specified key.r6r�r5r�)r�rT)r2r;rWs   r)rX�_KndxIndex.get_method�
s3���"�"�3�'���'�!��
�g�
%��(��7�7r(c��URU5up#URU/5 URUSUS$![an[	X5UeSnAff=f)�9Return a list representing options.

e.g. ['foo', 'bar']
rrN)�
_split_keyr�r�ror)r2r;r��suffixrQs     r)r��_KndxIndex.get_options�
sf��
����-������V�H�%�	7��#�#�F�+�A�.�v�6�q�9�9���	7�$�S�/�Q�6��	7�s�?�
A�	A�Ac��UVs1sHo"SSiM	 nnURU5 0n[5n[U5nU(a�UR5nX$;aMUSSnURUSUSSn[UV	s/sHo�U	4-PM
 sn	5n
X�U'UR
U
Vs/sHo�U;dM
UPM sn5 U(aM�XE4$s snfs sn	fs snf![a URU5 N8f=f)�'See CombinedGraphIndex.find_ancestry().Nr�rr)	r�rr&r{r�rr�ror)r2rr;�prefixesrYrg�pending_keysr��suffix_parentsr�r��ps            r)�
find_ancestry�_KndxIndex.find_ancestrys��(,�-�����H���-����H�%��
��u���D�z����"�"�$�C�� ����"�X�F�
U�!%�!1�!1�&�!9�!�!<�S��W�!E�a�!H��$�n�$U�n�F�v�i�%7�n�$U�V��"-�3���#�#��$S��1�
�?R�Q��$S�T��l��'�'��).��"%V��$S���
&�� � ��%�
&�s)�C�!C#�C�.	C�;C�#D�Dc�^�UVs1sHo"SSiM	 nnURU5 0nUH;nUSSmURTSUSSn[U4SjU55XB'M= U$s snf![a MSf=f)��Get a map of the parents of keys.

:param keys: The keys to look up parents for.
:return: A mapping from keys to parents. Absent keys are absent from
    the mapping.
Nr�rrc3�0># �UHnTU4-v� M
 g7fr.r!)r�r�r�s  �r)r��,_KndxIndex.get_parent_map.<locals>.<genexpr>-s����#T�^�6�F�f�Y�$6�^�s�)r�r�rro)r2rr;r�r�r�r�s      @r)r7�_KndxIndex.get_parent_maps����)-�-�����H���-����H�%����C���"�X�F�
U�!%�!1�!1�&�!9�!�!<�S��W�!E�a�!H��$�#T�^�#T�T�����
��.���
��
�s�A,�A1�1
A?�>A?c��URU5up#URU/5 URUSUnXSUS4$)z�Return details needed to access the version.

:return: a tuple (key, data position, size) to hand to the access
    logic to get the record.
rrrn)r�r�r�)r2r;r�r��entrys     r)r��_KndxIndex.get_position0sQ������-������V�H�%�� � ��(��+�F�3���!�H�e�A�h�&�&r(Nc���Uc/n[5nURUR5 URU5 UR	S5 UR
R
XSS9 g)zInitialize an index.NrT)�create_parent_dir)rr�r��
writelines�seekr��put_file_non_atomic)r2r��extra_lines�sios    r)r��_KndxIndex._init_index=sR�����K��i���	�	�$�+�+�����{�#���������+�+�D��+�Nr(c��[5n[UR[5(aS/nO�[5nURR5H5n[RRU5upVURU5 M7 UVs/sHoPRRU5PM nnURU5 UH0nURUSHnURXx4-5 M M2 U$s snf)�?Get all the keys in the collection.

The keys are not ordered.
r!r)
rr�r�rr��iter_files_recursive�osr��splitextr�unmapr�r�)	r2r�r��relpaths�quoted_relpathr��extr�r�s	         r)r�_KndxIndex.keysJs���
����d�l�l�N�3�3��t�H��u�H�"&�/�/�"F�"F�"H���G�G�,�,�^�<�	�����T�"�#I�>F�F�X�T���*�*�4�0�X�H�F����H�%��F��*�*�6�2�1�5���
�
�6�I�-�.�6���
��Gs�$C>c�F�UR5 UH�nX R;dM0Ul/UlX lUR
R
U5S-nURRU5n[X5 SSS5 URUR4URU'U?U?U?M� g!,(df   N>=f![aL 0/4URU'[UR
[5(aURW5 U?U?U?GMf=f)zLoad the indices for prefixes.rN)r�r��_cache�_history�	_filenamer�rKr�r��
_load_datarr�rr�)r2r�r�r�r�s     r)r��_KndxIndex._load_prefixes`s�������F��-�-�-� ��� "��
�!'��&��<�<�+�+�F�3�g�=�D����,�,�T�2�b�#�4�,�3�15���T�]�]�/K�D�$�$�V�,������
��3�2��"�&�02�B�x�D�$�$�V�,�!�$�,�,��?�?��(�(��.������
�&�s*�9C
�5B9�3C
�9
C	�C
�
AD �D c�n�0nUH,nURUSS/5nURUS5 M. U$)z,Turn keys into a dict of prefix:suffix_list.Nr�)r~r�)r2rr�r;�prefix_keyss     r)�_partition_keys�_KndxIndex._partition_keys~sB�����C� �+�+�C���H�b�9�K����s�2�w�'���
r(c�@�U(dg/nUSSSnURUSnUHdnUSSU:wa[SRU55eUSU;aURSXESS-5 MMURSUS-5 Mf S	R	U5$)
z�Dictionary compress keys.

:param keys: The keys to generate references to.
:return: A string representation of keys. keys which are present are
    dictionary compressed, and others are emitted as fulltext with a
    '.' prefix.
r(rNr�zmismatched prefixes for {!r}r{r��.r�)r�rPr�r�ru)r2r�result_listr�rr;s      r)r��_KndxIndex._dictionary_compress�s��������a���"���� � ��(��+���C��3�B�x�6�!� �!?�!F�!F�t�!L�M�M��2�w�%���"�"�5�5�R��>�!�+<�#<�=��"�"�4�#�b�'�>�2���y�y��%�%r(c��0UlUR5UlUR5nU(aSUlgSUlg)Nr�r�)r�r�r�r�r�)r2r�s  r)r��_KndxIndex._reset_cache�s9������o�o�'����)�)�+����D�J��D�Jr(c�.^�U4SjnURUS9$)�=Figure out an optimal order to read the records for the given keys.

Sort keys, grouped by index and sorted by position.

:param keys: A list of keys whose records we want to read. This will be
    sorted 'in-place'.
:param positions: A dict, such as the one returned by
    _get_components_positions()
:return: None
c�.>�TUSnUSSSUS4$)Nrrr�r!)r;r�rs  �r)�get_sort_key�1_KndxIndex._sort_keys_by_io.<locals>.get_sort_key�s-���"�3���*�J�
�a�=��"�%�z�!�}�4�4r(r��r�)r2rrrs  ` r)r��_KndxIndex._sort_keys_by_io�s���	5��y�y�\�y�*�*r(c�T�[U[5(a
USSUSS4$USSUS4$)z#Split key into a prefix and suffix.Nr�r^rMs  r)r��_KndxIndex._split_key�s=���c�5�!�!��s��8�S���X�%�%��3�B�x��R�� � r()r�r�rr�r�r�r�r�r�r�r�r��FFr.)#r"r#r$r%rYr�r/r>r�r�r�r�r�r%rnrXr�r�r7r�r��_has_key_from_parent_map�__contains__r�rr��_missing_keys_from_parent_maprgrr�r�r�rr�r'r!r(r)r�r�
s���8�t%�F��=�~?�H�M�4?� �:�#�J8�
7�(�0�.	'��6�6�L�O��,&�8�;�;�L��&�2	�+�,2��!r(r�c��/nUH:n[U[[45(a[U5nUR	U5 M< [U5$)z�Ensure that the object and any referenced objects are plain tuples.

:param obj: a list, tuple or StaticTuple
:return: a plain tuple instance, with all children also being tuples.
)r�rr&�	as_tuplesr�)�objr��items   r)rr�sE���F����d�U�D�M�*�*��T�?�D��
�
�d�����=�r(c���\rSrSrSrSSjrSrSSjrSrSr	S	r
S
rSrSr
S
rSSjrSrSrSrSrSrSrSr\R0rSr\R6rSrSr\rSr g)r�i�z1A KnitVersionedFiles index layered on GraphIndex.Nc���XPlXlX0lX@lU(aU(d[	US5eX@lX l[5UlU(a[5Ul
gSUl
g)a�Construct a KnitGraphIndex on a graph_index.

:param graph_index: An implementation of breezy.index.GraphIndex.
:param is_locked: A callback to check whether the object should answer
    queries.
:param deltas: Allow delta-compressed records.
:param parents: If True, record knits parents, if not do not record
    parents.
:param add_callback: If not None, allow additions to the index and call
    this callback with a list of added GraphIndex nodes:
    [(node, value, node_refs), ...]
:param is_locked: A callback, returns True if the index is locked and
    thus usable.
:param track_external_parent_refs: If True, record all external parent
    references parents from added records.  These can be retrieved
    later by calling get_missing_parents().
z4Cannot do delta compression without parent tracking.N)�
_add_callback�_graph_index�_deltas�_parentsr+r�r�r�_missing_compression_parentsr�_key_dependencies)r2r�r�r�r�r��track_external_parent_refss       r)r/�_KnitGraphIndex.__init__�s_��4*��'�����
��'���L��
�!��#��,/�E��)�%�%-�Z�D�"�%)�D�"r(c�b�SRURRUR5$)Nz{}({!r}))r�rr"r!r
s r)r�_KnitGraphIndex.__repr__s%��� � ����!8�!8�$�:K�:K�L�Lr(c���UR(d[R"U5e0n[5nURnUH�upxp�UR
(a[
U
5n
UbURXz5 U	up�n
SU;aSnOSnUSX�4--
nUR(dSU;a[US5eUR
(aCUR(a.SU;a#X�S44nU(aURU
S5 OU
S	4nOU
4nOU
(a[US
5eS	nX�4XG'M� U(dyURU5nUHbunp~nUSSn
[XG5nUSSSnUSSXGSSS:wdU
U:wa([U5n[USRX�4U55eXG	Md /nUR
(a0UR5Hunup�URX~U45 M O.UR5Hunup�URX~45 M URU5 U(a,UR!U5 UR"R%U5 UR"R!U5 g)
a�Add multiple records to the index.

This function does not insert data into the Immutable GraphIndex
backing the KnitGraphIndex, instead it prepares data for insertion by
the caller and checks that it is safe to insert then calls
self._add_callback with the prepared GraphIndex nodes.

:param records: a list of tuples:
                 (key, options, access_memo, parents).
:param random_id: If True the ids being added were randomly generated
    and no check for existence will be performed.
:param missing_compression_parents: If True the records being added are
    only compressed against texts already in the index (or inside
    records). If False the records all refer to unavailable texts (or
    texts inside records) as compression parents.
Nr4r�r�s%d %dr5z+attempt to add line-delta in non-delta knitrr!z5attempt to add node with parents in parentless index.rz*inconsistent details in add_records: {} {})r r�
ReadOnlyErrorrr%r#r�add_referencesr"r+r�_get_entriesrr�ryr�r�r$r�)r2r�r+r�r�compression_parents�key_dependenciesr;rWrJr�rr�r{�value�	node_refs�
present_nodesr�passed�passed_parentsr�s                     r)r>�_KnitGraphIndex.add_records
s~��"�!�!��&�&�t�,�,���!�e���1�1��29�.�C�+��}�}���.��#�/�$�3�3�C�A�*��E���G�#������X���+�+�E��<�<� �G�+�%��K����}�}��<�<�$��/�%,�q�z�m�$<�	�6�/�3�3�G�A�J�?��%,�b�M�	�!(�
�I��%��U����	��*�D�I�A3:�D� �-�-�d�3�M�1>�-���I�#�B�Q�-��"�4�9�-��!'���2�A�����1�:���1��a��!2�2�g��6O� )�)� 4�I�%��D�K�K�"�.������I�2?����=�=�+/�:�:�<�'��'�e��
�
�s�9�5�6�,8�,0�:�:�<�'��'�e��
�
�s�l�+�,8����6�"�&�
 �1�1�$�7��-�-�4�4�5H�I��)�)�;�;�D�Ar(c�N�UR(aJURSS9nURURU55 URRU5 URb=UR5H(nURRUSUSS5 M* gg)z�Inform this _KnitGraphIndex that there is an unvalidated index.

This allows this _KnitGraphIndex to keep track of any missing
compression parents we may want to have filled in to make those
indices valid.

:param graph_index: A GraphIndex
r)�ref_list_numNrnr)	r"�external_referencesr�r7r$r�r%�iter_all_entriesr,)r2r��new_missing�nodes    r)r��&_KnitGraphIndex.scan_unvalidated_indexis����<�<�%�9�9�q�9�I�K��)�)�$�*=�*=�k�*J�K��-�-�4�4�[�A��!�!�-�$�4�4�6���&�&�5�5�d�1�g�t�A�w�q�z�J�7�.r(c�,�[UR5$)z�Return the keys of missing compression parents.

Missing compression parents occur when a record stream was missing
basis texts, or a index was scanned that had missing basis texts.
)r�r$r
s r)r��/_KnitGraphIndex.get_missing_compression_parents|s����:�:�;�;r(c���URRURURR555 [	URR55$)z#Return the keys of missing parents.)r%�satisfy_refs_for_keysr7�get_unsatisfied_refsr�r
s r)�get_missing_parents�#_KnitGraphIndex.get_missing_parents�sQ��
	
���4�4����� 6� 6� K� K� M�N�	
���/�/�D�D�F�G�Gr(c�Z�UR5(d[R"U5eg)z!Raise if reads are not permitted.N�r�rr�r
s r)r��_KnitGraphIndex._check_read��%����� � ��(�(��.�.�!r(c�Z�UR5(d[R"U5eg)z#Assert if writes are not permitted.NrEr
s r)r%�_KnitGraphIndex._check_write_ok�rGr(c�~�USSnU(dg[U5S:wa[SRU55eUS$)Nrnrz"Too many compression parents: {!r}r)r*r�r�)r2�an_entryr.s   r)�_compression_parent�#_KnitGraphIndex._compression_parent�sO��'�q�k�!�n��"���"�#�q�(� �4�;�;�<O�P��
�#�1�%�%r(c�J�UR5 0nURUS5nUHxnUSnUR(dSnOUSSnUR(dSnOUR	U5nUSSSS:HnU(aS	n	OS
n	URU5UUX�44X%'Mz U$)a>Get the method, index_memo and compression parent for version_ids.

Ghosts are omitted from the result.

:param keys: An iterable of keys.
:return: A dict of key:
    (index_memo, compression_parent, parents, record_details).
    index_memo
        opaque structure to pass to read_records to extract the raw
        data
    compression_parent
        Content that this record is built upon, may be None
    parents
        Logical parents of this node
    record_details
        extra information about the content which needs to be passed to
        Factory.parse_record
Frr!rnrNrr�r�r�)r�r-r#r"rL�_node_to_position)
r2rr��entriesr�r;r��compression_parent_keyr�rs
          r)rn�!_KnitGraphIndex.get_build_details�s���&	
�������#�#�D�%�0���E���(�C��=�=�����(�1�+���<�<�)-�&�)-�)A�)A�%�)H�&��!�H�Q�q�M�T�)�E�%�%��#���&�&�u�-�&����	�F�K��*�
r(c#��# �[U5n[5nUR(a;URRU5HnUv� UR	US5 M OGURRU5H(nUSUSUSS4v� UR	US5 M* U(a3URU5nU(a[
UR5U5egg7f)zIGet the entries for keys.

:param keys: An iterable of index key tuples.
rrrr!N)rr#r!�iter_entriesrrzrr{)r2r�
check_present�
found_keysr;rgs      r)r-�_KnitGraphIndex._get_entries�s����
�4�y���U�
��=�=��)�)�6�6�t�<���
����t�A�w�'�=�
�)�)�6�6�t�<���1�g�t�A�w��Q���3�3����t�A�w�'�=���?�?�:�6�L��(��)9�)9�);�T�B�B���s�C$C&c�B�URURU55$)r�)�_get_method�	_get_noderMs  r)rX�_KnitGraphIndex.get_method�s��������s� 3�4�4r(c�V�UR(dgURU5(agg)Nr�r�)r"rL�r2r;s  r)rY�_KnitGraphIndex._get_method�s#���|�|���#�#�D�)�)��r(c�|�[URU/55S$![an[X5UeSnAff=f)Nr)r&r-�
IndexErrorr)r2r;rQs   r)rZ�_KnitGraphIndex._get_node�sA��	7���)�)�3�%�0�1�!�4�4���	7�$�S�/�Q�6��	7�s� �
;�6�;c��URU5nURU5RS5/nUSSSS:XaURS5 U$)r�r�rrrr�r4)rZrYr�r�)r2r;r;rWs    r)r��_KnitGraphIndex.get_options�sS��
�~�~�c�"���#�#�D�)�0�0��9�:����7�1�Q�<�4���N�N�9�%��r(c�:�URRUS5$)r�r)r!r�r�s  r)r��_KnitGraphIndex.find_ancestry
s��� � �.�.�t�Q�7�7r(c��UR5 URU5n0nUR(aUHnUSSX4S'M U$UH
nSX4S'M U$)r�rnrrN)r�r-r#)r2r�nodesr�r;s     r)r7�_KnitGraphIndex.get_parent_map
sl��	
�����!�!�$�'�����=�=���"&�q�'�!�*��A�w���
�
���"&��A�w����
r(c�F�URU5nURU5$)z�Return details needed to access the version.

:return: a tuple (index, data position, size) to hand to the access
    logic to get the record.
)rZrO)r2r;r;s   r)r��_KnitGraphIndex.get_position
s#���~�~�c�"���%�%�d�+�+r(c��UR5 URR5Vs/sHoSPM	 sn$s snf)r�r)r�r!r9r]s  r)r�_KnitGraphIndex.keys$
s;��
	
����$(�$5�$5�$F�$F�$H�I�$H�D�Q��$H�I�I��Is�>c�p�USSSRS5nUS[US5[US54$)z+Convert an index value to position details.rrNr�r)rr�)r2r;�bitss   r)rO�!_KnitGraphIndex._node_to_position.
s=���A�w�q�r�{� � ��&���A�w��D��G��c�$�q�'�l�2�2r(c�.^�U4SjnURUS9$)rc�>�TUS$)Nrr!)r;rs �r)�get_index_memo�8_KnitGraphIndex._sort_keys_by_io.<locals>.get_index_memo?
s����S�>�!�$�$r(r�r)r2rrrrs  ` r)r�� _KnitGraphIndex._sort_keys_by_io3
s���	%��y�y�^�y�,�,r()r r"r!r�r%r$r#r�)FTNFrr�)!r"r#r$r%rYr/rr>r�r�rBr�r%rLrnr-rXrYrZr�r�r7r�r�rrrrrgrOr�rr'r!r(r)r�r��s���;����#(�**�XM�]B�~K�&<�H�/�
/�

&�+�ZC�*5��7�	�8��$,��6�6�L�J��;�;�L�3�
-�,2�r(r�c�6�\rSrSrSrSrSrSrSrSr	Sr
g	)
r�iL
z!Access to records in .knit files.c��XlX lg)z�Create a _KnitKeyAccess with transport and mapper.

:param transport: The transport the access object is rooted at.
:param mapper: The mapper used to map keys to .knit files.
N)r�r�)r2r	r�s   r)r/�_KnitKeyAccess.__init__O
s��$���r(c��URRU5nURRUS-SR	U55nXU4$![
Ra` URR[R"U55 URRUS-SR	U55nNwf=f)a�Add raw knit bytes to a storage area.

The data is spooled to the container writer in one bytes-record per
raw data item.

:param key: The key of the raw data segment
:param size: The size of the raw data segment
:param raw_data: A chunked bytestring containing the data.
:return: opaque index memo to retrieve the record later.
    For _KnitKeyAccess the memo is (key, pos, length), where the key is
    the record key.
rr()
r�rKr�r�rur�r�mkdirr�dirname)r2r;r{r�r��bases      r)r=�_KnitKeyAccess.add_raw_recordX
s����|�|����$��	T��?�?�/�/��w������@R�S�D��4� � ���(�(�	T��O�O�!�!�'�/�/�$�"7�8��?�?�/�/��w������@R�S�D�	T�s�.A�A1C�Cc��SRU5n[U[5(d#[SR	[U555e/nSnUH1upVX$XF-/nUR
URXVU55 XF-
nM3 U$)a�Add raw knit bytes to a storage area.

The data is spooled to the container writer in one bytes-record per
raw data item.

:param sizes: An iterable of tuples containing the key and size of each
    raw data segment.
:param raw_data: A chunked bytestring containing the data.
:return: A list of memos to retrieve the record later. Each memo is an
    opaque index memo. For _KnitKeyAccess the memo is (key, pos,
    length), where the key is the record key.
r(rGr)rur�r�r�r�rHr�r=)r2�	key_sizesr�r�rJr;r{r}s        r)�add_raw_records�_KnitKeyAccess.add_raw_recordso
s����8�8�H�%���(�E�*�*� �1�8�8��h��H��
�����#�I�C�$�f�m�<�=�L��M�M�$�-�-�c��F�G��N�F�#��
r(c��g)zNFlush pending writes on this access object.

For .knit files this is a no-op.
Nr!r
s r)r��_KnitKeyAccess.flush�
s��
	
r(c#�p# �/nSnUHAupEnX4SS:XaWRXV45 M"UbURUW45 USSnXV4/nMC UbURUW45 UHKup�URRU5S-n
URR	X�5H	up�Uv� M MM g7f)z�Get the raw bytes for a records.

:param memos_for_retrieval: An iterable containing the access memo for
    retrieving the bytes.
:return: An iterator over the bytes of the records.
Nr�r)r�r�rKr��readv)
r2�memos_for_retrieval�
request_lists�current_prefixr;rJ�length�current_listr��read_vectorr��_posrHs
             r)r;�_KnitKeyAccess.get_raw_records�
s�����
���#6��C���S�b��)��#�#�V�$4�5�!�-�!�(�(�.�,�)G�H�!$�S�b���!'� 0�1��$7��%�� � �.�,�!?�@�#0��F��<�<�#�#�F�+�g�5�D�"�o�o�3�3�D�F�
���
�G�$1�s�B4B6)r�r�N)r"r#r$r%rYr/r=rr�r;r'r!r(r)r�r�L
s��+��!�.�:
�r(r�c�L�[U5n[URU55$)z�Annotate a knit with no cached annotations.

This implementation is for knits with no cached annotations.
It will work for knits with cached annotations, but this is not
recommended.
)r�r�r�)r��revision_idr�s   r)�
annotate_knitr��
s$���t�$�I��	�'�'��4�5�5r(c�R�\rSrSrSrSrSrSSjrSrSr	S	r
S
rSrSr
S
rg)r�i�
z$Build up the annotations for a text.c��[RRX5 0Ul0Ul0Ul0Ul0Ul0Ulgr.)	r�	Annotatorr/�_matching_blocks�_content_objects�_num_compression_children�_pending_deltas�_pending_annotation�_all_build_details)r2r�s  r)r/�_KnitAnnotator.__init__�
sN�����#�#�D�-�!#���!#���)+��&� "���$&�� �"$��r(c��U1n/n[5nSURU'U(GaGUnURRR	U5nUR
R
U5 [5nUR5H�upUup�p�X�RU'SUl	URX45 UR
U
Vs/sHo�UR
;dMUPM sn5 U
(a@U
H:n
X�R;aURU
==S-
ss'M+SURU
'M< U	(dM�X�R;aURU	==S-
ss'M�SURU	'M� URU5nU(a�UH�nXR;a�XR;a�URU5 URUn
U
H:n
X�R;aURU
==S-
ss'M+SURU
'M< UR
U
Vs/sHo�UR
;dMUPM sn5 M�[R "XR5e U(aGMGUR#5 X44$s snfs snf)a�Get the graphs for building texts and annotations.

The data you need for creating a full text may be different than the
data you need to annotate that text. (At a minimum, you need both
parents to create an annotation, but only need 1 parent to generate the
fulltext.)

:return: A list of (key, index_memo) records, suitable for
    passing to read_records_iter to start reading in the raw data from
    the pack file.
rN)r�_num_needed_children�_vfrrnr�r�ry�_parent_map�_heads_providerr�r�rz�_text_cacherrr�reverse)r2r;r�r��ann_keys�this_iterationr�r�r�r�r�rjr�r �missing_versionss               r)�_get_build_graph�_KnitAnnotator._get_build_graph�
sI���%�����5��)*��!�!�#�&��$�N� �H�H�O�O�=�=�n�M�M��#�#�*�*�=�9��e�G� -� 3� 3� 5���PW�M���(3� � ��%�'+��$�����0�1���� +�P��1��8O�8O�/O�Q��P���&1�
�%�)B�)B�B� �5�5�j�A�Q�F�A�DE�D�5�5�j�A�	'2�
&�%�)�-K�-K�K��6�6�7I�J�a�O�J�MN��6�6�7I�J�'!6�* .�8�8��G���+�C��.�.�.�3�:J�:J�3J�!���S�)�&*�&6�&6�s�&;��*5�J�)�-F�-F�F� $� 9� 9�*� E�� J� E�HI�� 9� 9�*� E�	+6�
 ���(3�X��1��@W�@W�7W�Q��X��%�7�7��X�X�F�F�,�=�g�`	����� � ��GQ��8Ys�J
�J
�J
�3J
Nc#�# �[URR5S:�a'[RRXUS9Shv�N gUR
U5up4[URU55H7unupgnUb%UR[S5U[U55 XgU4v� M9 UH#nURUn[U5nXgU4v� M% gN�![RaIn	URRRU	5 UR R#5 Sn	A	OSn	A	ff=fM�7f)Nr)r�
annotating)r*r�rrr��_get_needed_textsr�r�_extract_textsr�rr�r�r�rr�r��clear)
r2r;rr�r��idx�sub_keyrtrqrQs
          r)r�� _KnitAnnotator._get_needed_textss0����t�x�x�/�/�0�1�4��)�)�;�;�D�"�;�M�M�M���
0�$(�$9�$9�#�$>�!��7@��'�'��0�8�3�C�3�'���~��	�	�'�,�"7��c�'�l�K�!��2�2�8� (�G��+�+�G�4�D� #�D�	�I�!��2�2� (��
N�� �.�.�
0���� � �0�0��3��'�'�-�-�/�/��
0���s=�AE�C!�E�BC#� E�#E�7?D;�6E�;E�Ec�~�URUn[[RX5U55nX`RX4'gr.)r�r&r
r7r�)r2r;r�r�r��parent_lines�blockss       r)�_cache_delta_blocks�"_KnitAnnotator._cache_delta_blocks.s;���'�'�(:�;���k�7�7��U�S�T��;A���s�7�8r(c���SnU(a�X0R;a.URRU/5RXXE45 gURUnUS-nUS:Xa7URRU5nURRU5 OXpRU'URUnURRRXXXSS9up�O)URRRXUS5up�URRUS5S:�aX�RU'U	R5nX�RU'UbURXXk5 U$)NrrTrj)
r�r�r~r�r�r{r�rr�r�rtr�r�)r2r;r�r�rirjr��numrkr<r�r�s            r)�_expand_record�_KnitAnnotator._expand_record3sd�����!�)>�)>�>��$�$�/�/�0B�B�G�N�N��v�>����0�0�1C�D�C��1�H�C��a�x�#�4�4�8�8�9K�L���.�.�2�2�3E�F�EH�.�.�/A�B�#�4�4�5G�H��"�X�X�.�.�;�;��^�T�<��N�G�U�
���*�*�7�7��^�T��J�G��)�)�-�-�c�1�5��9�)0�!�!�#�&������ %��������$�$�S�e�K��r(c��X4nX@R;a-URRU5nURUnXe4$[RRXX#5$)a�Get the list of annotations for the parent, and the matching lines.

:param text: The opaque value given by _get_needed_texts
:param parent_key: The key for the parent text
:return: (parent_annotations, matching_blocks)
    parent_annotations is a list as long as the number of lines in
        parent
    matching_blocks is a list of (parent_idx, text_idx, len) tuples
        indicating which lines match between the two texts
)r�r{�_annotations_cacherr��#_get_parent_annotations_and_matches)r2r;rtr �	block_keyr��parent_annotationss       r)r��2_KnitAnnotator._get_parent_annotations_and_matches]sf���%�	��-�-�-��*�*�.�.�y�9�F�!%�!8�!8��!D��%�-�-��!�!�E�E��t�
�	
r(c
���/nXR;aeUnURRU5nUHBupVpxURXVX7U5 URXV5(dM1UR	U5 MD XR
;aYUR
RU5nUR
UV	V
s/sHup�URX�5(dMU	PM! sn
n	5 U$s sn
n	f)zhThe content for 'key' was just processed.

Determine if there is any more pending work to be processed.
)r�r{r��_check_ready_for_annotationsr�r�r�)r2r;�	to_returnr��children�	child_keyr�rirjr��p_keyss           r)�_process_pending�_KnitAnnotator._process_pendingqs���
�	��&�&�&�!$���+�+�/�/��4�H�BJ�>�	���#�#��,>����4�4�Y�L�L��$�$�Y�/�CK��*�*�*��/�/�3�3�C�8�H����&.��%-�	���8�8��C��%-��
����
s�1C!
�C!
c��UH@nX0R;dMURRU/5RX45  g g)z�Return true if this text is ready to be yielded.

Otherwise, this will return False, and queue the text into
self._pending_annotation
FT)r�r�r~r�)r2r;r�r s    r)r��+_KnitAnnotator._check_ready_for_annotations�sM��&�J��!8�!8�8��(�(�3�3�J��C�J�J��&���&�r(c#��# �URRU5H�up#nURUnUupgp�URX(XsU	5n
U
cM2UR	X(5nU(aX*[U
54v� UR
U5nU(dMsUn
/nU
HAnURUn
X*[U
54v� URUR
U55 MC U(aMTM� g7f)z2Extract the various texts needed based on records.N)	r�rr�r�r�r*r�r�r�)r2r�r;ri�_digestr�r�r�r�rjr��yield_this_text�
to_process�this_processs              r)r��_KnitAnnotator._extract_texts�s����>%)�H�H�$?�$?��$H� �C���-�-�c�2�G�CJ�@�Q�K��'�'��"4�n��E��}��#�?�?��Q�O���#�e�*�,�,��.�.�s�3�J��*�)���
�'�C� �,�,�S�1�E��c�%�j�0�0��%�%�d�&;�&;�C�&@�A�(��*�#%I�s�BC*�AC*�%C*)r�r�r�r�r�r�r�r.)r"r#r$r%rYr/r�r�r�r�r�r�r�r�r'r!r(r)r�r��
s7��.�%�,A!�F0�2B�
(�T
�(�8�"6Br(r�)�_load_data_c)�
_load_data_py)RrYr�r��iorr�globalsr�rrrr	r��bzr.versionedfiler
rrr
rrrrrrrrrrrrrr��DATA_SUFFIX�INDEX_SUFFIXrYrr+r6r?rGrMrTr[rir�r�r�r�r�r�r�r�rr
r;r�rgr`rbr�r�r�rr^r[r�r�r�rr�r�r�r�r��_knit_load_data_pyxr�r�ImportErrorrQ�failed_to_load_extension�_knit_load_data_pyr�r!r(r)�<module>r�sN��"#�J�	��%���I���,)�(�*�
�
�
�M�L�B�B�"�!�����)��� ���)��
�k�
� +��+�+�I�+�!�i�!�
�Y�
� "�"� �{� �
 �+�
 � 
�K�
�$
�{�
�:
��
�$
�;�
�<\5��\5�~1
�^�1
�h)�*�Z5:�5:�p&1�;�&1�R"�{�"�J  �  �Fr&�,�r&�j:,�|�:,�z�$)�X!�
O�8]�4�]�@'|�|�~3)�1�3)�lX�"6�X�vE!�E!�P�q2�q2�h_�_�D6�[B�X�'�'�[B�|@�?���@��$�$�Q�'�?�?��@�s�G�H�$H�H

Youez - 2016 - github.com/yon3zu
LinuXploit