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__/vf_repository.cpython-313.pyc
�

p��g��"�SrSSKJr SSKJr \"\"5S5 SSKJr SSKJr SSK	J
r
JrJrJ
r
JrJr SS	KJrJr S
SKJrJr S
SKJr S
S
K	JrJr "SS\5r"SS\
5r"SS\
5r"SS\\5r"SS\\5r"SS5r"SS5r "SS5r!"SS\5r""S S!\"5r#"S"S#\"5r$\RJ"\"5 \RJ"\#5 \RJ"\$5 S(S%jr&S&r'S'r(g$))z0Repository formats built around versioned files.�)�BytesIO�)�lazy_importa�
import itertools

from breezy import (
    config as _mod_config,
    debug,
    fifo_cache,
    gpg,
    graph,
    lru_cache,
    osutils,
    revision as _mod_revision,
    tsort,
    ui,
    )
from breezy.bzr import (
    fetch as _mod_fetch,
    check,
    generate_ids,
    inventory_delta,
    inventorytree,
    versionedfile,
    vf_search,
    )
from breezy.bzr.bundle import serializer

from breezy.i18n import gettext
from breezy.bzr.testament import Testament
)�errors)�only_raises)�
CommitBuilder�FetchResult�InterRepository�
Repository�RepositoryFormat�
WriteGroup)�mutter�note�)�	Inventory�
entry_factory)�InventoryTreeChange)�MetaDirRepository�RepositoryFormatMetaDirc�0�\rSrSrSrSrSrSrSrSr	Sr
Srg)�VersionedFileRepositoryFormat�HzDBase class for all repository formats that are VersionedFiles-based.T�	unorderedF�N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__�supports_full_versioned_files�supports_versioned_directories�supports_unreferenced_revisions�_commit_inv_deltas�_fetch_order�_fetch_uses_deltas�__static_attributes__r��:/usr/lib/python3/dist-packages/breezy/bzr/vf_repository.pyrrHs.��N�$(�!�%)�"�&*�#����L�
�r'rc�^�\rSrSrSrSU4SjjrSrSrSrSr	Sr
S	rS
rSr
SrS
rSr\4SjrSrSrU=r$)�VersionedFileCommitBuilder�\zECommit builder implementation for versioned files based repositories.c�:>�[TU]UUUUUUUUU	5	 URSnX�lSUl/Ul[RUR55RUl
SUlX�lg![a [R
nNpf=f)NrF)�super�__init__�parents�
IndexError�
_mod_revision�
NULL_REVISION�basis_delta_revision�_new_inventory�_basis_delta�graph�
HeadsCache�	get_graph�heads�"_VersionedFileCommitBuilder__heads�_any_changes�_owns_transaction)
�self�
repositoryr/�config_stack�	timestamp�timezone�	committer�revprops�revision_id�lossy�owns_transaction�basis_id�	__class__s
            �r(r.�#VersionedFileCommitBuilder.__init___s����	������������
	
�	3��|�|�A��H�%-�!�"�������'�'�
�(<�(<�(>�?�E�E���!���!1����	3�$�2�2�H�	3�s�A=�=B�Bc��UR$)z�Return True if any entries were changed.

This includes merge-only changes. It is the core for the --unchanged
detection in commit.

:return: True if any changes have occured.
)r;�r=s r(�any_changes�&VersionedFileCommitBuilder.any_changes�s��� � � r'c�L�URR(dgURRR(d[R
"S5eURVs/sHo4PM nnURRRRU5nUVs1sHoDU;dM
UiM nn[[URR55nUVs/sH
nSUS4PM nnU(awU(apUR5nURURR5n	URR5n
U
RX�5nU(a	U(aMpU(a[R
"S5egs snfs snfs snf)a*Ensure that appropriate inventories are available.

This only applies to repositories that are stacked, and is about
enusring the stacking invariants. Namely, that for any revision that is
present, we either have all of the file content, or we have the parent
inventory and the delta file content.
N�yCannot commit directly to a stacked branch in pre-2a formats. See https://bugs.launchpad.net/bzr/+bug/375013 for details.�inventoriesrz9Unable to fill in parent inventories for a stacked branch)r>�_fallback_repositories�_format�
supports_chksr�BzrErrorr/rP�_index�get_parent_map�list�reversed�pop�_get_source�	_get_sink�insert_missing_keys)r=�p�parent_keys�
parent_map�pk�missing_parent_keys�fallback_repos�missing_keys�
fallback_repo�source�sinks           r(�_ensure_fallback_inventories�7VersionedFileCommitBuilder._ensure_fallback_inventories�sK�����5�5�����&�&�4�4��/�/�J��
�&*�\�\�2�\��t�\��2��_�_�0�0�7�7�F�F�{�S�
�,7�P�K�b�Z�;O�r�K��P��h�t���'M�'M�N�O��9L�M�9L�2���1��.�9L��M��~�*�.�.�0�M�"�.�.�t���/F�/F�G�F��?�?�,�,�.�D��3�3�F�I�L�	�~�~�
��/�/�K��
���3��P��Ms�&F�'	F�4F�(F!c
��URUS5 [RURURUR
UURURURS9nURUl
URRS5nU[R[R4;an[!X R#55nUR%5nUR&R)[*R-UR5UUR5 UR&R5U5 UR75 UR8(aUR&R;5 UR$![*R.a+nU[R:Xa[1SU5 SnAN�eSnAf[*R2a+nU[R:Xa[1SU5 SnAN�eSnAff=f)zLMake the actual commit.

:return: The revision id of the recorded revision.
zcommit message)r@rArB�message�inventory_sha1rD�
properties�create_signatureszskipping commit signature: %sNzcommit signature failed: %s)�_validate_unicode_textr1�Revision�
_timestamp�	_timezone�
_committer�inv_sha1�_new_revision_id�	_revpropsr/�
parent_ids�
_config_stack�get�_mod_config�SIGN_ALWAYS�SIGN_WHEN_POSSIBLE�	Testament�
revision_tree�
as_short_textr>�store_revision_signature�gpg�GPGStrategy�GpgNotInstalledr�
SigningFailed�
_add_revisionrgr<�commit_write_group)r=rj�revrm�	testament�	plaintext�es       r(�commit�!VersionedFileCommitBuilder.commit�s���
	
�#�#�G�-=�>��$�$��o�o��^�^��o�o���=�=��-�-��~�~�%�
������� �.�.�2�2�3F�G����#�#��*�*�!
�
�"�#�'9�'9�';�<�I�!�/�/�1�I�
����8�8��O�O�D�$6�$6�7���)�)��	
���%�%�c�*��)�)�+��!�!��O�O�.�.�0��$�$�$���&�&�
�$��(F�(F�F��8�!�<�<����$�$�
�$��(F�(F�F��6��:�:���	
�s1�"AF�H� G�G�H� G?�>G?�?Hc�\�UR(aURR5 gg)z%Abort the commit that is being built.N)r<r>�abort_write_grouprKs r(�abort� VersionedFileCommitBuilder.abort�s ���!�!��O�O�-�-�/�"r'c���URc*URRUR5Ul[RURURUR5$)a'Return the tree that was just committed.

After calling commit() this can be called to get a
RevisionTree representing the newly committed tree. This is
preferred to calling Repository.revision_tree() because that may
require deserializing the inventory, while we already have a copy in
memory.
)r4r>�
get_inventoryrt�
inventorytree�InventoryRevisionTreerKs r(r}�(VersionedFileCommitBuilder.revision_tree�sW�����&�"&�/�/�"?�"?��@U�@U�"V�D���2�2��O�O�T�0�0�$�2G�2G�
�	
r'c���URnURRXRURUR
5uUlUlUR$)z�Tell the builder that the inventory is finished.

:return: The inventory id in the repository, which can be used with
    repository.get_inventory.
)r3r>�add_inventory_by_deltar5rtr/rsr4)r=rGs  r(�finish_inventory�+VersionedFileCommitBuilder.finish_inventory�sR���,�,��-1�_�_�-S�-S��'�'��)>�)>����.
�*��
�t�*��$�$�$r'c�V�[RURUR5$)zReturn new revision-id.)�generate_ids�gen_revision_idrrrprKs r(�_gen_revision_id�+VersionedFileCommitBuilder._gen_revision_id�s���+�+�D�O�O�T�_�_�M�Mr'c�T�URR5(ag[UR5S:Xa[R
"5e[S"URS5SS5nURUl	URRSSURU45 g)z�Enforce an appropriate root object change.

This is called once when record_iter_changes is called, if and only if
the root was not in the delta calculated by record_iter_changes.

:param tree: The tree which is being committed.
Nr�	directory�)
r>�supports_rich_root�lenr/r�RootMissingr�path2idrt�revisionr5�append�file_id)r=�tree�entrys   r(�_require_root_change�/VersionedFileCommitBuilder._require_root_changes����?�?�-�-�/�/���t�|�|���!��$�$�&�&��k�*�4�<�<��+;�R��F���.�.������ � �"�b�%�-�-��!?�@r'c�b�URUR5(d,SX1RU4nURRU5 U$XR	UR5:waEURUR5X1RU4nURRU5 U$g)z/Get a delta against the basis inventory for ie.N)�has_idr�r5r��	get_entry�id2path)r=�ie�	basis_inv�path�results     r(�
_get_delta�%VersionedFileCommitBuilder._get_deltas�������
�
�+�+��D�*�*�b�1�F����$�$�V�,��M�
�&�&�r�z�z�2�
2� �'�'��
�
�3�T�:�:�r�J�F����$�$�V�,��M�r'c�$�URU5$)z�Calculate the graph heads for revision_ids in the graph of file_id.

This can use either a per-file graph or a global revision graph as we
have an identity relationship between the two graphs.
)r:)r=r��revision_idss   r(�_heads�!VersionedFileCommitBuilder._heads"s���|�|�L�)�)r'c��UR$)z�Return the complete inventory delta versus the basis inventory.

:return: An inventory delta, suitable for use with apply_delta, or
    Repository.add_inventory_by_delta, etc.
)r5rKs r(�get_basis_delta�*VersionedFileCommitBuilder.get_basis_delta*s��� � � r'c#�B# �0n0nSn[URRUR55nU(aUSn
O)URR[R5n
U
Rn[UR5S:�Ga4X RS:waU(d[S5eUSSGHnURRU5H�n
U
ScMU
SU;a�U
Sb[URU
S5nURU
SR/X]S'URUU
SRU
S0XmS'MuU
SR/X]S'U
SRU
S0XmS'M�X]SR
U
SR5 U
SXmSU
SR'M� GM O0n0nUHfn
U
R Sb'URU
R"5R/nO/nU
UR%U
R"U54X�R"'Mh ['U5['U5-
nUH�nURU5n[)UUR+U5UR+U54SS	UR,UR,4UR.UR.4UR0UR04UR2UR245n
X�U4UU'M� SnUR6nUR8nUR;5GHPun
nU
R<S(Ga�U
R0SnU
R"nUU"UU
R.SU
R,S5nUR?U
R"['U55n/nUH-nUU;dMUR
U5 URAU5 M/ Sn[U5S:Xa�UR%U5nU(aUR%USS5nOSnUcSnOVUR0UR0:wd4UR,UR,:wdUR.UR.:waSnOSnOSnUS
:Xa�U
R2S(aSUlOSUlU(a'WR2UR2:Xa
URBnOSnUREU
R S5un n!URGUU UUU!(aU!RHOSS9uUl!Ul%U
R SURBU!44v� U RQ5 GO�US:XaoURSU
R S5Ul*U(aWRTURT:XaSnGOeURGU
R"[W5USSS9 GO>US
:XacU(aSnGO-U
R SS:wdURRY5(a%URGU
R"[W5USSS9 O�US:Xa�URRZR\(d+[R^"UR`UR5eURcU
R S5n"U"Ul2U(aWRdU":XaSnO@URGU
R"[W5USSS9 O[gSRiU55eU(dUUlOWRUlOSnU
R Sn#UR
U
R SU#U
R"U45 U#S:XdGMNSnGMS [U5S:�aU[R:wd#[U5S:�aU[R:XaSUl5U(dURmU5 X l7g![R
a� /nURH�n	UR
URRU	55 M0![R
aU U(d[RnSnUR
URR[R55 M�f=f GNsf=f![R4a GMvf=f![LRNa( SnWRJUl%URBUl!GN�f=f!U RQ5 f=f7f)a�Record a new tree via iter_changes.

:param tree: The tree to obtain text contents from for changed objects.
:param basis_revision_id: The revision id of the tree the iter_changes
    has been generated against. Currently assumed to be the same
    as self.parents[0] - if it is not, errors may occur.
:param iter_changes: An iter_changes iterator with the changes to apply
    to basis_revision_id. The iterator must not include any items with
    a current kind of None - missing items must be either filtered out
    or errored-on before record_iter_changes sees the item.
:param _entry_factory: Private method to bind entry_factory locally for
    performance.
:return: A generator of (relpath, fs_hash) tuples for use with
    tree._observed_sha1.
FTrz5arbitrary basis parents not yet supported with mergesrNr�)TT�file��size�symlinkr�r�ztree-referencezunknown kind {!r})8rWr>�revision_treesr/r�NoSuchRevisionr�r}r1r2�root_inventoryr��	Exception�_make_deltar�r�r�r�rx�setrr��	parent_id�name�kind�
executable�NoSuchIdr5rt�values�	versionedr��remove�	text_sha1�get_file_with_stat�_add_file_to_weave�st_size�	text_size�
versionedfile�ExistingContent�close�get_symlink_target�symlink_targetrr�rR�supports_tree_reference�UnsupportedOperation�
add_reference�get_reference_revision�reference_revision�AssertionError�formatr;r�r3)$r=r��basis_revision_id�iter_changes�_entry_factory�
merged_ids�parent_entries�ghost_basis�revtreesrD�
basis_treer��revtree�change�basis_entry�changes�head_candidate�unchanged_mergedr��	seen_root�	inv_delta�modified_rev�head_candidatesr�r��head_setr9�carried_over�parent_entry_revs�parent_entry�carry_over_possible�nostore_sha�file_obj�
stat_valuer��new_paths$                                    r(�record_iter_changes�.VersionedFileCommitBuilder.record_iter_changes2sc���2�
�����	��D�O�O�:�:�4�<�<�H�I�H��!�!��J����6�6�}�7R�7R�S�J��-�-�	��t�|�|��q� � �L�L��O�3�K�� W�X�X�#�A�B�<��%�4�4�@�@��K�F��a�y�(� ��a�y�
�2�!�!�9�0�*3�*=�*=�f�Q�i�*H�K�!,� 4� 4� &�q�	� 2� 2�	5�J�a�y�1�!,� 4� 4�k� &�q�	� 2� 2�F�1�I�	9�N�!�9�5�6<�A�Y�5G�5G�4H�J�a�y�1�9?���9K�9K�V�TU�Y�8W�N�!�9�5�"�!�9�-�4�4�V�A�Y�5G�5G�H�HN�q�	��a�y�1�&��)�2D�2D�E�1L�(�6�J���"�F��{�{�1�~�)�"+�"5�"5�f�n�n�"E�"N�"N�!O��!#������v�~�~�~�>�'�G�N�N�#�
#��z�?�S��\�9��(�G�
A�'�1�1�'�:��-���&�&�w�/����g�1F�G�� � �*�*�K�,A�,A�B� �%�%�{�'7�'7�8� �%�%�{�'7�'7�8� �+�+�[�-C�-C�D�	��%+�w�,?�#@��� �=(�F�	��%�%�	��,�,��'.�~�~�'7�#�F�O�����"�"��{�{�1�~�� �.�.��&�t�,��V�[�[��^�V�-=�-=�a�-@��� �;�;�v�~�~�s�?�7K�L����&5�N�%��1����^�4� ����7�'6� %���u�:��?�(6�(:�(:�7�(C�%�(�'8�'<�'<�U�1�X�t�'L��'+��#�+�/4�+�)�-�-����;�+�5�5����H�+�0�0�E�J�J�>�38�/�26�/�
+0�'��6�>��(�(��+�+/��(�+0��(�+�(�3�3�u�7G�7G�G�'3�&<�&<��&*��+/�+B�+B�6�;�;�q�>�+R�(�H�j�)�;?�;R�;R�#�$�!�'�8B�*�"4�"4��<S�<�8�����%�k�k�!�n�u���
�.K�K�K�!���(��Y�&�+/�+B�+B�6�;�;�q�>�+R�E�(�+�(�7�7�5�;O�;O�O�'+���/�/�"�N�N�G�I�u�d��0���[�(�*�'+��"�;�;�q�>�R�/�4�?�?�3U�3U�3W�3W� �3�3� &����	�5�$�Q�4����-�-��?�?�2�2�J�J�
%�9�9� �.�.������*.�)D�)D�V�[�[�QR�^�)T�&�/A�E�,�+�(�;�;�?Q�Q�'+���/�/�"�N�N�G�I�u�d��0��)�)<�)C�)C�D�)I�J�J�#�%1�E�N�%1�%:�%:�E�N����{�{�1�~�H����f�k�k�!�n�h�����N�O��2�~� �	�g(8�n
�	�N�Q��#4�
�8S�8S�#S��)�n�q� �%6�-�:U�:U�%U�!%�D����%�%�d�+�$5�!��Q�$�$�	��H�#�|�|����O�O�D�O�O�$A�$A�+�$N�O���,�,��#�,9�,G�,G�)�&*���O�O����5�5�m�6Q�6Q�R��	�� ,�	��^�?�?�
�
�
��^)�8�8�A�(,��*6�*@�*@���*6�*@�*@���A��!���(�s��d�._(�Hd�b/�&Ed�9D=d�7Ac�	H'd�5A3d�(%b,�*`:�8b,�:A%b#�b,�"b#�#b,�(d�+b,�,d�/c�d�c�d�8d�d
�d�d
�
d�dc	���[UVs/sHoaU4PM sn5nURRR[RXR4XrUS9UURS9SS$s snf)Nr�)r��	random_idrr)�tupler>�texts�add_contentr��FileContentFactoryrt�random_revid)r=r��fileobjr/r�r��parentr^s        r(r��-VersionedFileCommitBuilder._add_file_to_weave\s����W�E�W�6�v�.�W�E�F�����$�$�0�0��,�,��/�/�0�+�T�
-�
�$��'�'�1�
��A�
�	��Fs�
A.)�__headsr;r5r4r<r3rs)NNNNNFT)rrrrrr.rLrgr�r�r}r�r�r�r�r�r�rr�r�r&�
__classcell__�rHs@r(r*r*\sv���O��������"2�H!��B+%�Z0�


�%�N�A� �"*�!�ER�h6�T	�r'r*c�&^�\rSrSrSr\rSrS?Sjr\	"\
R\
R5U4Sj5r
SrSrS@SjrSAS	jrS?S
jrSrSrS
rSrSrSrU4SjrSBSjrSCU4SjjrSDSjrSASjrSrSrSr Sr!Sr"Sr#Sr$Sr%Sr&Sr'S r(S?S!jr)S"r*SCS#jr+S$r,S?S%jr-S&r.S'r/S(r0S?S)jr1S*r2S+r3S,r4S-r5S.r6S/r7S0r8S1r9S2r:S3r;S4r<SCS5jr=S6r>S7r?S8r@S?S9jrAS:rBS;rCS<rDS@S=jrES>rFU=rG$)E�VersionedFileRepositoryiga�Repository holding history for one or more branches.

The repository holds and retrieves historical information including
revisions and file history.  It's normally accessed only by the Branch,
which views a particular line of development through that history.

The Repository builds on top of some byte storage facilies (the revisions,
signatures, inventories, texts and chk_bytes attributes) and a Transport,
which respectively provide byte storage and a means to access the (possibly
remote) disk.

The byte storage facilities are addressed via tuples, which we refer to
as 'keys' throughout the code base. Revision_keys, inventory_keys and
signature_keys are all 1-tuples: (revision_id,). text_keys are two-tuples:
(file_id, revision_id). chk_bytes uses CHK keys - a 1-tuple with a single
byte string made up of a hash identifier and a hash value.
We use this interface because it allows low friction with the underlying
code that implements disk indices, network encoding and other parts of
breezy.

:ivar revisions: A breezy.versionedfile.VersionedFiles instance containing
    the serialised revisions for the repository. This can be used to obtain
    revision graph information or to access raw serialised revisions.
    The result of trying to insert data into the repository via this store
    is undefined: it should be considered read-only except for implementors
    of repositories.
:ivar signatures: A breezy.versionedfile.VersionedFiles instance containing
    the serialised signatures for the repository. This can be used to
    obtain access to raw serialised signatures.  The result of trying to
    insert data into the repository via this store is undefined: it should
    be considered read-only except for implementors of repositories.
:ivar inventories: A breezy.versionedfile.VersionedFiles instance containing
    the serialised inventories for the repository. This can be used to
    obtain unserialised inventories.  The result of trying to insert data
    into the repository via this store is undefined: it should be
    considered read-only except for implementors of repositories.
:ivar texts: A breezy.versionedfile.VersionedFiles instance containing the
    texts of files and directories for the repository. This can be used to
    obtain file texts or file graphs. Note that Repository.iter_file_bytes
    is usually a better interface for accessing file texts.
    The result of trying to insert data into the repository via this store
    is undefined: it should be considered read-only except for implementors
    of repositories.
:ivar chk_bytes: A breezy.versionedfile.VersionedFiles instance containing
    any data the repository chooses to store or have indexed by its hash.
    The result of trying to insert data into the repository via this store
    is undefined: it should be considered read-only except for implementors
    of repositories.
:ivar _transport: Transport for file access to repository, typically
    pointing to .bzr/repository.
c��URR(d+[R"URUR5eURU5 UR
5(aUR5 URRU5 URRUR5 URRUR5 URRUR5 URRUR5 URb&URRUR5 gg)z`Add a repository to use for looking up data not held locally.

:param repository: A repository.
N)rR�supports_external_lookupsr�UnstackableRepositoryFormat�base�_check_fallback_repository�	is_locked�	lock_readrQr�r�add_fallback_versioned_filesrP�	revisions�
signatures�	chk_bytes)r=r>s  r(�add_fallback_repository�/VersionedFileRepository.add_fallback_repository�s���
�|�|�5�5��4�4�T�\�\�4�9�9�M�M�	
�'�'�
�3��>�>���
� � �"��#�#�*�*�:�6��
�
�/�/�
�0@�0@�A����5�5�j�6L�6L�M����3�3�J�4H�4H�I����4�4�Z�5J�5J�K��>�>�%��N�N�7�7�
�8L�8L�M�&r'c�0�[RXX#U5$�N)�
serializer�write_bundle)r=�targetrrr�s     r(�
create_bundle�%VersionedFileRepository.create_bundle�s���&�&�t�T�F�K�Kr'c�>�[TU]5 URRS:XaURR5 gg)Nr)r-�unlock�
control_files�_lock_count�_inventory_entry_cache�clear)r=rHs �r(r#�VersionedFileRepository.unlock�s8���
�������)�)�Q�.��'�'�-�-�/�/r'c�v�UR5(d[SRU55e[R	U5 UR
b5UR
U:Xd%[SRUR
U55eURc[R"5eURXU5$)aDAdd the inventory inv to the repository as revision_id.

:param parents: The revision ids of the parents that revision_id
                is known to have and are in the repository already.

:returns: The validator(which is a sha1 digest, though what is sha'd is
    repository format specific) of the serialized inventory.
�{!r} not in write groupzGMismatch between inventory revision id and insertion revid ({!r}, {!r}))
�is_in_write_groupr�r�r1�check_not_reserved_idrD�rootrr��_add_inventory_checked)r=rD�invr/s    r(�
add_inventory�%VersionedFileRepository.add_inventory�s����%�%�'�'� �!:�!A�!A�$�!G�H�H��+�+�K�8����'�3�?�?�k�+I� �7�7=�v��O�O�[�8��
��8�8���$�$�&�&��*�*�;�W�E�Er'c�Z�URRU5nURXUSS9$)z�Add inv to the repository after checking the inputs.

This function can be overridden to allow different inventory styles.

:seealso: add_inventory, for the contract.
F��
check_content)�_serializer�write_inventory_to_lines�_inventory_add_lines)r=rDr/r/�	inv_liness     r(r.�.VersionedFileRepository._add_inventory_checked�s9���$�$�=�=�c�B�	��(�(��)�5�)�
�	
r'c�v�UR5(d[SRU55e[R	U5 URU5nUR
5 UcURnURU5 X5l	URX5U5U4sSSS5 $!,(df   g=f)adAdd a new inventory expressed as a delta against another revision.

See the inventory developers documentation for the theory behind
inventory deltas.

:param basis_revision_id: The inventory id the delta was created
    against. (This does not have to be a direct parent.)
:param delta: The inventory delta (see Inventory.apply_delta for
    details).
:param new_revision_id: The revision id that the inventory is being
    added for.
:param parents: The revision ids of the parents that revision_id is
    known to have and are in the repository already. These are supplied
    for repositories that depend on the inventory graph for revision
    graph access, as well as for those that pun ancestry with delta
    compression.
:param basis_inv: The basis inventory if it is already known,
    otherwise None.
:param propagate_caches: If True, the caches for this inventory are
  copied to and updated for the result if possible.

:returns: (validator, new_inv)
    The validator(which is a sha1 digest, though what is sha'd is
    repository format specific) of the serialized inventory, and the
    resulting inventory.
r*N)r+r�r�r1r,r}rr��apply_deltarDr0)r=r��delta�new_revision_idr/r��propagate_cachesr�s        r(r��.VersionedFileRepository.add_inventory_by_delta�s���F�%�%�'�'� �!:�!A�!A�$�!G�H�H��+�+�O�<��'�'�(9�:�
�
�
!�
!�
#�
� �&�5�5�	��!�!�%�(�$3�!��&�&��7�K�Y�W�$�
#�
#�s�&:B*�*
B8c��UVs/sHoU4PM nnURRU4X#US9SnURRR5 U$s snf)z;Store lines in inv_vf and return the sha1 of the inventory.r3r)rP�	add_lines�_access�flush)r=rDr/�linesr4rr�s       r(r7�,VersionedFileRepository._inventory_add_linessf��+2�3�7��9�7��3��!�!�+�+�
�N�G�-�,�
�
�
��	
��� � �&�&�(��
��4s�Ac�l�[RU5 URRU4/5(dEUc [R
"XR5eUR
XUR5UlO'U4nURRU/5UUlURU5 g)z�Add rev to the revision store as revision_id.

:param revision_id: the revision id to use.
:param rev: The revision object.
:param inv: The inventory for the revision. if None, it will be looked
            up in the inventory storer
N)r1r,rPrVr�WeaveRevisionNotPresentr0rvrk�	get_sha1sr�)r=rDr�r/�keys     r(�add_revision�$VersionedFileRepository.add_revisions���	�+�+�K�8����.�.���/?�@�@��{��4�4�[�BR�BR�S�S�&*�%7�%7��c�n�n�&��"��.�C�!%�!1�!1�!;�!;�S�E�!B�3�!G�C�����3�r'c���URRU5nUR4n[SUR55nUR
R
X4U5 g)Nc3�&# �UHo4v� M	 g7frr��.0rs  r(�	<genexpr>�8VersionedFileRepository._add_revision.<locals>.<genexpr>:s���D�0C�f�	�0C���)r5�write_revision_to_linesrDrrvrrA)r=r�rDrIr/s     r(r��%VersionedFileRepository._add_revision7sP��� � �8�8��B���#�#�%���D��0C�0C�D�D����� � ��u�5r'c��[RR5nURX5 SSS5 g!,(df   g=f)z�Check the inventories found from the revision scan.

This is responsible for verifying the sha1 of inventories and
creating a pending_keys set that covers data referenced by inventories.
N)�ui�
ui_factory�nested_progress_bar�_do_check_inventories)r=�checker�bars   r(�_check_inventories�*VersionedFileRepository._check_inventories=s0���]�]�
.�
.�
0�C��&�&�w�4�1�
0�
0�s	�:�
Ac���[5[5[5S.nSS/n[UR5 UR[	S5SS5 URn0UlUHXnUSS:wa3USU;a*UR
R
SRU55 X6SRUSS	5 MZ US(a�S	nURRUSS
9HnnURS:Xa6UR
R
SRUR55 MIURSUUUUS
UR-5nMp US	Og	UR[	S5S5 UR(dUS(dUS(GaEURn0UlUHOnUSU;a*UR
R
SRU55 X6SRUSS	5 MQ UH�n	X9(dMS	n[X	5RX9S
9HnnURS:Xa6UR
R
SRX�R55 MIURU	UUUXY4UR-5nMp [5X9' O UR(aGM*US(aGM7US(aGMDg	g	)zHelper for _check_inventories.)rrPrrrrPrrzunknown key type {!r}rN)�keys�absentzMissing inventory {{{}}})rPzMissing {} {{{}}})r�r��pending_keys�update�gettext�
_report_itemsr�r��addrP�check�storage_kindrI�
_check_record�getattr)
r=rZr[r_�kinds�current_keysrI�last_object�recordr�s
          r(rY�-VersionedFileRepository._do_check_inventoriesFs��� �U�3�5�3�5�I���g�&���G� � �!��
�
�7�=�)�1�a�0��+�+��!����C��1�v��&�3�q�6��+>��%�%�,�,�-D�-K�-K�C�-P�Q��Q��L���S���W�%� ��
���K��*�*�0�0�d�=�6I�0�J���&�&�(�2��)�)�0�0�2�9�9�&�*�*�E��#'�"4�"4�%���#�$�%5��
�
�%B�C�#�K�
K��]�#���
�
�7�7�#�Q�'��"�"�d�;�&7�4��=�=�"�/�/�L�#%�G� �#���q�6��&��)�)�0�0�1H�1O�1O�PS�1T�U���V�� � ��Q�R��)�$�
���:�:�"&�K�")�$�"5�";�";���";�"L��!�.�.�(�:�#�1�1�8�8� 3� :� :�4��� L��+/�*<�*<� $� &� '� +� ,�W�v�z�z�-A� B�+�K�
#M�"%��D�J��#��"�"�"�d�;�&7�&7�4��=�=r'c��US:Xa�URSnURXbRS55nUb5URU5nUHup�p�UcMUR	X6U5 M O+UR5Hup�UR	X6U5 M URR(aU$gUS:Xa5URRSRUR55 gUS:XaURX#U5 gURRSRXR55 g)	z)Check a single text from this repository.rPrrDNrz%unsupported key type chk_bytes for {}rzunknown key type {} for {})rI�_deserialise_inventory�get_bytes_asr�rf�iter_entriesrR�fast_deltasrdr�r��_check_text)
r=r�rmrZrl�	item_data�rev_idr/r<�	_old_path�_path�_file_idr�s
             r(rh�%VersionedFileRepository._check_record�s���=� ��Z�Z��]�F��-�-�f�6I�6I�'�6R�S�C��&�����4��6;�2�I�h��z� ��H�H�W�c�2�7<�
"%�!1�!1�!3�I�E��H�H�W�c�2�"4��|�|�'�'��
�(�
�[�
 ��!�!�(�(�7�>�>�v�z�z�J�
��W�_����V�i�8��!�!�(�(�,�3�3�D�*�*�E�
r'c	��URS5n[RU5n[[	[
U55 U(aFXSS:wa=URRSRURXSSUS55 ggg)zCheck a single text.�chunkedrz:sha1 mismatch: {} has sha1 {} expected {} referenced by {}rN)
rq�osutils�sha_strings�sum�mapr�rdr�r�rI)r=rmrZru�chunks�sha1s      r(rt�#VersionedFileRepository._check_text�s{���$�$�Y�/���"�"�6�*���C��V�����1��-��!�!�(�(�L�S�S��J�J���l�I�a�L��
�.�9r'c��UR5 UR5nURU5n[U5sSSS5 $!,(df   g=f)zgCheck every revision id in revision_ids to see if we have it.

Returns a set of the present revisions.
N)rr8rVrW)r=r�r6r_s    r(� _eliminate_revisions_not_present�8VersionedFileRepository._eliminate_revisions_not_present�s>��
�^�^�
��N�N�$�E��-�-�l�;�J��
�#�	�
�
�s�,A�
Ac��>�[TU]XU5 URUlURRUlSUlSUlSUl[RS5Ul	SUl
g)z�Instantiate a VersionedFileRepository.

:param _format: The format of the repository on disk.
:param controldir: The ControlDir of the repository.
:param control_files: Control files to use for locking, etc.
TFi(N)r-r.�
_transportr�_reconcile_does_inventory_gc�_reconcile_fixes_text_parents�_reconcile_backsup_inventory�
fifo_cache�	FIFOCacher&�_safe_to_return_from_cache�r=rR�a_controldirr$rHs    �r(r.� VersionedFileRepository.__init__�sg���	����
�>�'�2�2����O�O�(�(��	�,0��)�-2��*�,0��)�&0�&:�&:�9�&E��#�+0��'r'c��UbUb[S5eUR5(a[R"S5eUR	U5(aRUcOURU5(a9Ub+[RU5(dURU5 [S5$[R"X5nUb7[USS5(d%[R"SRU55eURUUUUS9$)a�Fetch the content required to construct revision_id from source.

If revision_id is None and fetch_spec is None, then all content is
copied.

fetch() may not be used when the repository is in a write group -
either finish the current write group before using fetch, or use
fetch before starting the write group.

:param find_ghosts: Find and copy revisions in the source that are
    ghosts in the target (and not reachable directly by walking out to
    the first-present revision in target from revision_id).
:param revision_id: If specified, all the content needed for this
    revision ID will be copied to the target.  Fetch will determine for
    itself which content needs to be copied.
:param fetch_spec: If specified, a SearchResult or
    PendingAncestryResult that describes which revisions to copy.  This
    allows copying multiple heads at once.  Mutually exclusive with
    revision_id.
z2fetch_spec and revision_id are mutually exclusive.z%May not fetch while in a write group.r�supports_fetch_specFz!fetch_spec not supported for {!r})rD�find_ghosts�
fetch_specrE)r�r+r�InternalBzrError�has_same_location�_has_same_fallbacksr1�is_null�get_revisionr	r
rxrir�r��fetch)r=rerDr�r�rE�inters       r(r��VersionedFileRepository.fetch�s��.�!�k�&=� �!U�V�V��!�!�#�#��)�)�*Q�R�R�

�"�"�6�*�*��"��(�(��0�0��&�}�/D�/D�[�/Q�/Q��!�!�+�.��q�>�!��#�#�F�1���!�'�%�9N�PU�*V�*V��-�-�3�:�:�5�A��
��{�{�#�#�!��	�
�	
r'c�>�UR5 [TU]	X5nURR	5(a&[URR55US'UsSSS5 $!,(df   g=f)zSee Repository.gather_stats().rN)rr-�gather_stats�user_transport�listabler�rr_)r=�revid�
committersr�rHs    �r(r��$VersionedFileRepository.gather_statss`���
�^�^�
��W�)�%�<�F��"�"�+�+�-�-�'*�$�.�.�*=�*=�*?�&@��{�#���
�
�s�AA2�2
Bc

��UR(a1URR(d[R"S5eUR5n
UR
UUUUUUUUU	U
(+S9
nU
(dUR5 U$)a<Obtain a CommitBuilder for this repository.

:param branch: Branch to commit to.
:param parents: Revision ids of the parents of the new revision.
:param config_stack: Configuration stack to use.
:param timestamp: Optional timestamp recorded for commit.
:param timezone: Optional timezone for timestamp.
:param committer: Optional committer to set for commit.
:param revprops: Optional dictionary of revision properties.
:param revision_id: Optional revision id.
:param lossy: Whether to discard data that can not be natively
    represented, when pushing to a foreign VCS
rO)rF)rQrRrSrrTr+�_commit_builder_class�start_write_group)r=�branchr/r?r@rArBrCrDrE�in_transactionr�s            r(�get_commit_builder�*VersionedFileRepository.get_commit_builders���2�&�&�t�|�|�/I�/I��/�/�J��
�
�/�/�1���+�+����������!/�/�,�
����"�"�$��
r'c�^
�URR(d
[5$UR5(d[	S5e[UR
RR55nUR[R5 URRnURSU55nURU5 [U5S:Xa
[5$U(dUVs1sH	unSU4iM sn$UR
RRnUR!U5 [#SUR%555nUR'U5n[5n	UR)5H!um
n
U	R+U
4SjU
55 M# UR,RU	5nU	RU5 U	(d
[5$UVs1sH	unSU4iM nnU$s snfs snf)a�Return the keys of missing inventory parents for revisions added in
this write group.

A revision is not complete if the inventory delta for that revision
cannot be calculated.  Therefore if the parent inventories of a
revision are not present, the revision is incomplete, and e.g. cannot
be streamed by a smart server.  This method finds missing inventory
parents for revisions added in this write group.
znot in a write groupc3�*# �UH	oSSv� M g7f����Nr)rOrIs  r(rP�IVersionedFileRepository.get_missing_parent_inventories.<locals>.<genexpr>\s���C
� '����H����rrPc3�*# �UH	oSv� M g7f)rNr)rO�rs  r(rPr�ms���E�,D�q��d�,D�r�c3�,># �UH	nTU4v� M g7frr)rO�
version_idr�s  �r(rPr�qs���� U��:�'�:�!6��s�)rRrr�r+r�rrU�get_missing_parents�discardr1r2rPrV�difference_updater��_key_dependencies�satisfy_refs_for_keys�	frozenset�
get_referrers�fileids_altered_by_revision_ids�itemsrbr)r=�check_for_missing_textsr/�unstacked_inventories�present_inventoriesrv�key_deps�	referrers�file_ids�
missing_texts�version_ids�
present_textsrcr�s             @r(�get_missing_parent_inventories�6VersionedFileRepository.get_missing_parent_inventoriesFs�����|�|�5�5��5�L��%�%�'�'� �!7�8�8�
�d�n�n�+�+�?�?�A�B�����
�3�3�4� $� 0� 0� 7� 7��3�B�B�C
� '�C
�
��	�!�!�"5�6��w�<�1���5�L�&�=D�E�W�	��]�F�+�W�E�E��>�>�(�(�:�:���&�&�':�;��E�H�,B�,B�,D�E�E�	��7�7�	�B����
�$,�N�N�$4� �G�[�� � � U�� U�U�%5��
�
�1�1�-�@�
��'�'�
�6���5�L�BI�I��I�V���/���I����/F��,Js�6G?�+Hc��UR5 URRUVs/sHo"4PM sn5n[5n[R
U;aUR
[R
5 URUVs/sHoUSPM	 sn5 UsSSS5 $s snfs snf!,(df   g=f)z�Probe to find out the presence of multiple revisions.

:param revision_ids: An iterable of revision_ids.
:return: A set of the revision_ids that were present.
rN)rrrVr�r1r2rerb)r=r�rvr_r�rIs      r(�
has_revisions�%VersionedFileRepository.has_revisions}s����^�^�
����6�6�)5�6��v���6��J��U�F��*�*�l�:��
�
�=�6�6�7��M�M�Z�8�Z�c�q�6�Z�8�9���
��6��
9��
�s(�B4�B*
�AB4�
B/
�B4�*
B4�4
Cc��UR5 URU/5SsSSS5 $!,(df   g=f)a.'reconcile' helper routine that allows access to a revision always.

This variant of get_revision does not cross check the weave graph
against the revision one as get_revision does: but it should only
be used by reconcile, or reconcile-alike commands that are correcting
or testing the revision graph.
rN)r�
get_revisions�r=rDs  r(�get_revision_reconcile�.VersionedFileRepository.get_revision_reconcile�s/���^�^�
��%�%�{�m�4�Q�7��
�
�s�0�
>c#�# �UR5 UH3nU(a[U[5(aM![R"X S9e UVs/sHo34PM nnUR
R
USS5nUH[nURSnURS:XaUS4v� M*URS5nURRU5n	Xy4v� M] SSS5 gs snf!,(df   g=f7f)a�Iterate over revision objects.

:param revision_ids: An iterable of revisions to examine. None may be
    passed to request all revisions known to the repository. Note that
    not all repositories can find unreferenced revisions; for those
    repositories only referenced ones will be returned.
:return: An iterator of (revid, revision) tuples. Absent revisions (
    those asked for but not available) are returned as (revid, None).
)rDr�rTrr`N�fulltext)r�
isinstance�bytesr�InvalidRevisionIdr�get_record_streamrIrgrqr5�read_revision_from_string)
r=r�rvrIr_�streamrmr��textr�s
          r(�iter_revisions�&VersionedFileRepository.iter_revisions�s�����^�^�
�&���Z���%>�%>� �2�2�v�S�S�'�'3�3�l�s�F�l�D�3��^�^�5�5�d�K��N�F� ���
�
�1�
���&�&�(�2� �$�-�'�!�.�.�z�:�D��*�*�D�D�T�J�C� �,�&�!�
�
��4�	�
�s4�C<� C+�C+�C&�BC+�	C<�&C+�+
C9�5C<c��UR5 URRU4S[R	U55 SSS5 g!,(df   g=f)zzStore a signature text for a revision.

:param revision_id: Revision id of the revision
:param signature: Signature text.
rN)�
lock_writerrAr}�split_lines)r=rD�	signatures   r(�add_signature_text�*VersionedFileRepository.add_signature_text�s@���_�_�
��O�O�%�%����G�$7�$7�	�$B�
��
�
���2A�
Ac���UR5 [RX5nUR5nUR	X$U5 SSS5 g!,(df   g=fr)r�r|�
from_revisionr~r)r=rD�gpg_strategyr�r�s     r(�
sign_revision�%VersionedFileRepository.sign_revision�sF��
�_�_�
�!�/�/��B�I�!�/�/�1�I��)�)�,�;�O��
�
�s�8A�
A c��UR5 URU[R5nUR	X45 SSS5 g!,(df   g=fr)r��signr��
MODE_CLEARr�)r=r�r�rDr�s     r(r�0VersionedFileRepository.store_revision_signature�s<��
�_�_�
�$�)�)�)�S�^�^�D�I��#�#�K�;��
�
�r�c��UR5 URU5(d[RS4sSSS5 $UR	U5n[
R
X5nURU5upVnUR5U:wa[RS4sSSS5 $XV4sSSS5 $!,(df   g=f)z�Verify the signature on a revision.

:param revision_id: the revision to verify
:gpg_strategy: the GPGStrategy object to used

:return: gpg.SIGNATURE_VALID or a failed SIGNATURE_ value
N)
r�has_signature_for_revision_idr��SIGNATURE_NOT_SIGNED�get_signature_textr|r��verifyr~�SIGNATURE_NOT_VALID)r=rDr�r�r��statusrI�signed_plaintexts        r(�verify_revision_signature�1VersionedFileRepository.verify_revision_signature�s����^�^�
��5�5�k�B�B��/�/��5��
��/�/��<�I�!�/�/��B�I�.:�.A�.A�)�.L�+�V�*��&�&�(�,<�<��.�.��4��
��=��
�
�s�(B8�AB8�,B8�8
Cc��URR5nURn[RR5nURRURXS95sSSS5 $!,(df   g=f)a8Find the text key references within the repository.

:return: A dictionary mapping text keys ((fileid, revision_id) tuples)
    to whether they were referred to by the inventory of the
    revision_id that they contain. The inventory texts from all present
    revision ids are assessed to generate this report.
��pbN)	rr_rPrVrWrXr5�_find_text_key_references�#iter_lines_added_or_present_in_keys)r=�
revision_keys�wr�s    r(�find_text_key_references�0VersionedFileRepository.find_text_key_references�sd�����+�+�-�
�����
�]�]�
.�
.�
0�B��#�#�=�=��5�5�m�5�K��1�
0�
0�s�(A7�7
Bc#��# �URRUSS5nUHAnURS:wdMURSnUR	S5HnXT4v� M
 MC g7f)abGet a line iterator of the sort needed for findind references.

Not relevant for non-xml inventory repositories.

Ghosts in revision_keys are ignored.

:param revision_keys: The revision keys for the inventories to inspect.
:return: An iterator over (inventory line, revid) for the fulltexts of
    all of the xml inventories specified by revision_keys.
rTr`r�rDN)rPr�rgrIrq)r=r_r�rmr��lines      r(�_inventory_xml_lines_for_keys�5VersionedFileRepository._inventory_xml_lines_for_keys�sc����!�!�3�3�D�+�t�L���F��"�"�h�.��
�
�2���"�/�/��8�D��+�%�9��s
�1A(�1A(c�X�[URRU55nURU5n[URRUR	U555nX5-
n0nUR
nUH)n	U"U	S[55R
U	S5 M+ U$)aHHelper routine for fileids_altered_by_revision_ids.

This performs the translation of xml lines to revision ids.

:param line_iterator: An iterator of lines, origin_version_id
:param revision_keys: The revision ids to filter for. This should be a
    set or other type which supports efficient __contains__ lookups, as
    the revision key from each parsed line will be looked up in the
    revision_keys filter.
:return: a dictionary mapping altered file-ids to an iterable of
    revision_ids. Each altered file-ids has the exact revision_ids that
    altered it listed explicitly.
rr�)r�r5r��_find_parent_keys_of_revisionsr�
setdefaultre)
r=�
line_iteratorr��seenr^�parent_seen�new_keysr�rrIs
          r(�'_find_file_ids_from_xml_inventory_lines�?VersionedFileRepository._find_file_ids_from_xml_inventory_lines�s����4�#�#�=�=�m�L�M���9�9�-�H������6�6��2�2�;�?�
�
��
�%�����&�&�
��C��s�1�v�s�u�%�)�)�#�b�'�2���
r'c��URRU5n[[RRUR
555nURU5 UR[R5 U$)z�Similar to _find_parent_ids_of_revisions, but used with keys.

:param revision_keys: An iterable of revision_keys.
:return: The parents of all revision_keys that are not already in
    revision_keys
)rrVr��	itertools�chain�
from_iterabler�r�r�r1r2)r=r�r_r^s    r(r�6VersionedFileRepository._find_parent_keys_of_revisionssb���^�^�2�2�=�A�
��)�/�/�7�7�
�8I�8I�8K�L�M���%�%�m�4����M�7�7�8��r'c��UVs1sHo34iM nnU=(d URnURURUSS9U5$s snf)a�Find the file ids and versions affected by revisions.

:param revisions: an iterable containing revision ids.
:param _inv_weave: The inventory weave from this repository or None.
    If None, the inventory weave will be opened automatically.
:return: a dictionary mapping altered file-ids to an iterable of
    revision_ids. Each altered file-ids has the exact revision_ids that
    altered it listed explicitly.
Nr�)rPrr�)r=r��
_inv_weaver��
selected_keysr�s      r(r��7VersionedFileRepository.fileids_altered_by_revision_ids%sU��0<�<�|�e��|�
�<��*�$�*�*���;�;�
�1�1�-�D�1�I�=�
�	
��=s�Ac#�># �0nUHup4nXRX44'M
 URRUSS5HenURS:Xa1[R"UR
SUR
S5eX&R
UR
S54v� Mg g7f)a�Iterate through file versions.

Files will not necessarily be returned in the order they occur in
desired_files.  No specific order is guaranteed.

Yields pairs of identifier, bytes_iterator.  identifier is an opaque
value supplied by the caller as part of desired_files.  It should
uniquely identify the file version in the caller's context.  (Examples:
an index number or a TreeTransform trans_id.)

bytes_iterator is an iterable of bytestrings for the file.  The
kind of iterable and length of the bytestrings are unspecified, but for
this implementation, it is a list of bytes produced by
VersionedFile.get_record_stream().

:param desired_files: a list of (file_id, revision_id, identifier)
    triples
rTr`rrr|N)rr�rgr�RevisionNotPresentrI�
iter_bytes_as)r=�
desired_files�	text_keysr�rD�
callable_datarms       r(�iter_files_bytes�(VersionedFileRepository.iter_files_bytes5s����&�	�3@�/�G�-�0=�w�,�-�4A��j�j�2�2�9�k�4�P�F��"�"�h�.��/�/��
�
�1�
�v�z�z�!�}�M�M��J�J�'��)=�)=�i�)H�H�H�Q�s�BBc�"�Uc/UR5nURUR55nUcUR5n[R
R
5nURX!U5sSSS5 $!,(df   g=f)a6Generate a new text key index for the repository.

This is an expensive function that will take considerable time to run.

:return: A dict mapping text keys ((file_id, revision_id) tuples) to a
    list of parents, also text keys. When a given key has no parents,
    the parents list will be [NULL_REVISION].
N)r8rV�all_revision_idsr�rVrWrX�_do_generate_text_key_index)r=�text_key_references�	ancestorsr6r�s     r(�_generate_text_key_index�0VersionedFileRepository._generate_text_key_indexPss�����N�N�$�E��,�,�T�-B�-B�-D�E�I��&�"&�"?�"?�"A��
�]�]�
.�
.�
0�B��3�3�I�TV�W�1�
0�
0�s�$B�
Bc�$^�[RU5n[5n0nUHn[5Xg'M [U5n0n	UR	5H8up�U(dURU
5 OXjSRU
5 X�U
'M: A0n[R[RU55n
[Rn[RS5nSn[U5U-S-nSnUR[S5UU5 [U5H�nUUU-US-U-nU(d O�UH�nXnXgH�n
UR[S5U5 US-
n/mUHenU
SU4nUUU;nU(a2UUnUR'U
S5nUbU
SUR,4nOSnUcMQTR/U	U5 Mg U
R1T5n5nUR5U4SjS9 U/:XaU/nUX�'M� M� M� UHn
U/X�'M
 U$![ a SnSnN�f=f![ a# UR#U5R$nUUU'N�f=f![ [(R*4a SnN�f=f)	z:Helper for _generate_text_key_index to avoid deep nesting.r�
rzCalculating text parentsFNc�&>�TRU5$r)�index)�x�candidate_parentss �r(�<lambda>�EVersionedFileRepository._do_generate_text_key_index.<locals>.<lambda>�s���3D�3J�3J�1�3Mr')rI)�tsort�	topo_sortr�r�r�rer6�Graph�DictParentsProviderr1r2�	lru_cache�LRUCacherbrc�range�KeyErrorr}r�r�rr�r�r�r9rW�sort)r=r"r!r��revision_order�invalid_keysr�rD�
text_count�text_key_cache�text_key�valid�
text_index�
text_graphr2�inventory_cache�
batch_size�batch_count�processed_texts�offset�to_queryrvr��parent_text_key�check_parentr/r��parent_heads�new_parentsr*s                             @r(r �3VersionedFileRepository._do_generate_text_key_indexbs��������3���u���
�)�K�),��M�&�*��,�-�
���2�8�8�:�O�H��� � ��*��q�k�*�.�.�x�8�'/�8�$� ;�
 ��
��[�[��!:�!:�:�!F�G�
�%�3�3�
�$�,�,�R�0���
��.�)�Z�7�!�;����
�	�	�'�4�5��
�S��K�(�F�%�f�z�&9�V�a�Z�:�<U�V�H���'��&�3�
� -� :�H��I�I�g�&@�A�?�S�#�q�(�O�(*�%�%/�	�+3�A�;�	�*B��3� /�}�Y�7O� O�)�(�A�&5�i�&@��4�/2�}�}�X�a�[�/I�� ,�7�3;�A�;��@U�@U�2V��26��*�6�-�4�4�^�O�5T�U�;&0�<$.�#3�#3�4E�#F�L�"&�|�"4�K��$�$�)M�$�N�"�b�(�'4�o��+6�J�(�O!;� (�	)�^%�H�$1�?�J� �%����C (�3�+0�L�.2�O�	3��$,�A�&*�&8�&8��&C�&R�&R��=@��	� :�A��
%-�f�o�o�#>�4�/3��4�s6�6H,�I�I0�,H=�<H=�*I-�,I-�0J�Jc#�z# �URX5Shv�N AURU5Shv�N gNN7f)a�Get an iterable listing the keys of all the data introduced by a set
of revision IDs.

The keys will be ordered so that the corresponding items can be safely
fetched and inserted in that order.

:returns: An iterable producing tuples of (knit-kind, file-id,
    versions).  knit-kind is one of 'file', 'inventory', 'signatures',
    'revisions'.  file-id is None unless knit-kind is 'file'.
N)�_find_file_keys_to_fetch�_find_non_file_keys_to_fetch)r=r��	_files_pbs   r(�item_keys_introduced_by�/VersionedFileRepository.item_keys_introduced_by�s;����0�0��I�I�I���4�4�\�B�B�B�	J�B�s�;�7�;�9�;�;c#��# �URnURX5n[U5n[UR	55H,unupxUbUR[
S5Xe5 SXx4v� M. g7f)NzFetch textsr�)rPr�r��	enumerater�rbrc)	r=r�r��inv_wr��num_file_ids�countr��altered_versionss	         r(rJ�0VersionedFileRepository._find_file_keys_to_fetch�so���� � ���7�7��L���8�}��2;�H�N�N�<L�2M�.�E�.�G��~��	�	�'�-�0�%�F��7�5�5�3N�s�A3A5c#�# �SSU4v� [URRUVs/sHo"4PM sn55nUVs1sHuo"iM nnURU5 SSU4v� SSU4v� gs snfs snf7f)N�	inventoryrr)r�rrV�intersection_update)r=r�r��revisions_with_signaturess    r(rK�4VersionedFileRepository._find_non_file_keys_to_fetch�s�����D�,�/�/�%(��O�O�*�*�,�+G�,�Q�D�,�+G�H�%
�!�4M�$M�3L�4�A�Q�3L�!�$M�!�5�5�l�C��T�#<�=�=��D�,�/�/��,H��$M�s�&A<�A2�A<�
A7�,A<c��UR5 [URU/55sSSS5 $!,(df   g=f)z$Get Inventory object by revision id.N)r�next�iter_inventoriesr�s  r(r��%VersionedFileRepository.get_inventory�s-��
�^�^�
���-�-�{�m�<�=��
�
�s	�6�
Ac#��# �SU;d[RU;a[S5eURX5H"up4Uc[R
"X5eUv� M$ g7f)a�Get many inventories by revision_ids.

This will buffer some or all of the texts used in constructing the
inventories in memory, but will only parse a single inventory at a
time.

:param revision_ids: The expected revision ids of the inventories.
:param ordering: optional ordering, e.g. 'topological'.  If not
    specified, the order of revision_ids will be preserved (by
    buffering if necessary).
:return: An iterator of inventories.
Nz"cannot get null revision inventory)r1r2�
ValueError�_iter_inventoriesrr�)r=r��orderingr/r�s     r(r]�(VersionedFileRepository.iter_inventories�s[���
�L� �m�&A�&A�\�&Q��A�B�B��0�0��H�J�C��{��+�+�D�8�8��I�I�s�AA c#�# �URX5nUH%upEUcSU4v� MURXT5U4v� M' g7f)z*single-document based inventory iteration.N)�_iter_inventory_xmlsrp)r=r�rb�inv_xmlsrDrDs      r(ra�)VersionedFileRepository._iter_inventories�sH����,�,�\�D��"*��E��}��K�'�'��1�1�+�E�{�R�R�	#+���>Ac#�@# �UcSnSnOSnUVs/sHoD4PM nnU(dgU(a[U5n[U5nURRXRS5n0n	UH�n
U
RS:wa:U
RS5nU(aX�U
R'O&X�RS4v� OSU
RS4v� U(dMiWU	;dMqU	RU5nX�S4v� [W5nXy;aM,M� gs snf![a SnM�f=f7f)NTrFr`rDr�)	�iterr\rPr�rgrqrIrY�
StopIteration)r=r�rb�order_as_requestedrDr_�key_iter�next_keyr��
text_linesrmrDs            r(re�,VersionedFileRepository._iter_inventory_xmlss"�����!%��"�H�!&��2>�?�,�;��,��?�����D�z�H��H�~�H��!�!�3�3�D�D�I���
��F��"�"�h�.��+�+�G�4��%�-2�v�z�z�*����B��/�/��F�J�J�r�N�*�*�!�!��*�,�&�N�N�8�4�E��"��-�-��#'��>��	�,���@��0)��$(���	�sF�D�D�B,D�
D�D�/D�:D�
D�D�D�D�Dc���URRUUURURS9nURU:wa%[SR
URU55eU$)z�Transform the xml into an inventory object.

:param revision_id: The expected revision id of the inventory.
:param xml: A serialised inventory.
)�entry_cache�return_from_cachezrevision id mismatch {} != {})r5�read_inventory_from_linesr&r�rDr�r�)r=rD�xmlr�s    r(rp�.VersionedFileRepository._deserialise_inventory+sq���!�!�;�;����3�3�"�=�=�	<�
������,� �/�6�6�v�7I�7I�;�W��
��
r'c�.�URR$r)r5�
format_numrKs r(�get_serializer_format�-VersionedFileRepository.get_serializer_format=s�����*�*�*r'c���UR5 URU/S5n[U5up1Uc[R"X5eUsSSS5 $!,(df   g=f)z%Get serialized inventory as a string.rN)rrer\rr�)r=rDrrDs    r(�_get_inventory_xml�*VersionedFileRepository._get_inventory_xml@sQ��
�^�^�
��-�-�{�m�[�I�E�!%�e���E��}��+�+�D�>�>���
�
�s�;A�
A$c�&�U[R:Xa,[RU[	SS9[R5$UR5 UR
U5n[RXU5sSSS5 $!,(df   g=f)zlReturn Tree for a revision on this branch.

`revision_id` may be NULL_REVISION for the empty tree revision.
N)�root_id)r1r2r�r�rrr�)r=rDr/s   r(r}�%VersionedFileRepository.revision_treeIso���-�5�5�5� �6�6��i��-�}�/J�/J��
����!��(�(��5��$�:�:�4�k�R�"�!�!�s�'B�
Bc#�# �URU5nUH%n[RXUR5v� M' g7f)z�Return Trees for revisions in this repository.

:param revision_ids: a sequence of revision-ids;
  a revision-id may not be None or b'null:'
N)r]r�r�rD)r=r�rPr/s    r(r��&VersionedFileRepository.revision_treesYs8����+�+�L�9���C��5�5�d����Q�Q��rhc�|�/n0nUH=nU[R:XaSX4'MUc[S5eURU45 M? URRU5R
5HBuupEU(a![UVs/sHuofPM sn5X4'M/[R4X4'MD U$s snf)z0See graph.StackedParentsProvider.get_parent_map.rz!get_parent_map(None) is not valid)r1r2r`r�rrVr�r)r=r��
query_keysr�rDr^�parent_revids       r(rV�&VersionedFileRepository.get_parent_mapcs����
���'�K��m�9�9�9�&(��#��$� �!D�E�E��!�!�;�.�1�
(�
�N�N�)�)�*�5�
�%�'�,�'�N�[��&+�9D�E��o�|�\��E�'��#�(5�'B�'B�&D��#�,��
��	Fs�
B9
c���UVs/sHo"4PM nnUR5 URRU5n[R	U5sSSS5 $s snf!,(df   g=f)zEReturn the known graph for a set of revision ids and their ancestors.N)rr�get_known_graph_ancestryr6�GraphThunkIdsToKeys)r=r��r_idr��known_graphs     r(r��0VersionedFileRepository.get_known_graph_ancestry{sV��-9�:�\�T��\�
�:�
�^�^�
��.�.�A�A�-�P�K��,�,�[�9��
��;�
�
�s�A�0A"�"
A0c��UR5 [RUR5sSSS5 $!,(df   g=f)z+Return the graph walker for text revisions.N)rr6r/rrKs r(�get_file_graph�&VersionedFileRepository.get_file_graph�s(��
�^�^�
��;�;�t�z�z�*��
�
�s	�:�
Ac�R�[[RRUR	5RU5R
555nURU5nURU5nURU5n[RXE[U5U5nU$)z6Convert a set of revision ids to a graph SearchResult.)r�rrrr8rVr��intersection�
difference�	vf_search�SearchResultr�)r=�
result_set�result_parents�
included_keys�
start_keys�exclude_keysr�s       r(�revision_ids_to_search_result�5VersionedFileRepository.revision_ids_to_search_result�s�����O�O�)�)���� �/�/�
�;�B�B�D�
�
��
#�/�/��?�
��*�*�=�9�
�%�0�0��<���'�'��c�*�o�z�
���
r'c��[XUS9$)a�Return an object suitable for checking versioned files.

:param text_key_references: if non-None, an already built
    dictionary mapping text keys ((fileid, revision_id) tuples)
    to whether they were referred to by the inventory of the
    revision_id that they contain. If None, this will be
    calculated.
:param ancestors: Optional result from
    self.get_graph().get_parent_map(self.all_revision_ids()) if already
    available.
�r!r")�_VersionedFileChecker)r=r!r"s   r(�_get_versioned_file_checker�3VersionedFileRepository._get_versioned_file_checker�s��%��Y�
�	
r'c��UR5 URU5(d[R"X5e[	UR
R
U4/55S:HnUsSSS5 $!,(df   g=f)zAQuery for a revision signature for revision_id in the repository.rN)r�has_revisionrr�r�rrV)r=rD�sig_presents   r(r��5VersionedFileRepository.has_signature_for_revision_id�sa��
�^�^�
��$�$�[�1�1��+�+�D�>�>��d�o�o�<�<�{�n�=M�N�O�ST�T�K��	�
�
�s�AA2�2
Bc��UR5 URRU4/SS5n[U5nURS:Xa[
R"X5eURS5sSSS5 $!,(df   g=f)z Return the text for a signature.rTr`r�N)rrr�r\rgrr�rq)r=rDr�rms    r(r��*VersionedFileRepository.get_signature_text�sp��
�^�^�
��_�_�6�6��� �+�t��F��&�\�F��"�"�h�.��+�+�D�>�>��&�&�z�2��
�
�s�A!A<�<
B
c��UR5 [RXS9nURU5 UsSSS5 $!,(df   g=f)N)�
check_repo)rrf�VersionedFileCheck)r=r��
callback_refsr�r�s     r(�_check�VersionedFileRepository._check�s:��
�^�^�
��-�-�d�-�J�F��L�L��'���
�
�s�&A�
Ac#�X# �UR5(d
[5eURnUcURUR	55nUHSup4UcURU4/5n[
SXS455n[
UR5nXg:wdMMX6U4v� MU g7f)a=Find revisions with different parent lists in the revision object
and in the index graph.

:param revisions_iterator: None, or an iterator of (revid,
    Revision-or-None). This iterator controls the revisions checked.
:returns: an iterator yielding tuples of (revison-id, parents-in-index,
    parents-in-revision).
Nc3�*# �UH	oSv� M g7fr�rrNs  r(rP�NVersionedFileRepository._find_inconsistent_revision_parents.<locals>.<genexpr>�s���/�)=�v�r�
�)=�r�)rr�rr�rrVrrv)r=�revisions_iterator�vfr�r�r_�parents_according_to_index�parents_according_to_revisions        r(�#_find_inconsistent_revision_parents�;VersionedFileRepository._find_inconsistent_revision_parents�s�����~�~��� �"�"�
�^�^���%�!%�!4�!4�T�5J�5J�5L�!M��1�O�E�����*�*�U�H�:�6�J�).�/�)3�H�)=�/�*�&�-2�(�2E�2E�,F�)�)�J��:W�X�X� 2�s�BB*�B*c�p�[UR55nU(a[R"S5eg)Nz'Revision knit has inconsistent parents.)rWr�r�
BzrCheckError)r=�inconsistenciess  r(�(_check_for_inconsistent_revision_parents�@VersionedFileRepository._check_for_inconsistent_revision_parents�s/���t�G�G�I�J����&�&�'P�Q�Q�r'c��[U5$)z1Return a sink for streaming into this repository.)�
StreamSinkrKs r(r[�!VersionedFileRepository._get_sink�s
���$��r'c��[X5$)z3Return a source for streaming from this repository.)�StreamSource)r=�	to_formats  r(rZ�#VersionedFileRepository._get_source�s
���D�,�,r'c��SSKJn UR5 U"XS9nUR5sSSS5 $!,(df   g=f)zReconcile this repository.r)�VersionedFileRepoReconciler)�thoroughN)�	reconciler�r�)r=�otherr�r��
reconcilers     r(r��!VersionedFileRepository.reconcile�s1��:�
�_�_�
�4�T�M�J��'�'�)��
�
�s	�7�
A)r&r�r�r�r�r�rr)NF)T�NFNF�NN)NNNNNF)Hrrrrrr*r�rr rr�LockNotHeld�
LockBrokenr#r0r.r�r7rJr�r\rYrhrtr�r.r�r�r�r�r�r�r�r�r�rr�r�rrrr�rr#r rMrJrKr�r]rarerpryr|r}r�rVr�r�r�r�r�r�r�r�r�r[rZr�r&r
rs@r(r
r
gs����2�n7��N�,L���#�#�V�%6�%6�7�0�8�0�
F�.

�$��0X�d� �26�5�@�D�8�	$�0�0SX�2
�h�&������.�`5�n� 	8�'�2	�P�<�
!�(
�&�$�8�
� I�6X�$P�d
C�6� 0�$>�
�(S�"�H�$+��S� R��0:�+�

�
� �	3��Y�2R�
 �-�*�*r'r
c�,^�\rSrSrSrU4SjrSrU=r$)�MetaDirVersionedFileRepositoryi�zARepositories in a meta-dir, that work via versioned file objects.c�&>�[TU]XU5 gr)r-r.r�s    �r(r.�'MetaDirVersionedFileRepository.__init__�s���
����
�>r'r)rrrrrr.r&r
rs@r(r�r��s���K�?�?r'r�c��\rSrSrSrSrg)�$MetaDirVersionedFileRepositoryFormati�zDBase class for repository formats using versioned files in metadirs.rN)rrrrrr&rr'r(r�r��s��Or'r�c�P�\rSrSrSrSrSrSrS
SjrSr	SS	jr
S
rSrSr
g)r�i�aAn object that can insert a stream into a repository.

This interface handles the complexity of reserialising inventories and
revisions from different formats, and allows unidirectional insertion into
stacked repositories without looking for the missing basis parents
beforehand.
c��Xlgr��target_repo)r=r�s  r(r.�StreamSink.__init__s��&�r'c�n�URU5nURX0RR5$)z�Insert missing keys from another source.

:param source: StreamSource to stream from
:param missing_keys: Keys to insert
:return: keys still missing
)�get_stream_for_missing_keys�insert_stream_without_lockingr�rR)r=rercr�s    r(r\�StreamSink.insert_missing_keyss1���3�3�L�A���1�1�&�:J�:J�:R�:R�S�Sr'c���URR5 U(aURRU5 SnOURR5 SnUR	XU5nU(a&URR5nXe4sSSS5 $URR
5nURRRnURn	X�:wa>URRR(aURRUS9 /[54sSSS5 $! URRSS9 e=f!,(df   g=f)z�Insert a stream's content into the target repository.

:param src_format: a bzr repository format.

:return: a list of resume tokens and an  iterable of keys additional
    items required before the insertion can be completed.
TFN��hint)�suppress_errors)
r�r��resume_write_groupr�r��suspend_write_groupr�rRr5�pack_compresses�packr�r�)
r=r��
src_format�
resume_tokens�	is_resumerc�write_group_tokensr��
to_serializer�src_serializers
          r(�
insert_stream�StreamSink.insert_streams2���
�
�
(�
(�
*��� � �3�3�M�B� �	�� � �2�2�4�!�	�
�#�A�A��	� �� �
*.�)9�)9�)M�)M�)O�&�-�;�%+�
*�&�'�'�:�:�<�� $� 0� 0� 8� 8� D� D�
�!+�!7�!7��!�3��(�(�0�0�@�@��$�$�)�)�t�)�4��3�5�y�7+�
*��8
�� � �2�2�4�2�H���=+�
*�s%�AE�5D;�BD;�;E�E�
E(c�^�URR5(d[R"U5eURR	5(d[R
"S5eURRRnURnSnXE:Xa2URRRnURS5 UGHjupxS[R;a[SU5 US:Xa'URRR!U5 MSUS:Xa?XT:Xa'URR"R!U5 M�UR%X�5 M�US:XaUR'X�5 M�US	:Xa'URR(R!U5 M�US
:XaAXT:Xa(URR*R!U5 GMUR-X�5 GM%US:Xa(URR.R!U5 GMS[1SR3U55e UbUR5S
SS9 URR7US9n	SURR4SURR"4S
URR*4SURR.4S	URR(44H4umn
U
cMU	R9U4SjU
R;555 M6 U	$![a GNZf=f![<a [?5n	U	$f=f)aqInsert a stream's content into the target repository.

This assumes that you already have a locked repository and an active
write group.

:param src_format: a bzr repository format.
:param is_resume: Passed down to get_missing_parent_inventories to
    indicate if we should be checking for missing texts at the same
    time.

:return: A set of keys that are missing.
z$you must already be in a write groupNir�zinserting substream: %srrP�inventory-deltasrrrz
kaboom! {}r'T)rC)r�c3�0># �UHnT4U-v� M
 g7frr)rOrI�prefixs  �r(rP�;StreamSink.insert_stream_without_locking.<locals>.<genexpr>�s����$�S���I��O�S�s�) r��is_write_lockedr�ObjectNotLockedr+rTrRr5�_pack_collection�	_new_pack�set_write_cache_size�AttributeError�debug�debug_flagsrr�insert_record_streamrP�_extract_and_insert_inventories�$_extract_and_insert_inventory_deltasrr�_extract_and_insert_revisionsrr�r��_write_datar�rb�#get_missing_compression_parent_keys�NotImplementedErrorr�)r=r�r�r�r�r��new_pack�substream_type�	substreamrc�versioned_filer�s           @r(r��(StreamSink.insert_stream_without_locking9s�������/�/�1�1��(�(��.�.����1�1�3�3��/�/�"H�I�I��(�(�0�0�<�<�
�#�/�/�����*�
;��+�+�<�<�F�F��
�-�-�k�:�)/�%�N��5�,�,�,��0�.�A���(�� � �&�&�;�;�I�F��=�0�!�2��$�$�0�0�E�E�i�P��8�8��S��#5�5��9�9�)�T��;�.�� � �*�*�?�?�	�J��;�.�"�2��$�$�.�.�C�C�I�N��6�6�y�Q��<�/�� � �+�+�@�@��K�$�\�%8�%8��%H�I�I�7*0�>��� � ��D� �1��'�'�F�F�$-�G�
��	!��$�*�*�0�0�1��� 0� 0� <� <�=��d�.�.�8�8�9��t�/�/�:�:�;��d�.�.�8�8�9�+�&���"�)���#�#�$�-�Q�Q�S�$��!+�0���G"�
��
��~#�	!��5�L���		!�s%�  L�/B-L/�
L,�+L,�/M�Mc���UH|nURS5n[R5nURU5nUup�p�nU	n
URVs/sHo�SPM	 nnURRX�X�5 M~ g![RaFn[SUR5 [R"URR5UeSnAff=fs snf)NrDzIncompatible delta: %sr)
rq�inventory_delta�InventoryDeltaDeserializer�parse_text_bytes�IncompatibleInventoryDeltar�msgr�IncompatibleRevisionr�rRr/r�)r=rrrm�inventory_delta_bytes�deserialiser�parse_result�errrG�new_id�	rich_root�	tree_refsr�rDrIr/s                r(r��/StreamSink._extract_and_insert_inventory_deltas�s����F�$*�$7�$7��$@�!�*�E�E�G�L�
U�+�<�<�=R�S��AM�=�H�i�I� �K�)/���8��#�1�v��G�8����3�3��[�
� ��#�=�=�
U��/����9��1�1�$�2B�2B�2J�2J�K�QT�T��
U��
9s�B�C!�C�AC�CNc��UHonURS5nURSnURXV5nURVs/sHo�SPM	 n	nURRXgU	5 AMq gs snf)z�Generate a new inventory versionedfile in target, converting data.

The inventory is retrieved from the source, (deserializing it), and
stored in the target (reserializing it in a different format).
rDrN)rqrIrtr/r�r0)
r=rr�parse_deltarmrDrDr/rIr/s
          r(r��*StreamSink._extract_and_insert_inventories�sw�� �F��'�'��0�E� �*�*�Q�-�K��6�6�u�J�C�)/���8��#�1�v��G�8����*�*�;�W�E�� ��9s�A7c��UHynURS5nURSnURU5nURU:wa[	SRXe55eURRXV5 M{ g)Nr�rz
wtf: {} != {})rqrIr�rDr�r�r�rJ)r=rrrmr�rDr�s       r(r��(StreamSink._extract_and_insert_revisions�so���F��'�'�
�3�E� �*�*�Q�-�K��6�6�u�=�C����+�-�$�_�%;�%;�C�%M�N�N����)�)�+�;�
 r'c��URRR(aURR5 ggr)r�rR�_fetch_reconciler�rKs r(�finished�StreamSink.finished�s.�����#�#�4�4����&�&�(�5r'r��Fr)rrrrrr.r\r�r�r�r�r�rr&rr'r(r�r��s3���'�T�&�Pd�L�"�$<�)r'r�c�p�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSSjr
SSjrSS
jrSSjrSrg)r�i�z7A source of a stream for fetching between repositories.c�@�XlX lSSKJn U"5Ulg)z5Create a StreamSource streaming from from_repository.r)�
RecordCounterN)�from_repositoryr��
recordcounterr �_record_counter)r=r!r�r s    r(r.�StreamSource.__init__�s��.��"��0�,���r'c��URRRnURRnURR=(a X:H$)z`Return True if delta's are permitted on metadata streams.

That is on revisions and signatures.
)r!rRr5r�r%)r=r��target_serializers   r(�delta_on_metadata�StreamSource.delta_on_metadata�sC��
�-�-�5�5�A�A�� �N�N�6�6���~�~�0�0�X�^�5X�Xr'c��URRnUVs/sHo34PM nn[RUR	X@R
RUR
R(+55nURRnUR	X@R
RUR5(+5nSU4SU4/$s snf)Nrr)
r!rr��
filter_absentr�r�r$r%rr')r=�revs�from_sfrvr_r�from_rfrs        r(�_fetch_revision_texts�"StreamSource._fetch_revision_texts�s����&�&�1�1��(,�-��f�	���-�"�0�0��%�%��n�n�1�1�t�~�~�7X�7X�3X�
�
�
��&�&�0�0���-�-��.�.�-�-�4�3I�3I�3K�/K�
�	��z�*�[�)�,D�E�E��.s�Cc��UR5(a.[RUR5R	U5$/$)zaThis will be called by get_stream between fetching weave texts and
fetching the inventory weave.
)�_rich_root_upgrade�
_mod_fetch�Inter1and2Helperr!�generate_root_texts)r=r+s  r(�_generate_root_texts�!StreamSource._generate_root_texts�sA���"�"�$�$��.�.��$�$��!�!�$�'�
(��Ir'c#�(# �SnUR5nURR5n[R	URU55nURR
U5n/nUGHupxn	Xr:waUnUS:Xa%URU	V
s/sHo�U
4PM sn
5 M9US:Xa�URRnSURUURRURR(+54v� SnURU5Shv�N URU5Shv�N M�US:XaM�US:XaURU5Shv�N M�[!SR#U55e gs sn
fNjNSN,7f)Nr�rWrrrzUnknown knit kind {!r})�get_keysr!r8r-r.rVrM�extendrr�r�r$r%r5�_get_inventory_streamr.r�r�)r=�search�phaser+r6�
data_to_fetchr�	knit_kindr�rr��
from_textss            r(�
get_stream�StreamSource.get_streams}�������� ���$�$�.�.�0�����u�3�3�D�9�:���,�,�D�D�T�J�
��	�-:�)�I�	��!�!���F�"�� � �i�!P�i�(�H�"5�i�!P�Q��k�)�!�1�1�7�7�
���0�0�!����3�3� �N�N�=�=�=����!�	� �4�4�T�:�:�:�
 �5�5�d�;�;�;��l�*���k�)��5�5�d�;�;�;�$�%=�%D�%D�Y�%O�P�P�K.;��"Q�$;�
<�<�sC�BF�
F
�"A?F�!F�"F�:F�;(F�#F�$)F�F�Fc#�*# �0n[5US'[5US'[5US'[5US'[5US'UHnX#SRUSS5 M [US5(a[SR	US55eUR5H�upB[
URU5nUc!U(a[S	R	XB55eU(dMHUS:XaSURRRU5nUVs/sHo3SPM	 nnURUS
S9Shv�N M�[RURX RRS
55nXH4v� M� gs snfNN7f)NrrrPrrrrz2cannot copy revisions to fill in missing deltas {}zCcannot fill in keys for a versioned file we don't have: {} needs {}T��missing)r�rer�r�r�r�rir!rPrVr:r�r*r�r�r$)	r=rcr_rI�substream_kindr��presentr+r�s	         r(r��(StreamSource.get_stream_for_missing_keys1s���������W�
��E��[��!�e��]���E��[�� �U��\���C��Q��L���S���W�%� ��t�K� �!�!�!�D�K�K���%���
�
%)�J�J�L� �N���-�-�~�>�B��z�d�$�)�)/���)E�������.��.�.�:�:�I�I�$�O��*1�2�'�3�A��'��2�
 �5�5�d�D�5�I�I�I��#�0�0��$�$�T�>�>�+F�+F��M��F�!�(�(�=%1��3�
J�s�DF�F�-F�F�AFc�Z�UR5(agURR$)N�topological)r1r�r$rKs r(�inventory_fetch_order�"StreamSource.inventory_fetch_orderfs$���"�"�$�$� ��>�>�.�.�.r'c��URRR(+=(a URR$r)r!rR�rich_root_datar�rKs r(r1�StreamSource._rich_root_upgradels1���$�$�,�,�;�;�;�
.����-�-�	
r'c��URRnUR(aRURR(a7UR	5URR	5:Xa[S5eS[R;aURXS9$UR	5URR	5:XaURXS9$UR(dNURR(d3URURR:XaURXS9$URXS9$)Nz3this case should be handled by GroupCHKStreamSource�forceinvdeltas��delta_versus_nullrC)r!rRrSr��network_namer�r�r��!_get_convertable_inventory_stream�_get_simple_inventory_streamr5)r=r�rD�from_formats    r(r:�"StreamSource._get_inventory_streamrs���*�*�2�2���%�%����,�,��(�(�*�d�n�n�.I�.I�.K�K� �!V�W�W�
��!2�!2�
2��9�9��:��
��
%�
%�
'�4�>�>�+F�+F�+H�
H��4�4�\�4�S�S��)�)��N�N�0�0��'�'�4�>�>�+E�+E�E��4�4�\�4�S�S��9�9��:��
r'c#��# �URRnU(aSnOUR5(+nSURUVs/sHoU4PM snUR	5U54v� gs snf7f)NTrP)r!rPr'r�rJ)r=r�rD�
from_weave�
delta_closurervs      r(rU�)StreamSource._get_simple_inventory_stream�sr����)�)�5�5�
�� �M� $� 6� 6� 8�8�M���(�(�)5�6��v���6��*�*�,��
�
�	
��7�s�AA4�A/
� A4c#�2# �SURXS94v� g7f)Nr�rQ)�_stream_invs_as_deltas)r=r�rRs   r(rT�.StreamSource._get_convertable_inventory_stream�s*���
��'�'��
(�
�
�	
�s�c	#�d# �URnUVs/sHoD4PM nnURRU5nURRUS5nURn[
R1n	[RS5n
UR[
R5Rn[RURURS9nUGHCn
U
R4nUR!US5nSnU(d�U(a�UVs/sHnUSPM
 nnUHznUU	;aMU[
R:XaUnO&U
R!US5nUcUR#U5nU
R%U5nUb['U5['U5:�dMvUnUnM| Uc![
RnU
R%U5nU	R)U
R5 X�U
R'UR+WUSU5n[,R/X�SUSS	9v� GMF gs snfs snf7f)
aeReturn a stream of inventory-deltas for the given rev ids.

:param revision_ids: The list of inventories to transmit
:param delta_versus_null: Don't try to find a minimal delta for this
    entry, instead compute the delta versus the NULL_REVISION. This
    effectively streams a complete inventory. Used for stuff like
    filling in missing parents, etc.
rI�2)�versioned_root�tree_referencesrNrr�T)�chunks_are_lines)r!rPrVr]rRr1r2r1r2r}r�r�InventoryDeltaSerializerrMr�rDrxr�r�r�re�delta_to_linesr��ChunkedContentFactory)r=r�rR�	from_reporvr�r_rPr��invs_sent_so_farr>�null_inventoryrr/rIr^r<�
parent_keyrvr��
parent_inv�candidate_deltarG�delta_serializeds                        r(r]�#StreamSource._stream_invs_as_deltas�s����(�(�	�1=�>��v���
�>��*�*�9�9�-�H�
��*�*�;�;�L�-�X���"�"��)�7�7�8��#�,�,�R�0��"�0�0��'�'�
�
�.�	�%�=�=�!�0�0�"�:�:�>�
�
��C��?�?�$�C�$�.�.��b�1�K��E�$��?J�J�k�
�j��m�k�
�J�!+�I� �(8�8�!� �M�$?�$?�?�%3�
�%4�%8�%8��D�%I�
�%�-�)2�)@�)@��)K�J�&)�o�o�j�&A�O��}��E�
�S��5I�(I� /��#,��",��}�)�6�6������7��� � ����1�/2�C�O�O�,�)�8�8��3�r�7�E�R���5�5��$�(8�4�6��
�A��%?��4K�s$�H0�H&�C5H0�H+�#A6H0�BH0)r#r!r�Nr)rrrrrr.r'r.r5r@r�rJr1r:rUrTr]r&rr'r(r�r��sF��A�/�Y�F�(	�,Q�\3)�j/�
��:
�"

�>r'r�c�4�\rSrSrSSjrSrS	SjrSrSrg)
r�i�Nc�L�XlURRX#S9Ulg)Nr�)r>r#r<)r=r>r!r"s    r(r.�_VersionedFileChecker.__init__�s&��$���/�/�B�B� 3�C�
��r'c�b�URUnU[R/:Xag[U5$)zOCalculate the correct parents for a file version according to
the inventories.
r)r<r1r2r)r=r:r^s   r(�calculate_file_version_parents�4_VersionedFileChecker.calculate_file_version_parents�s1���o�o�h�/���=�6�6�7�7���[�!�!r'c���SnUc [RR5nUnURX5U(aUR	5 $$!U(aUR	5 ff=f)a&Check the parents stored in a versioned file are correct.

It also detects file versions that are not referenced by their
corresponding revision's inventory.

:returns: A tuple of (wrong_parents, dangling_file_versions).
    wrong_parents is a dict mapping {revision_id: (stored_parents,
    correct_parents)} for each revision_id where the stored parents
    are not correct.  dangling_file_versions is a set of (file_id,
    revision_id) tuples for versions that are present in this versioned
    file, but not used by the corresponding inventory.
N)rVrWrX�_check_file_version_parentsr)r=r�progress_bar�local_progresss    r(�check_file_version_parents�0_VersionedFileChecker.check_file_version_parents	sb�������]�]�>�>�@�N�)�L�	*��3�3�E�H���'�'�)���~��'�'�)��s�A�A*c��0nURVVs1sHupEUiM	 snnUl[UR5nUR[	S5SU5 UR
RRUR5nUR
RR5n[U5[UR5-
n	[UR5HBup�UR[	S5X�5 URU5nX{n
X�:wdM=X�4X;'MD X94$s snnf![Ra Sn
N1f=f)zSee check_file_version_parents.zloading text storerzchecking text graphN)r<r�r�rbrcr>rrVr_r�r�rPrsrr)r=rrw�
wrong_parentsr��_�
n_versionsr_r�unused_keys�numrI�correct_parents�knit_parentss              r(rv�1_VersionedFileChecker._check_file_version_parents	s���
�37�?�?�C�?�Z�W��?�C��
�����)�
����G�$8�9�1�j�I��_�_�*�*�9�9�$�/�/�J�
��O�O�)�)�.�.�0�	��	�*�S����-A�A��!�$�/�/�2�H�C�����(=� >��P�"�A�A�#�F�O�
$�)����.�&2�%D�
�"�3��)�)��%D���,�,�
$�#��
$�s�D,�D2�2E�
E)r�r>r<r�r)	rrrrr.rsryrvr&rr'r(r�r��s��
�"�*�.*r'r�c�f�\rSrSrSrSrSSjrS
SjrSSjrS
Sjr	\
S	5r\
S
5rSr
g)�InterVersionedFileRepositoryi/	r`TNc	��U(a+[R"URUR5eURRR
(aG[RRSURRURRS9 SSK	J
n URRR5URRR5:waG[RRSURRURRS9 UR5 U"URURUUUS9 [5sSSS5 $!,(df   g=f)z�Fetch the content required to construct revision_id.

The content is copied from self.source to self.target.

:param revision_id: if None all content is copied, if NULL_REVISION no
                    content is copied.
:return: None.
�experimental_format_fetch�rVr�r)�RepoFetcher�cross_format_fetch)�
to_repositoryr!�
last_revisionr�r�N)r�LossyPushToSameVCSrerrR�experimentalrVrW�show_user_warning�breezy.bzr.fetchr�rSr�r	)r=rDr�r�rEr�s      r(r��"InterVersionedFileRepository.fetch4	s����+�+�D�K�K����E�E��;�;���+�+��M�M�+�+�+� �K�K�/�/��+�+�-�-�
,�
�
	1��;�;���+�+�-����1D�1D�1Q�1Q�1S�S��M�M�+�+�$� �K�K�/�/��+�+�-�-�
,�
�
�_�_�
��"�k�k� $���)�%�'�
��=��
�
�s�(E8�8
Fc��URR5n[U5nU(aURU5nOUn[	5nUR
R5nUR
U5n[[R/5nSn	[	5n
[	5n[U
5UR:aPUR5up�U
RU5 URU
5 [U
5UR:aMP[	URU55n[	U
5RU5nU(a�[	URU55nURU5nUR!U5 U(a/["R$"UR
UR'55eURU
U-
5 UR)U5nUR+U5 U	(aOGMkUR-5unnn[.R1UU[U5U5$![a Sn	GM3f=f)z�Walk out from revision_ids in source to revisions target has.

:param revision_ids: The start point for the search.
:return: A set of revision ids.
FT)rr8r��unionr�re�_make_breadth_first_searcherr1r2r��$_walk_to_common_revisions_batch_size�next_with_ghostsrbrkr�rVr�rr�rY�find_seen_ancestors�stop_searching_any�	get_stater�r�)r=r��if_present_ids�target_graph�all_wanted_revs�missing_revs�source_graph�searcher�null_set�searcher_exhausted�	next_revs�ghosts�next_revs_part�ghosts_part�ghosts_to_check�revs_to_get�	have_revs�	stop_revs�started_keys�excludesr�s                     r(�_walk_to_common_revisions�6InterVersionedFileRepository._walk_to_common_revisionsX	s����{�{�,�,�.�� ��.���*�0�0��@�O�*�O��u���{�{�,�,�.���<�<�_�M���m�9�9�:�;��"�����I��U�F��i�.�4�#L�#L�L��2:�2K�2K�2M�/�N��$�$�^�4��M�M�+�.�	�i�.�4�#L�#L�L�"�,�";�";�F�"C�D�O��i�.�.�.��?�K���� ;� ;�K� H�I�	�%�O�O�H�5�	��1�1�)�<�"�!�/�/����_�=P�=P�=R�S�S��#�#�I�	�$9�:�%�8�8��C�	��+�+�I�6�!��E�F3;�2D�2D�2F�/��x���%�%��(�C�
�$6�
�
�	
��7%��)-�&���s�4H3�3I�Ic�4�UR5 U(d4UcUb.URX#S9nUcUsSSS5 $UR5nON[URR55nUR
X#5n[U5RU5nUbGURR5RU5n	[[RX�55nURRU5sSSS5 $!,(df   g=f)aReturn the revision ids that source has that target does not.

:param revision_ids: return revision ids included by these
    revision_ids.  NoSuchRevision will be raised if any of these
    revisions are not present.
:param if_present_ids: like revision_ids, but will not cause
    NoSuchRevision if any of these are absent, instead they will simply
    not be in the result.  This is useful for e.g. finding revisions
    to fetch for tags, which may reference absent revisions.
:param find_ghosts: If True find missing revisions in deep history
    rather than just finding the surface difference.
:return: A breezy.graph.SearchResult.
N)r�)rr�r8r�rr�_present_source_revisions_forr�rer8�iter_topo_orderr�islicer�)
r=r�r�r��limitr�r��
target_ids�
source_ids�topo_ordereds
          r(�search_missing_revision_ids�8InterVersionedFileRepository.search_missing_revision_ids�	s��� �^�^�
���(�N�,F��7�7� �8����=�!��
�$�_�_�.�
�!����!=�!=�!?�@�
�!�?�?� ��
�!��_�7�7�
�C�
�� �#�{�{�4�4�6�F�F�z�R�� ��!1�!1�,�!F�G�
��;�;�<�<�Z�H�+�
�
�s�!D	�CD	�	
Dc��UcUGbUc
[5nUc
[5n[U5n[U5nURU5nURR5n[UR	U55nURU5nU(a/[R"URUR55eURU5nURU5VV	s/sH"up�U[R:wdMU	cM UPM$ n
nn	OURR5n
[U
5$s sn	nf)z�Returns set of all revisions in ancestry of revision_ids present in
the source repo.

:param revision_ids: if None, all revisions in source are returned.
:param if_present_ids: like revision_ids, but if any/all of these are
    absent no error is raised.
)r�r�rer8rVr�rr�rYr��
iter_ancestryr1r2r)r=r�r��all_wanted_idsr6�present_revsrD�	found_idsrvr/r�s           r(r��:InterVersionedFileRepository._present_source_revisions_for�	s!���#�~�'A��#�"�u���%�!$����|�,�L� ��0�N�)�/�/��?�N��K�K�)�)�+�E��u�3�3�N�C�D�L�"�-�-�l�;�G���+�+�D�K�K�����G�G�&�3�3�L�A�I�*/�)<�)<�Y�)G��)G�%�V��]�8�8�8��=D��)G�
��J����5�5�7�J��:����s�)D;�D;�D;c��grrrKs r(�_get_repo_format_to_test�5InterVersionedFileRepository._get_repo_format_to_test�	���r'c�h�URR=(a URR$r)rRr )�clsrers   r(�
is_compatible�*InterVersionedFileRepository.is_compatible�	s(��
�N�N�8�8�
=����<�<�	
r'rr�r)TNNN)rrrrr�r�r�r�r�r��classmethodr�r�r&rr'r(r�r�/	sV��+-�(���"!�H8
�vOS�%I�N�B�����
��
r'r�c�b�\rSrSr\S5r\S5rSrSr	Sr
SrSrS
S
jr
SrSrg	)�InterDifferingSerializeri�	c��grrrKs r(r��1InterDifferingSerializer._get_repo_format_to_test�	r�r'c��URR(dgURR(dgS[R;agUR	5(aUR	5(dgURR
(aURR
(dgUR(aURR(agS[R;agURRRRS5(dgURRRRS5$)NF�	IDS_never�
IDS_alwaysTzfile:///)rRr r�r�r�r�rQrS�
controldir�	transportr�
startswith�rers  r(r��&InterDifferingSerializer.is_compatible�	s����~�~�;�;���~�~�;�;���%�+�+�+���$�$�&�&�v�/H�/H�/J�/J���N�N�2�2��N�N�:�:���(�(�V�^�^�-I�-I���5�,�,�,��� � �*�*�/�/�:�:�:�F�F��� � �*�*�/�/�:�:�:�F�Fr'c���/nUHQnXB;aURXBU45 MURRU5nXRU'URXE45 MS U$![Ra Mnf=fr)r�rer}rr�)r=r��cache�possible_treesrvr�s      r(�
_get_trees�#InterDifferingSerializer._get_trees

s����"�F����%�%�v�V�}�&=�>�:��;�;�4�4�V�<�D�
%)�&�M�"�)�)�6�.�9�#����
�,�,����s�A�A4�3A4c��/n[5nUH�upgURRUR5nUHJup�p�U
cMU
(dMURn
U
S:waU
S:waM.UR	X�R
45 ML UR
[U5Xh45 M� UR5 USSS$)zKGet the best delta and base for this revision.

:return: (basis_id, delta)
Nr�r�rr)	r�r�r�r�rer�r�r�r5)r=r�rvr��deltas�texts_possibly_new_in_treerGr�r<rwr�r��	new_entryr�s              r(�_get_delta_for_revision�0InterDifferingSerializer._get_delta_for_revision
s���
��&)�U�"�$2� �H��'�'�3�3�J�4M�4M�N�E�;@�7�	�W��#���� �~�~���;�&�4�6�>��*�.�.��9K�9K�/L�M�<A�
�M�M�3�u�:�x�7�8�!%3�"	���
��a�y���}�r'c���[[RRUR	555nUR
R
U5nURU5nUR
RR
SU55nUVs/sHowSPM	 nnUR
RU5H�n	U	R5n
Xj4nUVs/sHowSPM	 nn[Rn
UR
RU
5nU	RRUR5nUR R#X�X�5 X�U
'M� gs snfs snf)aCFind all parent revisions that are absent, but for which the
inventory is present, and copy those inventories.

This is necessary to preserve correctness when the source is stacked
without fallbacks configured.  (Note that in cases like upgrade the
source may be not have _fallback_repositories even though it is
stacked.)
c3�&# �UHo4v� M	 g7frr)rOrvs  r(rP�KInterDifferingSerializer._fetch_parent_invs_for_stacking.<locals>.<genexpr>D
s���O
�$2�&�I�N�rRr�N)r�rrrr�rerVr�rPr��get_revision_idr1r2r}r�r�rr�)r=r_r��parent_revs�present_parents�absent_parents�parent_invs_keys_for_stackingrI�parent_inv_ids�parent_tree�current_revision_id�parents_parents_keys�parents_parentsrGr�r<s                r(�_fetch_parent_invs_for_stacking�8InterDifferingSerializer._fetch_parent_invs_for_stacking8
sF���)�/�/�7�7�
�8I�8I�8K�L�M���+�+�4�4�[�A��$�/�/��@��(,���(?�(?�(N�(N�O
�$2�O
�)
�%�.K�K�-J�c�b�'�-J��K��;�;�5�5�n�E�K�"-�"=�"=�"?��#@�AW�#X� �2F�G�2F�3�2�w�2F�O�G�$�2�2�H����2�2�8�<�J��.�.�:�:�:�;T�;T�U�E��K�K�.�.��!4�
�*5�%�&�F��L��Hs�E�E$c��[5n[5n/n/nURRU5nURX�5 SURlURRU5GH�n	U	R
5n
URU
S5nURX�5n[U5n
[U
5S:XaU
RX#U45 URX�U
5up.URRU
5nURX.X�R45 UR(aU	R!S5UR"U
'[5nUH�unnnnUcM
U(dQUR$R'5(dM5UR(aUR)UUR*45 MeUR)UUR*45 M� U
H^unnUR,n[U5H=nUunnUR/U5nUR*U:XdM,UR5U5 M? M` UR7U5 URU5 X�U
'U
nGM SURlURR8nUR$R8nU(a=[:R=UUR"UUR5nUR?U5 UR?URAUUR$RBRDUR$RBRF(+55 UHnUR$RH"U6 M UR$RJ(Ga<[5n[5nUH9nUR)URL5 UR7UR5 M; UROU5 URQ[RRT5 URRU5nURRU5HnUR
5n
X�nURUU5n
[U
5S:XaU
RX#U45 URUUU
5up.UR$RIX.U
U5 M� UHunURRWURL5nUR$RYURLU5 UR$R]URLU5 Mw U$![0R2a GMef=f![0RZa N^f=f)adFetch across a few revisions.

:param revision_ids: The revisions to copy
:param basis_id: The revision_id of a tree that must be in cache, used
    as a basis for delta when no other base is available
:param cache: A cache of RevisionTrees that we can use.
:return: The revision_id of the last converted tree. The RevisionTree
    for it will be in cache
Trrr�F)/r�rerVr�r�r�r�rxr�rWr�r�r�r�rv�_converting_to_rich_rootr��_revision_id_to_root_idrr�rer�r�r�rr�r�rbrr2�_new_root_data_streamr�r�rRr$r%r�rQrDr�r�r1r2r�r�r�rJ) r=r�rGr��root_keys_to_creater�pending_deltas�pending_revisionsr_r�r�rv�parent_treesr�r<r�r�rwr�r�r��	_basis_idr�r��file_key�
file_revisionr?�to_texts�root_streamr�r�r�s                                 r(�_fetch_batch�%InterDifferingSerializer._fetch_batchT
s���"�e���E�	������[�[�/�/��=�
��,�,�Z�?�15����.��K�K�.�.�|�<�D�#'�"6�"6�"8��#���(;�R�@�J��?�?�:�=�L�!�,�/�N��>�"�a�'��%�%�x�x��&A�B�"�:�:��.��O�H��{�{�/�/�0C�D�H��!�!��"5�7J�7J�K�
��,�,�DH�L�L�QS�DT��,�,�-@�A�*-��&�7<�3�	�8�W�e��#����;�;�9�9�;�;�!��4�4�,�/�/��%�.�.�0I�J� �*�.�.�����/H�I�8=� *8�%�	�:�&�5�5�	� $�%?� @�H�-5�*�G�]�!� )� 3� 3�G� <���~�~��6�2�9�9�(�C�!A�*8�
���7�8��$�$�X�.�)-�%�&�*�H�i=�j27����.��[�[�&�&�
��;�;�$�$���$�:�:�#��,�,�����	�K�
�)�)�+�6��%�%��(�(�����#�#�0�0��K�K�'�'�:�:�:�
�	
�$�E��K�K�.�.��6�$��;�;�-�-�-���J��5�L�-��� � ��!5�!5�6��!�!�(�"5�"5�6�.�
�(�(��6����}�:�:�;����3�3�J�?�J� $�{�{�9�9�*�E��&1�&A�&A�&C�#�",�"A��!%����%�!H���~�&�!�+�#�)�)�8�8�_�*E�F�"&�">�">���.�#������2�2��%8�/�� F�*�H�
� �K�K�:�:�8�;O�;O�P�	����.�.�x�/C�/C�Y�O�
�K�K�$�$�X�%9�%9�8�D�
*����K"�?�?�!� �!��D�(�(�
��
�s%�U�AU,�U)	�(U)	�,V�Vc��URUS5up4Sn[RS5nXFU'A/n[S[	U5U5H�nUR
R
5 UR[S5U[	U55 XX�-n	URX�U5nUR
R5n
U
(aURU
5 M�M� U(a>UR
RR (aUR
R#US9 UR[S5[	U5[	U55 g! SURl
UR
R5 e=f)z�Fetch everything for the list of revisions.

:param revision_ids: The list of revisions to fetch. Must be in
    topological order.
:param pb: A ProgressTask
:return: None
r�d�Transferring revisionsFr�N)�
_get_basisr1r2r3r�rr�rbrcr�r�r9rer�r�rRr�r�)r=r�r�rGr�r?r��hintsrB�batchr�s           r(�_fetch_all_revisions�-InterDifferingSerializer._fetch_all_revisions�
sA�� $���|�A��?����
��"�"�3�'��$�h������A�s�<�0�*�=�F��K�K�)�)�+�
'��	�	�'�":�;�V�S��EV�W�$�f�.A�B���,�,�U�e�D���{�{�5�5�7����L�L��&��>��T�[�[�(�(�8�8��K�K���%��(�
�	�	��,�-�s�<�/@�#�l�BS�	
��
�9>����6����-�-�/��s�)=E�.FNc��U(a+[R"URUR5eUbUR	5nOSnURR
R(aG[RRSURR
URR
S9 URR5(d.URR5(aSUl0UlOSUlURR
R5URR
R5:waG[RRSURR
URR
S9 UR5 Uc@U(aU/nOSnURRURUUS9R	5nU(d[!S5sSSS5 $["R%URR'5R)U55nU(d[!S5sSSS5 $[RR+5nUR-XW5 SSS5 [![/U55sSSS5 $!,(df   N+=f!,(df   g=f)	zSee InterRepository.fetch().Nr�r�TFr�)r�r�r)rr�rerr8rRr�rVrWr�r�r�r�rSr�r�r	r-r.r8rVrXrr�)r=rDr�r�rEr��search_revision_idsr�s        r(r��InterDifferingSerializer.fetch�
s����+�+�D�K�K����E�E��!�%�.�.�0�L��L��;�;���+�+��M�M�+�+�+� �K�K�/�/��+�+�-�-�
,�
�
�{�{�-�-�/�/�D�K�K�4R�4R�4T�4T�,0�D�)�+-�D�(�,1�D�)��;�;���+�+�-����1D�1D�1Q�1Q�1S�S��M�M�+�+�$� �K�K�/�/��+�+�-�-�
,�
�
�_�_�
��#��+6�-�'�*.�'�#�{�{�F�F��K�K�!4� +� G� ��(�*�	�
 �"�1�~��
�!�?�?����%�%�'�6�6�|�D��L� �"�1�~�#�
�*���2�2�4���)�)�,�;�5��s�<�0�1�/�
�*5�4��+�
�s2�*AK�	A
K� K�>J5�K�5
K	�?K�
Kc�d�URRU5nURSnURRU5 URR	U5nX44$![
[R4a0 [RnURR	U5nX44$f=f)aGet a revision and tree which exists in the target.

This assumes that first_revision_id is selected for transmission
because all other ancestors are already present. If we can't find an
ancestor we fall back to NULL_REVISION since we know that is safe.

:return: (basis_id, basis_tree)
r)
rer�rvrr}r0rr�r1r2)r=�first_revision_id�	first_revrGr�s     r(r��#InterDifferingSerializer._get_basis2s����K�K�,�,�->�?�	�		=� �+�+�A�.�H��K�K�$�$�X�.����2�2�8�<�J��#�#���F�1�1�2�	=�$�2�2�H����2�2�8�<�J��#�#�	=�s�AA%�%AB/�.B/)r�r�r�)rrrrr�r��staticmethodr�r�r�r�r�rr�r�r&rr'r(r�r��	sQ�������G��G�:�"�:5�8F�P!
�F12�f$r'r�c�8�\rSrSrSr\S5r\S5rSr	g)�InterSameDataRepositoryiIz{Code for converting between repositories that represent the same data.

Data format and model must match for this to work.
c�.�SSKJn UR5$)z�Repository format for testing with.

InterSameData can pull from subtree to subtree and from non-subtree to
non-subtree, so we test this with the richest repository format.
r)�knitrepo)�
breezy.bzrr�RepositoryFormatKnit3)r=rs  r(r��0InterSameDataRepository._get_repo_format_to_testOs��	(��-�-�/�/r'c��[R"X5=(a3 URR=(a URR$r)r
�_same_modelrRr r�s  r(r��%InterSameDataRepository.is_compatibleZs;��
�'�'��7�
=����<�<�
=����<�<�	
r'rN)
rrrrrr�r�rr�r&rr'r(r
r
Is/���
�0��0��
��
r'r
Nc	�
�[U5 [RS5n[U5H:unupgn[	XXxU5 UcMUR[
S5US-U5 M< SSS5 g!,(df   g=f)z�Install all revision data into a repository.

Accepts an iterable of revision, tree, signature tuples.  The signature
may be None.
r&Nr�r)r
r1r2rP�_install_revisionrbrc)	r>�iterable�
num_revisionsr�r>�nr�r}r�s	         r(�install_revisionsrhsr��
�J�	�#�,�,�R�0��7@��7J�3�A�3�����m��
��~��	�	�'�":�;�Q��U�M�R�8K�
 �	�	�s�8A4�#A4�4
Bc��/n0nURH`nURU5(a&URU5 URU5Xg'M?UR[R
5Xg'Mb URnUR5n	UR5(dF[U	5up�URUR:wa[R"[U55e0nU	Hup�X�URUR4'M! UR R#U5n[%U5[%U5-
nUH�nUUn/nUR'5HXunnUR)UR5n
UR-U
5nUU;aM;URURU45 MZ UR)UR5nUR/U5nUR15nSSS5 UR R3UUW5 M� UR4R6(aw[9UR5(a]X�UR'XARSnUR;U5nUR=URSUURU5 OURAURX�5 UbUREURU5 URGURX5 g![R*a GM�f=f!,(df   GN8=f![>a URAURX�5 N�f=f![RBa N�f=f)�,Install all revision data into a repository.Nr)$rvr�r�r}r1r2r�rrr�r\r�rDrr�reprr�rrVr�r�r�r��get_file_revision�get_file�	readlinesrArRr#r�r�r�r4r0�RevisionAlreadyPresentr�rJ)r>r�r}r�r>r�r��p_idr/�entriesr�r-rrxr��text_parent_mapr�r:�text_parents�	_revisionr�r��revision_tree_path�frDr�r<s                           r(rrxs����O��L������"�"�4�(�(��"�"�4�(�!+�!9�!9�$�!?�L��!+�!9�!9�-�:U�:U�!V�L����
&�
&�C���� �G��(�(�*�*��'�]�
���=�=�C�O�O�+��-�-�d�:�.>�?�?��I��	��/1�2�:�:�r�{�{�+�,�� �&�&�5�5�i�@�O��	�N�S��%9�9�M�!��
�x�
 ����
 ,�1�1�3�O�I�t�
��|�|�B�J�J�/���.�.�t�4�I��L�(��������Y� 7�8� 4�+�2�2�2�:�:�>��
�
#�
#�$6�
7�1��K�K�M�E�8����"�"�8�\�5�A�'"�(
����0�0�S����5H�5H�/2�C�O�O�,�
�+�N�N�1�,=�>�	����	�2���1�1��N�N�1�%�u�c�o�o���
�$�$�S�_�_�c�K����%�%�c�o�o�y�A����C�O�O�S�6��=�?�?�
��
��8�
7���
P��(�(����#�O�
P���(�(�
��
�s[�(L�)L+�$AM)�(L=�9<M)�6M)�L(�'L(�+
L:	�=&M&�#M)�%M&�&M)�)N�?Nc�"�[XUS4/5 g)rN)r)r>r�r}s   r(�install_revisionr+�s���j���#=�">�?r'r�))r�iorr�globalsr�r�
decoratorsrr>rr	r
rrr
�tracerrrWrrr�rrrrr*r
r�r�r�r�r�r�r�r
�register_optimiserrrr+rr'r(�<module>r1s#��"7��%���I���B�$���!�/�.�B��$4��(H��H�VD*�j�D*�N$?�%6�8O�?�O��:�O�R)�R)�j]�]�@	<*�<*�~u
�?�u
�p_$�;�_$�D
�:�
�4�"�"�#?�@��"�"�#;�<��"�"�#:�;�
S� A7�H@r'

Youez - 2016 - github.com/yon3zu
LinuXploit