403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.17
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/smart/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

p��g����2�SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r
SSKJrJ
r
JrJrJr SSKJr SSKJrJr SSKJr SS	KJrJrJr SS
KJr SSKJrJrJ r  SS
K!J"r"J#r#J$r$ "SS\#5r%"SS\%5r&"SS\%5r'Sr("SS\%5r)"SS\&5r*"SS\&5r+"SS\%5r,"SS\%5r-"SS\%5r."S S!\%5r/"S"S#\%5r0"S$S%\%5r1"S&S'\%5r2"S(S)\%5r3"S*S+\%5r4"S,S-\45r5S.r6"S/S05r7S\S1jr8"S2S3\%5r9"S4S5\%5r:"S6S7\%5r;"S8S9\%5r<"S:S;\%5r="S<S=\=5r>"S>S?\=5r?"S@SA\%5r@"SBSC\%5rA"SDSE\%5rB"SFSG\%5rC"SHSI\%5rD"SJSK\%5rE"SLSM\%5rF"SNSO\%5rG"SPSQ\%5rH"SRSS\%5rI"STSU\%5rJ"SVSW\%5rK"SXSY\%5rL"SZS[\%5rMg)]z7Server-side repository related request implementations.�N�)�errors�estimate_compressed_size�osutils�trace�ui)�revision)�_strip_NULL_ghosts�network_format_registry�)�	inventory)�inventory_delta�pack�	vf_search)�BzrDir)�ChunkedContentFactory�NetworkRecordStream�record_to_fulltext_bytes�)�FailedSmartServerResponse�SmartServerRequest�SuccessfulSmartServerResponsec�8�\rSrSrSrSrSrS	SjrS	SjrSr	g)
�SmartServerRepositoryRequest�0z*Common base class for Repository requests.c��URU5n[R"U5nUR5UlUR
"UR/UQ76$)a�Execute a repository request.

All Repository requests take a path to the repository as their first
argument.  The repository must be at the exact path given by the
client - no searching is done.

The actual logic is delegated to self.do_repository_request.

:param client_path: The path for the repository as received from the
    client.
:return: A SmartServerResponse from self.do_repository_request().
)�transport_from_client_pathr�open_from_transport�open_repository�_repository�do_repository_request)�self�path�args�	transport�bzrdirs     �=/usr/lib/python3/dist-packages/breezy/bzr/smart/repository.py�do�SmartServerRepositoryRequest.do3sQ���3�3�D�9�	��+�+�I�6��!�1�1�3����)�)�$�*:�*:�B�T�B�B�c��g)z1Override to provide an implementation for a verb.N��r"�
repositoryr$s   r'r!�2SmartServerRepositoryRequest.do_repository_requestFs��r*c��US:Xa[R"U5S4$URS5nUSS:XaUSSn[R"XQ5nUS4$USS:XaUR	XSSUS9$S[S	54$)
a"Recreate a search from its serialised form.

:param discard_excess: If True, and the search refers to data we don't
    have, just silently accept that fact - the verb calling
    recreate_search trusts that clients will look for missing things
    they expected and get it from elsewhere.
s
everythingN�
rsancestry-ofrssearch��discard_excess)s	BadSearch)r�EverythingResult�split�PendingAncestryResult�recreate_search_from_reciper)r"r.�search_bytesr3�lines�heads�
search_results       r'�recreate_search�,SmartServerRepositoryRequest.recreate_searchLs����=�(��-�-�j�9�4�?�?��"�"�5�)����8�~�%��!�"�I�E�%�;�;�E�N�M� �$�&�&�
�1�X��
"��3�3��!�"�I�n�4��
��3�O�D�E�Er*c��[USRS55n[USRS55n[USRS55nUR	5 UR5R
U5n[U5nURURU55 M.![a Of=fUR5up�nU(d%[U5U:waS[S54sSSS5 $[R"X�[U5U5nUS4sSSS5 $!,(df   g=f)a2Recreate a specific revision search (vs a from-tip search).

:param discard_excess: If True, and the search refers to data we don't
    have, just silently accept that fact - the verb calling
    recreate_search trusts that clients will look for missing things
    they expected and get it from elsewhere.
r� rr�asciiN)�NoSuchRevision)�setr5�int�decode�	lock_read�	get_graph�_make_breadth_first_searcher�next�
StopIteration�stop_searching_any�intersection�	get_state�lenrr�SearchResult)
r"r.r9r3�
start_keys�exclude_keys�revision_count�search�	next_revs�started_keys�excludes�
included_keysr;s
             r'r7�8SmartServerRepositoryRequest.recreate_search_from_recipebs$����q�����-�.�
��5��8�>�>�$�/�0���U�1�X�_�_�W�5�6��
�
!�
!�
#��)�)�+�H�H��T�F��� $�V��I��)�)�,�*C�*C�I�*N�O���%�����7=�6F�6F�6H�3�\�]�!�c�-�&8�N�&J��7�8L�M�N�$�
#� &�2�2���M�(:�M��M�"�4�(�'$�
#�
#�s6�(!D4�
B7�"D4�7
C�D4�C�8D4�$D4�4
E�r N)F)
�__name__�
__module__�__qualname__�__firstlineno__�__doc__r(r!r<r7�__static_attributes__r,r*r'rr0s��4�C�&�F�,)r*rc��\rSrSrSrSrSrg)�SmartServerRepositoryReadLocked�z,Calls self.do_readlocked_repository_request.c�~�UR5 UR"U/UQ76sSSS5 $!,(df   g=f)z<Read lock a repository for do_readlocked_repository_request.N)rE� do_readlocked_repository_requestr-s   r'r!�5SmartServerRepositoryReadLocked.do_repository_request�s-��
�
!�
!�
#��8�8��K�d�K�$�
#�
#���.�
<r,N�rYrZr[r\r]r!r^r,r*r'r`r`�s��6�Lr*r`c��\rSrSrSrSrSrg)�SmartServerRepositoryBreakLock�zBreak a repository lock.c�8�UR5 [S5$)N��ok)�
break_lockr�r"r.s  r'r!�4SmartServerRepositoryBreakLock.do_repository_request�s������,�X�6�6r*r,Nrfr,r*r'rhrh�s
��"�7r*rhc�:�\rSrSrSrSrSrSrS
SjrSr	Sr
g	)�!SmartServerRepositoryGetParentMap�z?Bzr 1.2+ - get parent data for revisions during a graph search.Fc��X lg)a=Get parent details for some revisions.

All the parents for revision_ids are returned. Additionally up to 64KB
of additional parent data found by performing a breadth first search
from revision_ids is returned. The verb takes a body containing the
current search state, see do_body for details.

If 'include-missing:' is in revision_ids, ghosts encountered in the
graph traversal for getting parent data are included in the result with
a prefix of 'missing:'.

:param repository: The repository to query in.
:param revision_ids: The utf8 encoded revision_id to answer for.
N��
_revision_ids)r"r.�revision_idss   r'r!�7SmartServerRepositoryGetParentMap.do_repository_request�s
��*��r*c��URnUR5 URU5sSSS5 $!,(df   g=f)aProcess the current search state and perform the parent lookup.

:return: A smart server response where the body contains an utf8
    encoded flattened list of the parents of the revisions (the same
    format as Repository.get_revision_graph) which has been bz2
    compressed.
N)r rE�_do_repository_request)r"�
body_bytesr.s   r'�do_body�)SmartServerRepositoryGetParentMap.do_body�s5���%�%�
�
�
!�
!�
#��.�.�z�:�$�
#�
#�s	�8�
Ac��0n[5n[R"U5nUn	Sn
U	(GaJURU	5 UR	U	5nU	n[5n	UH�n
SnURU
5nUb+U[R4:XaSnU	RU5 U
nO	SnSU
-n/nX�;dMTU(a	U(dMdX�U'US-SRU5-S-nURU5 M� UR(dU
(aNUR5(a9[R"SURUR5 [5n	U$U	R!U5n	Sn
U	(aGMJU$)NFr,Tsmissing:r?r1zsize: %d, z_size: %d)rBr�
ZLibEstimator�update�get_parent_map�get�
_mod_revision�
NULL_REVISION�join�add_content�no_extra_results�fullr�mutter�_uncompressed_size_added�_compressed_size_added�
difference)r"�
repo_graphrv�client_seen_revs�include_missing�max_size�result�queried_revs�	estimatorrS�first_loop_done�
parent_map�current_revs�revision_id�missing_rev�parents�
encoded_id�lines                  r'�_expand_requested_revs�8SmartServerRepositoryGetParentMap._expand_requested_revs�sm�����u��,�:�:�8�D�	� �	�������	�*�#�2�2�9�=�J�$�L���I�+��#��$�.�.��5���&��=�#>�#>�"@�@�"$���$�$�W�-�!,�J�"&�K�!,�{�!:�J� �G��6�#���*1�:�&�%��,�t�y�y��/A�A�E�I�D��)�)�$�/�- ,�6�$�$��Y�^�^�=M�=M����*��6�6��4�4��
 �E�	���
�"�,�,�\�:�I�"�O�U�i�V�
r*c	�h�URn[UR5nSU;nU(aURS5 UR	S5nURX%5upgUbU$[UR
55nURU5 UR5n	URX�X�5n
/n[U
R55H2up�URSRU4[U
5-55 M4 [S[ R""SRU555$)Nsinclude-missing:r1r?rk)r rBru�remover5r7�get_keys�difference_updaterFr��sorted�items�appendr��tupler�bz2�compress)r"rzr.rvr��
body_linesr;�errorr�r�r�r9r	r�s              r'ry�8SmartServerRepositoryGetParentMap._do_repository_request�s���%�%�
��4�-�-�.��-��=������ 3�4��%�%�e�,�
�#�?�?�
�W��
����L��}�5�5�7�8���*�*�<�8��)�)�+�
��,�,��&6�
����!'�����!7��H��L�L����H�;��w��#?�@�A�"8�-�X�s�|�|�E�J�J�u�DU�7V�W�Wr*rtN)i)rYrZr[r\r]r�r!r{r�ryr^r,r*r'rqrq�s&��I����$
;�$�
8�tXr*rqc��\rSrSrSrSrg)�%SmartServerRepositoryGetRevisionGraphic	��U(dSn/nUR5nU(aU/nOUR5nURU5n[[R
R
U55nURU5n[U5n	U(aX);a[SU4S5$U	R5H2up�URSRU
4[U5-55 M4 [SSRU55$)afReturn the result of repository.get_revision_graph(revision_id).

Deprecated as of bzr 1.4, but supported for older clients.

:param repository: The repository to query in.
:param revision_id: The utf8 encoded revision_id to get a graph from.
:return: A smart server response where the body contains an utf8
    encoded flattened list of the revision graph.
N�nosuchrevisionr*r?rkr1)rF�all_revision_idsrGrB�	itertools�chain�
from_iterabler�r
rr�r�r�r�r)r"r.r�r9�graph�
search_idsrR�transitive_idsr��revision_graphr	r�s            r'rc�FSmartServerRepositoryGetRevisionGraph.do_readlocked_repository_requests�����K����$�$�&���%��J�#�4�4�6�J��3�3�J�?���Y�_�_�:�:�6�B�C���)�)�.�9�
�+�J�7���;�<�-�.?��-M�s�S�S�!/�!5�!5�!7��H��L�L����H�;��w��#?�@�A�"8�-�X�u�z�z�%�7H�I�Ir*r,N�rYrZr[r\rcr^r,r*r'r�r�s�� Jr*r�c��\rSrSrSrSrg)�%SmartServerRepositoryGetRevIdForRevnoi6c���URX#5upEU(a
[SU45$Uup�[SX�45$![RaMnURUS:wa[	SUR-5Ue[SUR45sSnA$SnAf[Ra7n[SURURUR45sSnA$SnAff=f)zPFind the revid for a given revno, given a known revno/revid pair.

New in 1.17.
rzIget_rev_id_for_revno raised RevisionNotPresent for non-initial revision: r�Nsrevno-outofboundsrlshistory-incomplete)�get_rev_id_for_revnor�NoSuchRevisionr	�AssertionErrorr�RevnoOutOfBounds�revno�minimum�maximumr)
r"r.r��
known_pair�
found_flagr��err�e�earliest_revno�earliest_revids
          r'rc�FSmartServerRepositoryGetRevIdForRevno.do_readlocked_repository_request7s���
	�!+�!@�!@��!S��J��0�%���A�A�-3�*�N�0�&��G��
���$�$�	P��|�|�z�!�}�,�$�-�/2�|�|�<����-�.?����-N�O�O���&�&�	�,�%�q�w�w��	�	�1�9�9�E��
��	�s.�:�C$�AB�C$�C$�-,C�C$�C$r,Nr�r,r*r'r�r�6s��r*r�c��\rSrSrSrSrg)�(SmartServerRepositoryGetSerializerFormatiRc�<�UR5n[SU45$)z�Return the serializer format for this repository.

New in 2.5.0.

:param repository: The repository to query
:return: A smart server response (b'ok', FORMAT)
rl)�get_serializer_formatr)r"r.�
serializers   r'r!�>SmartServerRepositoryGetSerializerFormat.do_repository_requestSs"�� �5�5�7�
�,�e�Z�-@�A�Ar*r,N�rYrZr[r\r!r^r,r*r'r�r�Rs��	Br*r�c��\rSrSrSrSrg)�SmartServerRequestHasRevisioni_c�Z�URU5(a[S5$[S5$)aReturn ok if a specific revision is in the repository at path.

:param repository: The repository to query in.
:param revision_id: The utf8 encoded revision_id to lookup.
:return: A smart server response of ('yes', ) if the revision is
    present. ('no', ) if it is missing.
��yes�sno)�has_revisionr�r"r.r�s   r'r!�3SmartServerRequestHasRevision.do_repository_request`s+���"�"�;�/�/�0��;�;�0��:�:r*r,Nr�r,r*r'r�r�_s��;r*r�c��\rSrSrSrSrg)�+SmartServerRequestHasSignatureForRevisionIdinc��URU5(a[S5$[S5$![Ra [	SU45s$f=f)a7Return ok if a signature is present for a revision.

Introduced in bzr 2.5.0.

:param repository: The repository to query in.
:param revision_id: The utf8 encoded revision_id to lookup.
:return: A smart server response of ('yes', ) if a
    signature for the revision is present,
    ('no', ) if it is missing.
r�r�r�)�has_signature_for_revision_idrrr�rr�s   r'r!�ASmartServerRequestHasSignatureForRevisionId.do_repository_requestosW��	O��7�7��D�D�4�Y�?�?�4�X�>�>���$�$�	O�,�.?��-M�N�N�	O�s� .�
.�!A�Ar,Nr�r,r*r'r�r�ns��Or*r�c��\rSrSrSrSrg)� SmartServerRepositoryGatherStatsi�c�f�US:XaSnOUnUS:XaSnOSnURXE5nSnSU;aUSUS--
nSU;aUS	US--
nS
U;aUSUS
--
nSU;aUS
US--
nSU;aUSUS--
n[	SU5$![Ra [SU45s$f=f)a�Return the result of repository.gather_stats().

:param repository: The repository to query in.
:param revid: utf8 encoded rev id or an empty string to indicate None
:param committers: 'yes' or 'no'.

:return: A SmartServerResponse (b'ok',), a encoded body looking like
      committers: 1
      firstrev: 1234.230 0
      latestrev: 345.700 3600
      revisions: 2

      But containing only fields returned by the gather_stats() call
r*Nr�Tr��
committersscommitters: %d
�firstrevsfirstrev: %.3f %d
�	latestrevslatestrev: %.3f %d
�	revisionssrevisions: %d
�sizes	size: %d
rk)�gather_statsrr�rr)r"r.�revidr��decoded_revision_id�decoded_committers�stats�bodys        r'r!�6SmartServerRepositoryGatherStats.do_repository_request�s���C�<�"&��"'�����!%��!%��	I��+�+�,?�T�E����5� ��'�%��*=�=�=�D�����*�U�:�->�>�>�D��%���+�e�K�.@�@�@�D��%���&��{�);�;�;�D��U�?��M�E�&�M�1�1�D�,�X�t�<�<���$�$�	I�,�.?��-G�H�H�	I�s�B�!B0�/B0r,Nr�r,r*r'r�r��s��(=r*r�c��\rSrSrSrSrSrg)�-SmartServerRepositoryGetRevisionSignatureTexti�z6Return the signature text of a revision.

New in 2.5.
c��URU5n[SU5$![Ra!n[SUR45sSnA$SnAff=f)z�Return the result of repository.get_signature_text().

:param repository: The repository to query in.
:return: A smart server response of with the signature text as
    body.
r�Nrk)�get_signature_textrr�rr	r)r"r.r��textr�s     r'r!�CSmartServerRepositoryGetRevisionSignatureText.do_repository_request�sV��	P��0�0��=�D�-�X�t�<�<���$�$�	P�,�.?����-N�O�O��	P�s��A�A�	A�Ar,Nrfr,r*r'r�r��s���
=r*r�c��\rSrSrSrSrg)�SmartServerRepositoryIsSharedi�c�X�UR5(a[S5$[S5$)z�Return the result of repository.is_shared().

:param repository: The repository to query in.
:return: A smart server response of ('yes', ) if the repository is
    shared, and ('no', ) if it is not.
r�r�)�	is_sharedrrns  r'r!�3SmartServerRepositoryIsShared.do_repository_request�s)�����!�!�0��;�;�0��:�:r*r,Nr�r,r*r'r�r��s��
;r*r�c��\rSrSrSrSrg)�%SmartServerRepositoryMakeWorkingTreesi�c�X�UR5(a[S5$[S5$)z�Return the result of repository.make_working_trees().

Introduced in bzr 2.5.0.

:param repository: The repository to query in.
:return: A smart server response of ('yes', ) if the repository uses
    working trees, and ('no', ) if it is not.
r�r�)�make_working_treesrrns  r'r!�;SmartServerRepositoryMakeWorkingTrees.do_repository_request�s)���(�(�*�*�0��;�;�0��:�:r*r,Nr�r,r*r'r�r��s��;r*r�c��\rSrSrSSjrSrg)�SmartServerRepositoryLockWritei�c���US:XaSnURUS9RnUbUR5 UR5 UcSn[SU45$![Ra [	S5s$[R
a [	S5s$[Ra>n[	S[UR5[UR545sSnA$SnAff=f)Nr*��token)sLockContention)sUnlockableTransports
LockFailedrl)
�
lock_write�repository_tokenr�LockContentionr�UnlockableTransport�
LockFailed�str�lock�why�leave_lock_in_place�unlockr)r"r.rr�s    r'r!�4SmartServerRepositoryLockWrite.do_repository_request�s����C�<��E�	W��)�)��)�6�G�G�E����*�*�,������=��E�,�e�U�^�<�<���$�$�	C�,�-A�B�B��)�)�	H�,�-F�G�G�� � �	W�,�m�S����[�#�a�e�e�*�-U�V�V��	W�s)�A�C*�9C*�C*�,3C%�C*�%C*r,N)r*r�r,r*r'r�r��s��=r*r�c�,�\rSrSrSrSrSrSrSrg)�SmartServerRepositoryGetStreami�c�z�[R"U5UlUR5(a[	S5$g)a�Get a stream for inserting into a to_format repository.

The request body is 'search_bytes', a description of the revisions
being requested.

In 2.3 this verb added support for search_bytes == 'everything'.  Older
implementations will respond with a BadSearch error, and clients should
catch this and fallback appropriately.

:param repository: The repository to stream from.
:param to_network_name: The network name of the format of the target
    repository.
)s
UnknownMethodsRepository.get_streamN)rr��
_to_format�_should_fake_unknownr�r"r.�to_network_names   r'r!�4SmartServerRepositoryGetStream.do_repository_request�s:��2�5�5�o�F����$�$�&�&�,�<��
�r*c��URRnURnUR(dgUR(a4URURLaUR
UR
:Xagg)aReturn True if we should return UnknownMethod to the client.

This is a workaround for bugs in pre-1.19 clients that claim to
support receiving streams of CHK repositories.  The pre-1.19 client
expects inventory records to be serialized in the format defined by
to_network_name, but in pre-1.19 (at least) that format definition
tries to use the xml5 serializer, which does not correctly handle
rich-roots.  After 1.19 the client can also accept inventory-deltas
(which avoids this issue), and those clients will use the
Repository.get_stream_1.19 verb instead of this one.
So: if this repository is CHK, and the to_format doesn't match,
we should just fake an UnknownSmartMethod error so that the client
will fallback to VFS, rather than sending it a stream we know it
cannot handle.
FT)r �_formatr�
supports_chks�repository_class�_serializer)r"�from_format�	to_formats   r'r�3SmartServerRepositoryGetStream._should_fake_unknownse�� �&�&�.�.���O�O�	��(�(���#�#��,�,�	�0J�0J�J��'�'�9�+@�+@�@��r*c�^�URnUR5 URX!SS9up4UbUR5 U$UR	UR
5nUR
U5n[SURXb5S9$![a UR5 e!e=ff=f)NTr2rk��body_stream)
r rEr<r�_get_sourcer�
get_stream�	Exceptionrr)r"rzr.r;r��source�streams       r'r{�&SmartServerRepositoryGetStream.do_body-s����%�%�
�����	�#'�#7�#7��t�$8�$� �M�� ��!�!�#����+�+�D�O�O�<�F��&�&�}�5�F�-��$�"2�"2�6�"F�
�	
��
�	�
��!�!�#�����	�s)�&B
�,B
�

B,�B&�%B,�&B(�(B,c#�# �[XR5nUShv�N UR5 gN![Ra3nUR5 [SUR45v� SnAgSnAff=f7f�NrA��_stream_to_byte_streamrrr�RevisionNotPresentrr��r"r$r.�byte_streamr�s     r'r�*SmartServerRepositoryGetStream.body_streamC�p���,�V�5G�5G�H��	 �"�"�"�
����
#���(�(�	P�
����+�->��
�
�,N�O�O��		P��7�B�6�4�6�B�6�A=�
)A8�3B�8A=�=B�rN)	rYrZr[r\r!rr{rr^r,r*r'rr�s���*�B
�,
 r*rc��\rSrSrSrSrSrg)�#SmartServerRepositoryGetStream_1_19iPz�The same as Repository.get_stream, but will return stream CHK formats to
clients.

See SmartServerRepositoryGetStream._should_fake_unknown.

New in 1.19.
c��g)zAReturns False; we don't need to workaround bugs in 1.19+ clients.Fr,�r"s r'r�8SmartServerRepositoryGetStream_1_19._should_fake_unknownYs��r*r,N)rYrZr[r\r]rr^r,r*r'r2r2Ps���r*r2c#�# �[R"5nUR5v� URUR	5S5v� UH�up4UH�nUR
S;a[
U5nOOUR
S:Xa$[SRUR55eURUR
5nU(dMwURXcRS54/5v� M� M� UR5v� g7f)z8Convert a record stream to a self delimited byte stream.r*)�chunked�fulltext�absentzAbsent factory for {}r@N)
r�ContainerSerialiser�begin�bytes_record�network_name�storage_kindr�
ValueError�format�key�get_bytes_as�encode�end)r$�
src_format�pack_writer�substream_type�	substream�record�
serialiseds       r'r)r)^s�����*�*�,�K�
�
�
�
��
�
"�
"�:�#:�#:�#<�c�
B�B�%+�!���F��"�"�&=�=�5�f�=�
��$�$��0� �!8�!?�!?��
�
�!K�L�L�#�0�0��1D�1D�E�
��z�"�.�.��"7�"7��"@�!B� C��� �&,��/�/�
��s�CD�?Dc�6�\rSrSrSrSrSrSrSrSr	Sr
g	)
�_ByteStreamDecoderiua�Helper for _byte_stream_to_stream.

The expected usage of this class is via the function _byte_stream_to_stream
which creates a _ByteStreamDecoder, pops off the stream format and then
yields the output of record_stream(), the main entry point to
_ByteStreamDecoder.

Broadly this class has to unwrap two layers of iterators:
(type, substream)
(substream details)

This is complicated by wishing to return type, iterator_for_type, but
getting the data for iterator_for_type when we find out type: we can't
simply pass a generator down to the NetworkRecordStream parser, instead
we have a little local state to seed each NetworkRecordStream instance,
and gather the type that we'll be yielding.

:ivar byte_stream: The byte stream being decoded.
:ivar stream_decoder: A pack parser used to decode the bytestream
:ivar current_type: The current type, used to join adjacent records of the
    same type into a single stream.
:ivar first_bytes: The first bytes to give the next NetworkRecordStream.
c�z�[R"5UlSUlSUlXlX lSUlg)zCreate a _ByteStreamDecoder.Nr)r�ContainerPushParser�stream_decoder�current_type�first_bytesr,�_record_counter�	key_count)r"r,�record_counters   r'�__init__�_ByteStreamDecoder.__init__�s6��"�6�6�8��� ������&��-����r*c#�# �URR5Shv�N URH@nURRU5 URR5Shv�N MB gNUN7f)z5Iterate the contents of the pack from stream_decoder.N)rO�read_pending_recordsr,�accept_bytes�r"�bytess  r'�iter_stream_decoder�&_ByteStreamDecoder.iter_stream_decoder�sf����&�&�;�;�=�=�=��%�%�E����,�,�U�3��*�*�?�?�A�A�A�&�	>�
B�s"�A:�A6�AA:�,A8�-
A:�8A:c#��# �URbURv� SUlURH1nUup#UunUSnXPR:waXPlX0l gUv� M3 g7f)Nr)rQ�iter_pack_recordsrP)r"rI�record_names�record_bytes�record_namerGs      r'�iter_substream_bytes�'_ByteStreamDecoder.iter_substream_bytes�sn������'��"�"�"�#�D���,�,�F�)/�&�L�)�N�[�(��^�N��!2�!2�2�$2�!�#/� ����-�s�A%A'c#�>^# �U4SjnTR5 [RR5nTRnTR
bN[
TR55nTRRS5U"X#U54v� TR
bMNU(a'URSURUR5 SSS5 g!U(a(URSURUR5 ff=f!,(df   g=f7f)z5Yield substream_type, substream from the byte stream.c3�># �SnU(a[TRS:waKTRS:wa;UR5(d&URTRTR5 UR	5H�nU(a�UR5(aIX1R
:Xa:UR
U5 URSURUR5 SnTRS:XaBT=RS-
slX1R
:XaURSTR5 SnUS-
nUv� M� g7f)z1Yield records from stream while showing progress.rr��EstimaterzEstimating..N)
rPrS�is_initialized�setup�read�STEP�	incrementr�current�max)�pb�rcrH�counterrIr"s     �r'�wrap_and_count�8_ByteStreamDecoder.record_stream.<locals>.wrap_and_count�s������G���$�$��3����!�8K��,�,�.�.����������@�#�.�.�*����(�(�*�*�w�'�'�/A����W�-��	�	�*�b�j�j�"�&�&�A�"#���(�(�K�7����!�+��"�g�g�-��I�I�n�d�n�n�E�&'�G��1�����#+�s�D=ENr@�Done)�
seed_stater�
ui_factory�nested_progress_barrRrQrrcrPrDrrn)r"rrrorprHs`    r'�
record_stream� _ByteStreamDecoder.record_stream�s�����	�8	
����
�]�]�
.�
.�
0�B��%�%�B�

6��&�&�2� 3�D�4M�4M�4O� P�I�
�)�)�0�0��9�&�r�y�9����&�&�2���I�I�f�b�f�f�b�f�f�5�1�
0����I�I�f�b�f�f�b�f�f�5���1�
0�s5�5D�
D�AC�!.D�	D�1D	�	D�
D�Dc�`�UR5Ul[UR55 g)z>Prepare the _ByteStreamDecoder to decode from the pack stream.N)r\r_�listrcr4s r'ru�_ByteStreamDecoder.seed_state�s(��"&�!9�!9�!;���	
�T�
&�
&�
(�)r*)rRr,rPrQr_rSrON)rYrZr[r\r]rUr\rcrxrur^r,r*r'rLrLus"���0�B�� /6�b*r*rLc��[X5nUHknURRU5 URRSS9H0nUupV[R
"U5nXrR
54s s $ Mm g)z�Convert a byte stream into a format and a stream.

:param byte_stream: A bytes iterator, as output by _stream_to_byte_stream.
:return: (RepositoryFormat, stream_generator)
r)rnN)rLrOrYrXrr�rx)r,rT�decoderr[rIr`�src_format_namerEs        r'�_byte_stream_to_streamr��su��!��=�G������+�+�E�2��,�,�A�A�a�A�H�F�,2�)�L�0�4�4�_�E�J��4�4�6�6�6�I�r*c��\rSrSrSrSrg)�SmartServerRepositoryUnlocki�c���URUS9 UR	5 UR5 [
S5$![Ra [S5s$f=f)Nr)s
TokenMismatchrk)rr�
TokenMismatchr�dont_leave_lock_in_placerr)r"r.rs   r'r!�1SmartServerRepositoryUnlock.do_repository_request�sc��	B��!�!��!�.�	�+�+�-�����,�X�6�6��	�#�#�	B�,�-@�A�A�	B�s�<�A�Ar,Nr�r,r*r'r�r��s��7r*r�c��\rSrSrSrSrSrg)�*SmartServerRepositoryGetPhysicalLockStatusiz<Get the physical lock status for a repository.

New in 2.5.
c�X�UR5(a[S5$[S5$)Nr�r�)�get_physical_lock_statusrrns  r'r!�@SmartServerRepositoryGetPhysicalLockStatus.do_repository_request
s'���.�.�0�0�0��;�;�0��:�:r*r,Nrfr,r*r'r�r�s���
;r*r�c��\rSrSrSrSrg)�(SmartServerRepositorySetMakeWorkingTreesic�P�US:XaSnOSnURU5 [S5$)N�TrueTFrk)�set_make_working_treesr)r"r.�str_bool_new_value�	new_values    r'r!�>SmartServerRepositorySetMakeWorkingTrees.do_repository_requests-����(��I��I��)�)�)�4�,�X�6�6r*r,Nr�r,r*r'r�r�s��7r*r�c�0�\rSrSrSrSrSrSrSrSr	g)	�SmartServerRepositoryTarballia#Get the raw repository files as a tarball.

The returned tarball contains a .bzr control directory which in turn
contains a repository.

This takes one parameter, compression, which currently must be
"", "gz", or "bz2".

This is used to implement the Repository.copy_content_into operation.
c��URU5up4US-nURXR5[R"U5 $![R"U5 f=f)Nz/.bzr)�_copy_to_tempdir�_tarfile_responser�rmtree)r"r.�compression�tmp_dirname�tmp_repo�controldir_names      r'r!�2SmartServerRepositoryTarball.do_repository_request'sK�� $� 5� 5�j� A���	(�)�G�3�O��)�)�/�G��N�N�;�'��G�N�N�;�'�s�A�Ac���[R"SS9nURRR	U5nURR	U5nURU5 X$4$)N�tmpbzrclone)�prefix)�tempfile�mkdtemp�
controldirr�
initialize�copy_content_into)r"�	from_repor��
tmp_bzrdirr�s     r'r��-SmartServerRepositoryTarball._copy_to_tempdir/s[���&�&�m�<���)�)�1�1�<�<�[�I�
��$�$�/�/�
�;���#�#�H�-��$�$r*c���[R"5nURXUR5 UR	S5 [SUR
55sSSS5 $!,(df   g=f)Nrrk)r��NamedTemporaryFile�_tarball_of_dir�file�seekrrj)r"r�r��temps    r'r��.SmartServerRepositoryTarball._tarfile_response6sK��
�
(�
(�
*�d�� � ��4�9�9�E��I�I�a�L�0��4�9�9�;�G�	+�
*�
*�s�AA'�'
A5c�f�SSKn[RRUR5nURX5SU-S9nUR
[R"55nURS5(d[U5eURUS5 SSS5 g!,(df   g=f)Nrzw|)�fileobj�name�modez.bzr)�tarfile�osr#�basenamer��openrC�sys�getfilesystemencoding�endswithr?�add)r"�dirnamer��ofiler��filename�tarballs       r'r��,SmartServerRepositoryTarball._tarball_of_dir?s�����7�7�#�#�E�J�J�/��
�\�\��t�k�/A��
�
�
�n�n�S�%>�%>�%@�A�G��#�#�F�+�+� ��)�)��K�K���(�
�
�
�s
�AB"�"
B0r,N)
rYrZr[r\r]r!r�r�r�r^r,r*r'r�r�s��	�(�%�H�)r*r�c�<�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)�'SmartServerRepositoryInsertStreamLockediRz�Insert a record stream from a RemoteSink into a repository.

This gets bytes pushed to it by the network infrastructure and turns that
into a bytes iterator using a thread. That is then processed by
_byte_stream_to_stream.

New in 1.14.
c�D�URUS9 URX5 g)�1StreamSink.insert_stream for a remote repository.rN�r�do_insert_stream_request�r"r.�
resume_tokens�
lock_tokens    r'r!�=SmartServerRepositoryInsertStreamLocked.do_repository_request\s!�����J��/��%�%�j�@r*c�D�URS5Vs/sHo3(dMURS5PM nnX@lXl[R
"5Ul[R"URS9Ul	URR5 gs snf)Nr?�utf-8)�target)r5rD�tokensr.�queue�Queue�	threading�Thread�_inserter_thread�
insert_thread�start)r"r.r�rr�s     r'r��@SmartServerRepositoryInsertStreamLocked.do_insert_stream_requestasz��5B�5H�5H��5N�X�5N�E�RW�'�%�,�,�w�'�5N��X���$���[�[�]��
�&�-�-�T�5J�5J�K������ � �"��Ys
�
B�Bc�:�URRU5 g�N)r��put)r"�body_stream_chunks  r'�do_chunk�0SmartServerRepositoryInsertStreamLocked.do_chunkis���
�
���(�)r*c��[UR55upURR5R	X!UR
5UlSUlg![a$ [R"5UlSUlgf=f)NTF)r��blocking_byte_streamr.�	_get_sink�
insert_streamr��
insert_result�	insert_ok�
BaseExceptionr��exc_info�insert_exception)r"rEr$s   r'r��8SmartServerRepositoryInsertStreamLocked._inserter_threadlss��	#�!7��8Q�8Q�8S�!T��J�!%���!:�!:�!<�!J�!J��D�K�K�"�D��"�D�N���	#�$'�L�L�N�D�!�"�D�N�	#�s�AA�+B�Bc#�`# �URR5nU[LagUv� M*7fr�)r�r�rIrZs  r'r��<SmartServerRepositoryInsertStreamLocked.blocking_byte_streamws-�����J�J�N�N�$�E��
�%�����s�,.c	��URR[5 URbURR	5 UR
(dURupnUeURupEU(dU(a�[UVs/sHofSRS54USS-PM sn5n[R"UVs/sHowRS5PM snU45nURR5 [SU45$URR5 [S5$!U?f=fs snfs snf)Nrr�rs
missing-basisrk)r�r�rIr�r�r�r�r�r�rC�bencoder.rr)	r"�exc_type�exc_val�exc_tb�write_group_tokens�missing_keys�entryrr[s	         r'�do_end�.SmartServerRepositoryInsertStreamLocked.do_ends!���
�
���}�%����)����#�#�%��~�~�*.�*?�*?�'�X��
*��
�,0�+=�+=�(����"�FR�S�l�U��(�/�/�'�*�,�u�Q�R�y�8�l�S��L��O�O�5G�H�5G�E�,�,�w�'�5G�H�,�W��E�
�O�O�"�"�$�0�2B�E�1J�K�K��O�O�"�"�$�0��:�:���)��T��Is�(D=�$E�E	�=E)r�r�r�r�r�r.r�N)rYrZr[r\r]r!r�r�r�r�r�r^r,r*r'r�r�Rs&���A�
#�*�	#��;r*r�c�"�\rSrSrSrSSjrSrg)�&SmartServerRepositoryInsertStream_1_19i�aInsert a record stream from a RemoteSink into a repository.

Same as SmartServerRepositoryInsertStreamLocked, except:
 - the lock token argument is optional
 - servers that implement this verb accept 'inventory-delta' records in the
   stream.

New in 1.19.
Nc�0�[RXX#5 g�r�N)r�r!r�s    r'r!�<SmartServerRepositoryInsertStream_1_19.do_repository_request�s��/�E�E��m�	
r*r,r�rfr,r*r'r�r��s���
r*r�c��\rSrSrSrSrSrg)�!SmartServerRepositoryInsertStreami�aInsert a record stream from a RemoteSink into an unlocked repository.

This is the same as SmartServerRepositoryInsertStreamLocked, except it
takes no lock_tokens; i.e. it works with an unlocked (or lock-free, e.g.
like pack format) repository.

New in 1.13.
c�F�UR5 URX5 gr�r�)r"r.r�s   r'r!�7SmartServerRepositoryInsertStream.do_repository_request�s�������%�%�j�@r*r,Nrfr,r*r'r�r��s
���Ar*r�c�$�\rSrSrSrSrSrSrg)�%SmartServerRepositoryAddSignatureTexti�z,Add a revision signature text.

New in 2.5.
c�r�X lX0lUVs/sHoURS5PM snUlgs snf)z�Add a revision signature text.

:param repository: Repository to operate on
:param lock_token: Lock token
:param revision_id: Revision for which to add signature
:param write_group_tokens: Write group tokens
r�N)�_lock_token�_revision_idrD�_write_group_tokens)r"r.r�r�r�rs      r'r!�;SmartServerRepositoryAddSignatureText.do_repository_request�s>��&��'��/A�$
�/A�e�L�L��!�/A�$
�� ���$
s�4c��URRURS9 URRUR5 URRURU5 URR5nSSS5 [S[WVs/sHo3RS5PM sn5-5$!URR5nf=f!,(df   Nc=fs snf)z�Add a signature text.

:param body_bytes: GPG signature text
:return: SuccessfulSmartServerResponse with arguments 'ok' and
    the list of new write group tokens.
rNrkr�)r rr�resume_write_groupr�add_signature_textr�suspend_write_grouprr�rC)r"rz�new_write_group_tokensrs    r'r{�-SmartServerRepositoryAddSignatureText.do_body�s����
�
�
(�
(�t�/?�/?�
(�
@����/�/��0H�0H�I�
P�� � �3�3�D�4E�4E�z�R�)-�)9�)9�)M�)M�)O�&�A�-���8N�O�8N�u�\�\�'�*�8N�O�P�
Q�
�	
��*.�)9�)9�)M�)M�)O�&��A�
@��Ps)�&C)�&C
�1C)�#C:�
C&�&C)�)
C7)rrrN�rYrZr[r\r]r!r{r^r,r*r'r�r��s���
�"
r*r�c��\rSrSrSrSrSrg)�$SmartServerRepositoryStartWriteGroupi�z"Start a write group.

New in 2.5.
c��URUS9 UR5 UR5nSSS5 [
SW45$![Ra [S5ssSSS5 $f=f!,(df   NI=f)zStart a write group.r)sUnsuspendableWriteGroupNrl)r�start_write_grouprr�UnsuspendableWriteGrouprr)r"r.r�r�s    r'r!�:SmartServerRepositoryStartWriteGroup.do_repository_request�s��
�
"�
"��
"�
4��(�(�*�
P�#�7�7�9��5�-�e�V�_�=�=���1�1�
P�0�1N�O�O�5�
4�
P��	5�
4�s(�A6�A�A3�'A6�2A3�3A6�6
Br,Nrfr,r*r'rr�s���
>r*rc��\rSrSrSrSrSrg)�%SmartServerRepositoryCommitWriteGroupi�z#Commit a write group.

New in 2.5.
c�&�URUS9 URUVs/sHoDRS5PM sn5 UR5 SSS5 [S5$s snf![Rain[SURVs/sHoDRS5PM Os snfsnURRS545sSnAsSSS5 $SnAff=f! UR5ne=f!,(df   N�=f)zCommit a write group.rr��UnresumableWriteGroupNrk)rrrDr�UnresumableWriteGroupr�write_groupsrC�reason�commit_write_grouprr�r"r.r�r�rr�s      r'r!�;SmartServerRepositoryCommitWriteGroup.do_repository_request�s���
�
"�
"��
"�
4�
��-�-�8J�K�8J�u�\�\�'�*�8J�K��
��-�-�/�5�(-�X�6�6��#L���/�/�
�0�0�<=�N�N�K�N�5���g�.�N��K�������0����
5�
4��

��
�%/�%C�%C�%E�"���'5�
4�sb�D�A,�A'
�A,�C,�'A,�,C)�C$�B/�.'C$�C)�D�$C)�)D�,C?�?D�
Dr,Nrfr,r*r'rr�s���
7r*rc��\rSrSrSrSrSrg)�$SmartServerRepositoryAbortWriteGroupiz"Abort a write group.

New in 2.5.
c���URUS9 URUVs/sHoDRS5PM sn5 SSS5 [S5$s snf![Rain[SURVs/sHoDRS5PM Os snfsnURRS545sSnAsSSS5 $SnAff=f!,(df   N�=f�zAbort a write group.rr�rNrk)rrrDrrrrrCr�abort_write_grouprrs      r'r!�:SmartServerRepositoryAbortWriteGroup.do_repository_requests���
�
"�
"��
"�
4�
/��-�-�8J�K�8J�u�\�\�'�*�8J�K��5�-�X�6�6��L���/�/�
/�0�0�<=�N�N�K�N�5���g�.�N��K�������0����
5�
4��

/��5�
4�sP�C�A�A
�A�A�C�/C�B�'C�C�C�C�C�
C)r,Nrfr,r*r'rrs���
7r*rc��\rSrSrSrSrSrg)�$SmartServerRepositoryCheckWriteGroupi/z6Check that a write group is still valid.

New in 2.5.
c��URUS9 URUVs/sHoDRS5PM sn5 UR5 SSS5 [S5$s snf![R
ain[
SURVs/sHoDRS5PM Os snfsnURRS545sSnAsSSS5 $SnAff=f!,(df   N�=fr)rrrDrrrrrrCrrrs      r'r!�:SmartServerRepositoryCheckWriteGroup.do_repository_request5s���
�
"�
"��
"�
4�

1��-�-�8J�K�8J�u�\�\�'�*�8J�K���.�.�0�5�-�X�6�6��L���/�/�
�0�0�<=�N�N�K�N�5���g�.�N��K�������0����
5�
4��

��5�
4�sV�C+�A+�A&
�A+�C+�&A+�+C(�?C#�B.�-'C#�C(�C+�#C(�(C+�+
C9r,Nrfr,r*r'r"r"/s���
7r*r"c��\rSrSrSrSrSrg)�#SmartServerRepositoryAllRevisionIdsiIz?Retrieve all of the revision ids in a repository.

New in 2.5.
c�X�UR5n[SSRU55$)Nrkr1)r�rr�)r"r.�revidss   r'r!�9SmartServerRepositoryAllRevisionIds.do_repository_requestOs&���,�,�.��,�X�u�z�z�&�7I�J�Jr*r,Nrfr,r*r'r&r&Is
���
Kr*r&c��\rSrSrSrSrSrg)�SmartServerRepositoryReconcileiTz%Reconcile a repository.

New in 2.5.
c�J�URUS9 UR	5nUR5 SUR-SUR-/n[SSRU55$![Ra [S5s$f=f!UR5 f=f)Nr)sTokenLockingNotSupportedsgarbage_inventories: %d
sinconsistent_parents: %d
rkr*)
rr�TokenLockingNotSupportedr�	reconciler�garbage_inventories�inconsistent_parentsrr�)r"r.r��
reconcilerr�s     r'r!�4SmartServerRepositoryReconcile.do_repository_requestZs���	M��!�!�
�!�3�	 �#�-�-�/�J�����(�:�+I�+I�I�)�J�,K�,K�K�
��-�X�s�x�x��~�F�F���.�.�	M�,�-K�L�L�	M��

����s�A+�B�+B
�B
�B"r,Nrfr,r*r'r+r+Ts
���

Gr*r+c�$�\rSrSrSrSrSrSrg)�SmartServerRepositoryPackijz Pack a repository.

New in 2.5.
c�F�XlX lUS:XaSUlgSUlg)Nr�TF)r r�_clean_obsolete_packs)r"r.r��clean_obsolete_packss    r'r!�/SmartServerRepositoryPack.do_repository_requestps0��%��%���7�*�)-�D�&��*/�D�&�r*c��US:XaSnOUR5nURRURS9 URR	X R
5 SSS5 [
S5$!,(df   N=f)N�rrk)�
splitlinesr rrrr6r)r"rz�hints   r'r{�!SmartServerRepositoryPack.do_bodyyst������D��(�(�*�D�
�
�
�
(�
(�t�/?�/?�
(�
@����!�!�$�(B�(B�C�A�,��
�	
�A�
@�s�&A6�6
B)r6rr Nr
r,r*r'r4r4js���
�	
r*r4c�*�\rSrSrSrSrSrSrSrg)�#SmartServerRepositoryIterFilesBytesi�aoIterate over the contents of files.

The client sends a list of desired files to stream, one
per line, and as tuples of file id and revision, separated by
\0.

The server replies with a stream. Each entry is preceded by a header,
which can either be:

* "ok\x00IDX\n" where IDX is the index of the entry in the desired files
    list sent by the client. This header is followed by the contents of
    the file, bzip2-compressed.
* "absent\x00FILEID\x00REVISION\x00IDX" to indicate a text is missing.
    The client can then raise an appropriate RevisionNotPresent error
    or check its fallback repositories.

New in 2.5.
c#�V# �URR5 0n[U5H	upEXCU'M URR	USS5H�nX6R
nURS:Xa&SUR
SUR
SU4-v� MGSU-v� [R"5nURS5H!n	URU	5n
U
(dMU
v� M# UR5n
U
(dM�U
v� M� SSS5 g!,(df   g=f7f)	N�	unorderedTr9sabsent%s%s%d
rrsok%d
r7)r rE�	enumerate�texts�get_record_streamrAr>�zlib�compressobj�
iter_bytes_asr��flush)r"r.�
desired_files�	text_keys�irArI�
identifier�
compressorr[�datas           r'r�/SmartServerRepositoryIterFilesBytes.body_stream�s���
�
�
�
'�
'�
)��I�#�M�2���!"�#��3�$�*�*�<�<��;����'�z�z�2�
��&�&�(�2�1��
�
�1�
��
�
�1�
�"�5����!�J�.�.�!�-�-�/�
�#�1�1�)�<�E�%�.�.�u�5�D��t�"�
�=�"�'�'�)���4��J�)�	*�
)�
)�s)�D)�CD�&D�D�	D)�
D&�"D)c���UR5Vs/sHn[URS55PM nn[SUR	UR
U5S9$s snf)N�rkr)r;r�r5rrr )r"rz�lrIs    r'r{�+SmartServerRepositoryIterFilesBytes.do_body�sY��8B�8M�8M�8O�P�8O�1��q�w�w�u�~�.�8O�
�P�,��$�"2�"2�4�3C�3C�]�"S�
�	
��Qs�$Ac��gr�r,rns  r'r!�9SmartServerRepositoryIterFilesBytes.do_repository_request�s��r*r,N)	rYrZr[r\r]rr{r!r^r,r*r'r?r?�s���&�6
�r*r?c�*�\rSrSrSrSrSrSrSrg)�"SmartServerRepositoryIterRevisionsi�aPStream a list of revisions.

The client sends a list of newline-separated revision ids in the
body of the request and the server replies with the serializer format,
and a stream of bzip2-compressed revision texts (using the specified
serializer format).

Any revisions the server does not have are omitted from the stream.

New in 2.5.
c��Xlgr�rXrns  r'r!�8SmartServerRepositoryIterRevisions.do_repository_request�s��%��r*c��URS5n[SURR54UR	URU5S9$)Nr1rlr)r5rr r�r)r"rzrvs   r'r{�*SmartServerRepositoryIterRevisions.do_body�sL��!�'�'��.��,�
�D�$�$�:�:�<�=��(�(��)9�)9�<�H�
�	
r*c#�Z# �URR5 URRUVs/sHo34PM snSS5H<nURS:XaM[
R"URS55v� M> SSS5 gs snf!,(df   g=f7f)NrATr9r8)r rEr�rDr>rEr�rB)r"r.rvr�rIs     r'r�.SmartServerRepositoryIterRevisions.body_stream�s����
�
�
�
'�
'�
)�$�.�.�@�@�'3�4�|�e��|�4�k�4����&�&�(�2���m�m�F�$7�$7�
�$C�D�D��*�
)��4�*�
)�s.�B+�B�B
�A	B�	B+�B�
B(�$B+rXN)	rYrZr[r\r]r!r{rr^r,r*r'rWrW�s��
��

�Er*rWc�0�\rSrSrSrSrSrSrSrSr	g)	�#SmartServerRepositoryGetInventoriesi�atGet the inventory deltas for a set of revision ids.

This accepts a list of revision ids, and then sends a chain
of deltas for the inventories of those revisions. The first
revision will be empty.

The server writes back zlibbed serialized inventory deltas,
in the ordering specified. The base for each delta is the
inventory generated by the previous delta.

New in 2.5.
c
#�# �[R"S[RS9n[R
"UR
5URR5nUR5 URX25H]upgUcM
URU5nURURURU5n	[URSSU	SS9v� UnM_ SSS5 g!,(df   g=f7f)N)�root_idr�T)�chunks_are_lines)�_mod_inventory�	Inventoryr�r�r�InventoryDeltaSerializer�supports_rich_rootr�supports_tree_referencerE�_iter_inventories�_make_delta�delta_to_linesr�r)
r"r.�orderingr(�prev_invr��inv�_revid�	inv_deltar9s
          r'�_inventory_delta_stream�;SmartServerRepositoryGetInventories._inventory_delta_stream�s����!�+�+��m�&A�&A�
��%�=�=��)�)�+�Z�-?�-?�-W�-W�
�
��
!�
!�
#�)�;�;�F�M����;���O�O�H�5�	�"�1�1��(�(�#�/�/�9���,��O�O�T�4������� N�$�
#�
#�s�A-C<�/A3C+�"	C<�+
C9�5C<c�X�URXU5n[SU4/UR5$)Nzinventory-deltas)rpr)r)r"r.rkr(rHs     r'r�/SmartServerRepositoryGetInventories.body_streams4���0�0��v�N�	�%� �)�
,�-�z�/A�/A�
�	
r*c	�|�[SURURURUR	55S9$)Nrkr)rrr �	_orderingr;)r"rzs  r'r{�+SmartServerRepositoryGetInventories.do_body
s:��,���(�(�� � �$�.�.�*�2G�2G�2I��
�	
r*c�B�URS5nUS:XaSnX lg)Nr@rA�topological)rDru)r"r.rks   r'r!�9SmartServerRepositoryGetInventories.do_repository_requests'���?�?�7�+���{�"�%�H�!��r*)ruN)
rYrZr[r\r]rprr{r!r^r,r*r'r_r_�s����(
�
�r*r_c�&�\rSrSrSrSrSrSrg)�,SmartServerRepositoryGetStreamForMissingKeysic�x�[R"U5Ulg![a [	SSU45s$f=f)z�Get a stream for missing keys.

:param repository: The repository to stream from.
:param to_network_name: The network name of the format of the target
    repository.
s
UnknownFormats
repositoryN)rr�r�KeyErrorrrs   r'r!�BSmartServerRepositoryGetStreamForMissingKeys.do_repository_requestsF��	�5�9�9�/�J�D�O�
��	�	�,�!�=�/�B��
�	�s��9�9c��URnUR5 URUR5n/nUR	S5H8nUR	S5upgURUR
S5U45 M: URU5n[SURX�5S9$![a UR5 e!e=ff=f)Nr1�	r�rkr)r rEr rr5r�rD�get_stream_for_missing_keysr"rrr)	r"rzr.r#�keysr��kindr�r$s	         r'r{�4SmartServerRepositoryGetStreamForMissingKeys.do_body-s����%�%�
�����	��+�+�D�O�O�<�F��D�#�)�)�%�0�� %���E� 2�
�����T�[�[��1�5�9�:�1��7�7��=�F�-��$�"2�"2�6�"F�
�	
��
�	�
��!�!�#�����	�s$�A;B2�2
C�=C�
C�C�Cc#�# �[XR5nUShv�N UR5 gN![Ra3nUR5 [SUR45v� SnAgSnAff=f7fr'r(r+s     r'r�8SmartServerRepositoryGetStreamForMissingKeys.body_streamAr.r/r0N)rYrZr[r\r!r{rr^r,r*r'r{r{s��
�
�(
 r*r{c�*�\rSrSrSSjrSSjrSrg)�$SmartServerRepositoryRevisionArchiveiNNc�*�URU5nUbURS5nUbURS5nURS5n[SURUURS5[R
R
U5UUU5S9$)aJStream an archive file for a specific revision.
:param repository: The repository to stream from.
:param revision_id: Revision for which to export the tree
:param format: Format (tar, tgz, tbz2, etc)
:param name: Target file name
:param root: Name of root directory (or '')
:param subdir: Subdirectory to export, if not the root.
r�rkr)�
revision_treerDrrr�r#r�)	r"r.r�r@r��root�subdir�force_mtime�trees	         r'r!�:SmartServerRepositoryRevisionArchive.do_repository_requestOs����'�'��4�����]�]�7�+�F����;�;�w�'�D��{�{�7�#��,���(�(���
�
�g�&���� � ��&����
�

�
	
r*c�~�UR5 URX#XEU5sSSS5 $!,(df   g=fr�)rE�archive)r"r�r@r�r�r�r�s       r'r�0SmartServerRepositoryRevisionArchive.body_streamls(��
�^�^�
��<�<��d�K�H��
�
�rer,�NN)rYrZr[r\r!rr^r,r*r'r�r�Ns��TX�
�:Ir*r�c� �\rSrSrSSjrSrg)�)SmartServerRepositoryAnnotateFileRevisioniqNc
�
�URU5nUR5 [R"[UR	URS5U555n[
SUS9sSSS5 $!,(df   g=f)a Stream an archive file for a specific revision.

:param repository: The repository to stream from.
:param revision_id: Revision for which to export the tree
:param tree_path: The path inside the tree
:param file_id: Optional file_id for the file
:param default_revision: Default revision
r�rk)r�N)r�rEr�r{�
annotate_iterrDr)r"r.r��	tree_path�file_id�default_revisionr�r�s        r'r!�?SmartServerRepositoryAnnotateFileRevision.do_repository_requestrse���'�'��4��
�^�^�
��?�?��T�'�'�	�(8�(8��(A�CS�T�U��D�1���E�	�
�
�s�AA4�4
Br,r�r�r,r*r'r�r�qs��QU�Fr*r�r�)Nr]r�r�r�r�r�r�r�rE�fastbencoder�r:rrrrrr	r�r.r
rr
rcrrrr&r�
versionedfilerrr�requestrrrrr`rh�
_lsprof_countrqr�r�r�r�r�r�r�r�r�r�rr2r)rLr�r�r�r�r�r�r�r�r�rrrr"r&r+r4r?rWr_r{r�r�r,r*r'�<module>r�s{��">�
��	��
�����D�D�)�E�*�/�/����
��P)�#5�P)�fL�&B�L�7�%A�7��
�xX�(D�xX�v!J�,K�!J�H�,K��8
B�/K�
B�;�$@�;�O�2N�O�*)=�'C�)=�X=�4P�=�(;�$@�;�
;�,H�
;� =�%A�=�*W �%A�W �t�*H���.r*�r*�j7�7�">�7�
;�1M�
;�7�/K�7�4)�#?�4)�nE;�.J�E;�P
�-T�
�$
A�(O�
A� '
�,H�'
�T>�+G�>�"7�,H�7�>7�+G�7�27�+G�7�4K�*F�K�G�%A�G�,
� <�
�67�*F�7�t E�)E� E�F8�*F�8�v. �3O�. �b I�+G� I�FF�0L�Fr*

Youez - 2016 - github.com/yon3zu
LinuXploit