§
    cÌcÓ�  ã                   ó  — d Z ddlmZ ddlmZ ddlZddlZddlmZ  e e¦   «         d¦  «         ddlm	Z	m
Z
mZ dd	l	mZmZ dd
l
mZmZmZmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlm Z m!Z!  G d„ de	j"        ¦  «        Z# G d„ de#¦  «        Z$ G d„ de#¦  «        Z% G d„ de#¦  «        Z& G d„ de#¦  «        Z' G d„ de#¦  «        Z( G d„ de#¦  «        Z) G d„ de¦  «        Z* G d „ d!e¦  «        Z+ G d"„ d#e+¦  «        Z,d&d$„Z-d%„ Z.dS )'z-Weave - storage of related text file versionsé    )Úcopy)ÚBytesIONé   )Úlazy_importz
from breezy import tsort
)ÚerrorsÚosutilsÚ	transport)ÚRevisionAlreadyPresentÚRevisionNotPresent)ÚdirnameÚshaÚsha_stringsÚsplit_lines)ÚNULL_REVISION)Úmutteré   )ÚAbsentContentFactoryÚadapter_registryÚContentFactoryÚExistingContentÚsort_groupcompressÚUnavailableRepresentationÚVersionedFile)Ú_read_weave_v5Úwrite_weave_v5c                   ó   — e Zd ZdZdd„ZdS )Ú
WeaveErrorz"Error in processing weave: %(msg)sNc                 óR   — t           j                             | ¦  «         || _        d S ©N)r   ÚBzrErrorÚ__init__Úmsg)Úselfr"   s     ú2/usr/lib/python3/dist-packages/breezy/bzr/weave.pyr!   zWeaveError.__init__h   s#   € ÝŒ× Ò  Ñ&Ô&Ð&ØˆŒˆˆó    r   ©Ú__name__Ú
__module__Ú__qualname__Ú_fmtr!   © r%   r$   r   r   d   s-   € € € € € à/€Dðð ð ð ð ð r%   r   c                   ó   — e Zd ZdZd„ ZdS )ÚWeaveRevisionAlreadyPresentz7Revision {%(revision_id)s} already present in %(weave)sc                 óV   — t                                | ¦  «         || _        || _        d S r   ©r   r!   Úrevision_idÚweave©r#   r0   r1   s      r$   r!   z$WeaveRevisionAlreadyPresent.__init__q   s)   € å×Ò˜DÑ!Ô!Ð!Ø&ˆÔØˆŒ
ˆ
ˆ
r%   Nr&   r+   r%   r$   r-   r-   m   s(   € € € € € àD€Dðð ð ð ð r%   r-   c                   ó   — e Zd ZdZd„ ZdS )ÚWeaveRevisionNotPresentz3Revision {%(revision_id)s} not present in %(weave)sc                 óV   — t                                | ¦  «         || _        || _        d S r   r/   r2   s      r$   r!   z WeaveRevisionNotPresent.__init__|   s)   € Ý×Ò˜DÑ!Ô!Ð!Ø&ˆÔØˆŒ
ˆ
ˆ
r%   Nr&   r+   r%   r$   r4   r4   x   s(   € € € € € à@€Dðð ð ð ð r%   r4   c                   ó   — e Zd ZdZd„ ZdS )ÚWeaveFormatErrorz"Weave invariant violated: %(what)sc                 óH   — t                                | ¦  «         || _        d S r   )r   r!   Úwhat)r#   r9   s     r$   r!   zWeaveFormatError.__init__†   s!   € Ý×Ò˜DÑ!Ô!Ð!ØˆŒ	ˆ	ˆ	r%   Nr&   r+   r%   r$   r7   r7   ‚   s(   € € € € € à/€Dðð ð ð ð r%   r7   c                   ó   — e Zd ZdZdS )ÚWeaveParentMismatchz5Parents are mismatched between two revisions. %(msg)sN©r'   r(   r)   r*   r+   r%   r$   r;   r;   ‹   s   € € € € € àB€D€D€Dr%   r;   c                   ó   — e Zd ZdZdS )ÚWeaveInvalidChecksumz(Text did not match its checksum: %(msg)sNr<   r+   r%   r$   r>   r>   �   s   € € € € € à5€D€D€Dr%   r>   c                   ó   — e Zd ZdZd„ ZdS )ÚWeaveTextDifferszTWeaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)sc                 ód   — t                                | ¦  «         || _        || _        || _        d S r   )r   r!   r0   Úweave_aÚweave_b)r#   r0   rB   rC   s       r$   r!   zWeaveTextDiffers.__init__š   s0   € Ý×Ò˜DÑ!Ô!Ð!Ø&ˆÔØˆŒØˆŒˆˆr%   Nr&   r+   r%   r$   r@   r@   •   s*   € € € € € ð;€Dðð ð ð ð r%   r@   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚWeaveContentFactoryzMContent factory for streaming from weaves.

    :seealso ContentFactory:
    c                 ó  — t          j        | ¦  «         |                     |g¦  «        |         | _        |f| _        |                     |g¦  «        |         }t          d„ |D ¦   «         ¦  «        | _        d| _        || _	        dS )z4Create a WeaveContentFactory for version from weave.c              3   ó   K  — | ]}|fV — Œd S r   r+   ©Ú.0Úparents     r$   ú	<genexpr>z/WeaveContentFactory.__init__.<locals>.<genexpr>­   s$   è è € Ð=Ð=¨6˜f˜YÐ=Ð=Ð=Ð=Ð=Ð=r%   ÚfulltextN)
r   r!   Ú	get_sha1sÚsha1ÚkeyÚget_parent_mapÚtupleÚparentsÚstorage_kindÚ_weave)r#   Úversionr1   rR   s       r$   r!   zWeaveContentFactory.__init__§   s�   € åÔ Ñ%Ô%Ð%Ø—O’O W IÑ.Ô.¨wÔ7ˆŒ	Ø�:ˆŒØ×&Ò&¨ yÑ1Ô1°'Ô:ˆÝÐ=Ð=°WÐ=Ñ=Ô=Ñ=Ô=ˆŒØ&ˆÔØˆŒˆˆr%   c                 óÖ   — |dk    r%| j                              | j        d         ¦  «        S |dv r%| j                              | j        d         ¦  «        S t	          | j        |d¦  «        ‚)NrL   éÿÿÿÿ©ÚchunkedÚlines)rT   Úget_textrO   Ú	get_linesr   ©r#   rS   s     r$   Úget_bytes_asz WeaveContentFactory.get_bytes_as±   se   € Ø˜:Ò%Ð%Ø”;×'Ò'¨¬°¬Ñ5Ô5Ð5ØÐ1Ð1Ð1Ø”;×(Ò(¨¬°"¬Ñ6Ô6Ð6å+¨D¬H°lÀJÑOÔOÐOr%   c                 óš   — |dv r2t          | j                             | j        d         ¦  «        ¦  «        S t	          | j        |d¦  «        ‚)NrX   rW   rL   )ÚiterrT   r\   rO   r   r]   s     r$   Úiter_bytes_asz!WeaveContentFactory.iter_bytes_as¹   sF   € ØÐ/Ð/Ð/Ý˜œ×-Ò-¨d¬h°r¬lÑ;Ô;Ñ<Ô<Ð<å+¨D¬H°lÀJÑOÔOÐOr%   N)r'   r(   r)   Ú__doc__r!   r^   ra   r+   r%   r$   rE   rE   ¡   sS   € € € € € ðð ð
ð ð ðPð Pð PðPð Pð Pð Pð Pr%   rE   c                   ó  ‡ — e Zd ZdZg d¢Z	 	 d*ˆ fd„	Zd„ Zd„ Zd	„ Zd
„ Z	d„ Z
d„ Zd„ Zd„ Zd„ ZeZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd+d„Zd„ Zd,d„Zd„ Zd„ Zd„ Z	 	 d+d„Zd-d„Zd„ Zd „ Zd!„ Z d"„ Z!d#„ Z"d$„ Z#e#Z$d-d%„Z%d&„ Z&d'„ Z'd(„ Z(d)„ Z)ˆ xZ*S ).ÚWeaveaý  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.
    )rT   Ú_parentsÚ_sha1sÚ_namesÚ	_name_mapÚ_weave_nameÚ_matcherÚ_allow_reservedNÚwFc                 ó$  •— t          ¦   «                              ¦   «          g | _        g | _        g | _        g | _        i | _        || _        |€t          j	        | _
        n|| _
        |€d„ }|| _         |¦   «         | _        || _        || _        dS )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                  ó   — d S r   r+   r+   r%   r$   Ú	get_scopez!Weave.__init__.<locals>.get_scope0  s   € Ø�tr%   )Úsuperr!   rT   re   rf   rg   rh   ri   ÚpatiencediffÚPatienceSequenceMatcherrj   Ú
_get_scopeÚ_scopeÚ_access_moderk   )r#   Ú
weave_nameÚaccess_modeÚmatcherro   Úallow_reservedÚ	__class__s         €r$   r!   zWeave.__init__  s�   ø€ õ 	‰Œ×ÒÑÔÐØˆŒØˆŒØˆŒØˆŒØˆŒØ%ˆÔØˆ?Ý(Ô@ˆDŒMˆMà#ˆDŒMØÐðð ð à#ˆŒØ�i‘k”kˆŒØ'ˆÔØ-ˆÔÐÐr%   c                 ó   — d| j         z  S )Nz	Weave(%r))ri   ©r#   s    r$   Ú__repr__zWeave.__repr__7  s   € Ø˜TÔ-Ñ-Ð-r%   c                 ó¤   — |                       ¦   «         | j        k    rt          j        ¦   «         ‚| j        dk    rt          j        | ¦  «        ‚dS )z<Is the versioned file marked as 'finished' ? Raise if it is.rl   N)rs   rt   r   ÚOutSideTransactionru   ÚReadOnlyObjectDirtiedErrorr|   s    r$   Ú_check_write_okzWeave._check_write_ok:  sO   € à�?Š?ÑÔ ¤Ò+Ð+ÝÔ+Ñ-Ô-Ð-ØÔ Ò#Ð#ÝÔ3°DÑ9Ô9Ð9ð $Ð#r%   c                 ó  — t          ¦   «         }| j        dd…         |_        | j        dd…         |_        | j        dd…         |_        | j        dd…         |_        | j                             ¦   «         |_        | j        |_        |S )zcReturn a deep copy of self.

        The copy can be modified without affecting the original weave.N)rd   rT   re   rf   rg   rh   r   ri   ©r#   Úothers     r$   r   z
Weave.copyA  sw   € õ ‘”ˆØ”{ 1 1 1”~ˆŒØœ q q qÔ)ˆŒØ”{ 1 1 1”~ˆŒØ”{ 1 1 1”~ˆŒØœ.×-Ò-Ñ/Ô/ˆŒØ Ô,ˆÔØˆr%   c                 ó�   — t          |t          ¦  «        sdS | j        |j        k    o| j        |j        k    o| j        |j        k    S )NF)Ú
isinstancerd   re   rT   rf   rƒ   s     r$   Ú__eq__zWeave.__eq__N  sL   € Ý˜%¥Ñ'Ô'ð 	Ø�5ØŒ} ¤Ò.ð ,Ø”˜uœ|Ò+ð,à”˜uœ|Ò+ð	,r%   c                 ó.   — |                       |¦  «         S r   )r‡   rƒ   s     r$   Ú__ne__zWeave.__ne__U  s   € Ø—;’;˜uÑ%Ô%Ð%Ð%r%   c                 ó   — | j         |         S r   ©rg   )r#   rU   s     r$   Ú_idx_to_namezWeave._idx_to_nameX  s   € ØŒ{˜7Ô#Ð#r%   c                 óœ   — | j         s|                      |¦  «         	 | j        |         S # t          $ r t	          || j        ¦  «        ‚w xY w)z'Convert symbolic version name to index.)rk   Úcheck_not_reserved_idrh   ÚKeyErrorr   ri   )r#   Únames     r$   Ú_lookupzWeave._lookup[  sa   € àÔ#ð 	-Ø×&Ò& tÑ,Ô,Ð,ð	=Ø”> $Ô'Ð'øÝð 	=ð 	=ð 	=Ý$ T¨4Ô+;Ñ<Ô<Ð<ð	=øøøs	   ž+ « Ac                 ó    — | j         dd…         S )zSee VersionedFile.versions.Nr‹   r|   s    r$   ÚversionszWeave.versionsd  s   € àŒ{˜1˜1˜1Œ~Ðr%   c                 ó   — || j         v S )zSee VersionedFile.has_version.)rh   ©r#   Ú
version_ids     r$   Úhas_versionzWeave.has_versionh  s   € à˜dœnÐ,Ð-r%   c              #   óN  K  — d„ |D ¦   «         }|dk    rt|                       |¦  «        }t                               |¦  «        }|                     t	          |¦  «                             t	          |¦  «        ¦  «        ¦  «         |}nn|dk    rh|                       |¦  «        }t          |¦  «        }|                     t	          |¦  «                             t	          |¦  «        ¦  «        ¦  «         |}|D ]+}|| v rt          || ¦  «        V — Œt          |f¦  «        V — Œ,dS )aN  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.
        c                 ó   — g | ]
}|d          ‘ŒS )rW   r+   )rI   rU   s     r$   ú
<listcomp>z+Weave.get_record_stream.<locals>.<listcomp>{  s   € Ð8Ð8Ð8 G�G˜B”KÐ8Ð8Ð8r%   ÚtopologicalÚgroupcompressN)	rP   ÚtsortÚ	topo_sortÚextendÚsetÚ
differencer   rE   r   )r#   r“   ÚorderingÚinclude_delta_closurerR   Únew_versionsrU   s          r$   Úget_record_streamzWeave.get_record_streamn  s1  è è € ð 9Ð8¨xÐ8Ñ8Ô8ˆØ�}Ò$Ð$Ø×)Ò)¨(Ñ3Ô3ˆGÝ Ÿ?š?¨7Ñ3Ô3ˆLØ×Ò¥ H¡¤× 8Ò 8½¸W¹¼Ñ FÔ FÑGÔGÐGØ#ˆHˆHØ˜Ò(Ð(Ø×)Ò)¨(Ñ3Ô3ˆGÝ-¨gÑ6Ô6ˆLØ×Ò¥ H¡¤× 8Ò 8½¸W¹¼Ñ FÔ FÑGÔGÐGØ#ˆHØð 	7ð 	7ˆGØ˜$ˆˆÝ)¨'°4Ñ8Ô8Ð8Ð8Ð8Ð8å*¨G¨:Ñ6Ô6Ð6Ð6Ð6Ð6ð		7ð 	7r%   c           
      óÞ   — i }|D ]g}|t           k    rd}nR	 t          t          | j        | j        |                      |¦  «                 ¦  «        ¦  «        }n# t          $ r Y Œ^w xY w|||<   Œh|S )z!See VersionedFile.get_parent_map.r+   )r   rQ   ÚmaprŒ   re   r‘   r   )r#   Úversion_idsÚresultr–   rR   s        r$   rP   zWeave.get_parent_mapŒ  sž   € àˆØ%ð 
	)ð 
	)ˆJØ�]Ò*Ð*Ø��ðÝ#Ý˜DÔ-Ø œM¨$¯,ª,°zÑ*BÔ*BÔCñEô EñFô F�G�Gøõ *ð ð ð Ø�Hðøøøà!(ˆF�:ÑÐØˆs   –A AÁ
A$Á#A$c                 ó*   — t          | j        ¦  «        ‚r   )ÚNotImplementedErrorÚget_parents_with_ghostsr•   s     r$   r¬   zWeave.get_parents_with_ghostsœ  s   € Ý! $Ô">Ñ?Ô?Ð?r%   c                 ó&  — i }|D �]
}|j         dk    rt          |j        d         g| ¦  «        ‚d„ |j        D ¦   «         }|j         dv r6|                      |j        d         ||                     d¦  «        ¦  «         Œz|j         df}	 ||         }n4# t          $ r' t          j        |¦  «        } || ¦  «        }|||<   Y nw xY w| 	                    |d¦  «        }	 |                      |j        d         ||¦  «         Œû# t          $ r Y �Œw xY wdS )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   c                 ó   — g | ]
}|d          ‘ŒS )r   r+   rH   s     r$   rš   z.Weave.insert_record_stream.<locals>.<listcomp>¬  s   € Ð>Ð>Ð> V�v˜a”yÐ>Ð>Ð>r%   )rL   rY   rZ   rZ   N)rS   r   rO   rR   Ú	add_linesr^   r�   r   ÚgetÚ	get_bytesr
   )	r#   ÚstreamÚadaptersÚrecordrR   Úadapter_keyÚadapterÚadapter_factoryrZ   s	            r$   Úinsert_record_streamzWeave.insert_record_streamŸ  sh  € ð ˆØð 	ñ 	ˆFàÔ" hÒ.Ð.Ý(¨&¬*°Q¬-¨¸$Ñ?Ô?Ð?à>Ð>¨v¬~Ð>Ñ>Ô>ˆGØÔ"Ð&FÐFÐFØ—’Ø”J˜q”M 7Ø×'Ò'¨Ñ0Ô0ñ2ô 2ð 2ð 2ð %Ô1°7Ð:�ð4Ø& {Ô3�G�GøÝð 4ð 4ð 4Ý&6Ô&:¸;Ñ&GÔ&G�OØ-˜o¨dÑ3Ô3�GØ,3�H˜[Ñ)Ð)Ð)ð4øøøð  ×)Ò)¨&°'Ñ:Ô:�ðØ—N’N 6¤:¨a¤=°'¸5ÑAÔAÐAÐAøÝ-ð ð ð Ø‘Dðøøøð+	ð 	s$   Â	BÂ.CÃCÃ"D Ä 
DÄDc                 óÒ   — |                       |¦  «        }t          | j        |         ¦  «        t          |¦  «        k    s|| j        |         k    rt	          || j        ¦  «        ‚|S )ztCheck that a duplicated add is OK.

        If it is, return the (old) index; otherwise raise an exception.
        )r‘   Úsortedre   rf   r
   ri   )r#   r�   rR   ÚtextrN   Úidxs         r$   Ú_check_repeated_addzWeave._check_repeated_add¿  s_   € ð
 �lŠl˜4Ñ Ô ˆÝ�$”- Ô$Ñ%Ô%­°©¬Ò8Ð8Ø˜4œ; sÔ+Ò+Ð+Ý(¨¨tÔ/?Ñ@Ô@Ð@Øˆ
r%   c	           
      óØ   — |                       ||t          t          | j        |¦  «        ¦  «        |¬¦  «        }	t	          |¦  «        t          t          t          |¦  «        ¦  «        |	fS )zSee VersionedFile.add_lines.)Únostore_sha)Ú_addÚlistr§   r‘   r   ÚsumÚlen)
r#   r–   rR   rZ   Úparent_textsÚleft_matching_blocksrÀ   Ú	random_idÚcheck_contentr½   s
             r$   Ú
_add_lineszWeave._add_linesÊ  s^   € ð �iŠi˜
 E­4µ°D´LÀ'Ñ0JÔ0JÑ+KÔ+KØ$/ð ñ 1ô 1ˆå˜5Ñ!Ô!¥3¥s­3°¡¤Ñ#7Ô#7¸Ð<Ð<r%   c                 óâ  — |                       |¦  «         |                      |¦  «         |st          |¦  «        }||k    rt          ‚|€d|z   }|| j        v r|                      ||||¦  «        S |                      |¦  «         t          | j        ¦  «        }| j         	                    |dd…         ¦  «         | j
         	                    |¦  «         | j         	                    |¦  «         || j        |<   |sT|rP| j         	                    d|f¦  «         | j                             |¦  «         | j         	                    d¦  «         |S t          |¦  «        dk    r(t          |¦  «        d         }|| j
        |         k    r|S |                      |¦  «        }| j        }	g }
g }|                      |¦  «        D ]0\  }}}|
 	                    |¦  «         | 	                    |¦  «         Œ1||k    r|S |
 	                    t          | j        ¦  «        ¦  «         |                      d||¦  «        }d}|                     ¦   «         D ]¡\  }}}}}|dk    rŒ|
|         }|
|         }||k    rH| j                             ||z   d|f¦  «         | j                             ||z   dz   d	|f¦  «         |d
z  }||k    r.||z   }d|fg|||…         z   dgz   | j        ||…<   |d
||z
  z   z  }Œ¢|S )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.
        Ns   sha1:ó   {)ó   }Nr   r   Úequaló   [ó   ]r   )Ú_check_lines_not_unicodeÚ_check_lines_are_linesr   r   rh   r¾   Ú_check_versionsrÄ   re   Úappendrf   rg   rT   rŸ   rÂ   Ú_inclusionsÚ_extractrj   Úget_opcodesÚinsert)r#   r–   rZ   rR   rN   rÀ   Únew_versionÚpvÚ	ancestorsÚlÚbasis_linenoÚbasis_linesÚoriginÚlinenoÚlineÚsÚoffsetÚtagÚi1Úi2Új1Új2Úis                          r$   rÁ   z
Weave._addÒ  s]  € ð$ 	×%Ò% eÑ,Ô,Ð,Ø×#Ò# EÑ*Ô*Ð*Øð 	&Ý˜uÑ%Ô%ˆDØ�;ÒÐÝ!Ð!ØÐØ! D™ˆJØ˜œÐ'Ð'Ø×+Ò+¨J¸ÀÈÑMÔMÐMà×Ò˜WÑ%Ô%Ð%Ý˜$œ-Ñ(Ô(ˆð 	Œ×Ò˜W Q Q QœZÑ(Ô(Ð(ØŒ×Ò˜4Ñ Ô Ð ØŒ×Ò˜:Ñ&Ô&Ð&Ø%0ˆŒ�zÑ"àð 		ð
 ð 1Ø”×"Ò" D¨+Ð#6Ñ7Ô7Ð7Ø”×"Ò" 5Ñ)Ô)Ð)Ø”×"Ò" <Ñ0Ô0Ð0ØÐåˆw‰<Œ<˜1ÒÐÝ�g‘”˜qÔ!ˆBØ�t”{ 2”Ò&Ð&à"Ð"à×$Ò$ WÑ-Ô-ˆ	àŒKˆð ˆØˆØ$(§M¢M°)Ñ$<Ô$<ð 	%ð 	%Ñ ˆF�F˜DØ×Ò Ñ'Ô'Ð'Ø×Ò˜tÑ$Ô$Ð$Ð$ð �KÒÐØÐð 	×Ò�C ¤Ñ,Ô,Ñ-Ô-Ð-ð �MŠM˜$ ¨UÑ3Ô3ˆð
 ˆà#$§=¢=¡?¤?ð 	(ð 	(ÑˆC��R˜˜Rð �gŠ~ˆ~ØØ˜bÔ!ˆBØ˜bÔ!ˆBð �RŠxˆxØ”×"Ò" 2¨¡;°°{Ð0CÑDÔDÐDØ”×"Ò" 2¨¡;°¡?°T¸;Ð4GÑHÔHÐHØ˜!‘�à�RŠxˆxð ˜‘K�Ø&*¨KÐ%8Ð$9Ø$)¨"¨R¨%¤Lñ%1à%1 Nñ%3�”˜A˜a˜CÑ ð ˜!˜r B™w™-Ñ'�øØÐr%   c                 óè   — t          |¦  «        st          ¦   «         S t          |¦  «        }t          t          |¦  «        dd¦  «        D ]&}||v r |                     | j        |         ¦  «         Œ'|S )z0Return set of all ancestors of given version(s).r   rW   )rÄ   r    ÚrangeÚmaxÚupdatere   )r#   r“   rè   Úvs       r$   rÔ   zWeave._inclusionsG  sm   € å�8‰}Œ}ð 	Ý‘5”5ˆLÝ�‰MŒMˆÝ•s˜8‘}”} a¨Ñ,Ô,ð 	+ð 	+ˆAØ�Aˆvˆvà—’˜œ qÔ)Ñ*Ô*Ð*øØˆr%   Tc                 ó’   ‡ — t          |t          ¦  «        r|g}‰                      ˆ fd„|D ¦   «         ¦  «        }ˆ fd„|D ¦   «         S )zSee VersionedFile.get_ancestry.c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r+   ©r‘   ©rI   rí   r#   s     €r$   rš   z&Weave.get_ancestry.<locals>.<listcomp>V  s#   ø€ ÐCÐCÐC°!˜dŸlšl¨1™oœoÐCÐCÐCr%   c                 ó:   •— h | ]}‰                      |¦  «        ’ŒS r+   ©rŒ   rñ   s     €r$   ú	<setcomp>z%Weave.get_ancestry.<locals>.<setcomp>W  s'   ø€ Ð0Ð0Ð0¨�×!Ò! !Ñ$Ô$Ð0Ð0Ð0r%   )r†   ÚbytesrÔ   )r#   r¨   Útopo_sortedrè   s   `   r$   Úget_ancestryzWeave.get_ancestryR  s^   ø€ å�k¥5Ñ)Ô)ð 	(Ø&˜-ˆKØ×ÒÐCÐCÐCÐC°{ÐCÑCÔCÑDÔDˆØ0Ð0Ð0Ð0¨aÐ0Ñ0Ô0Ð0r%   c                 ól   — |D ]0}	 | j         |          Œ# t          $ r t          d|z  ¦  «        ‚w xY wdS )z4Check everything in the sequence of indexes is validzinvalid version number %rN)re   Ú
IndexError)r#   Úindexesrè   s      r$   rÒ   zWeave._check_versionsY  sh   € àð 	Bð 	BˆAðBØ”˜aÔ Ð Ð øÝð Bð Bð BÝ Ð!<¸qÑ!@ÑAÔAÐAðBøøøð	Bð 	Bs   †”1c                 óN   — t          |                     |¦  «        ¦  «        dk    S )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_parentszWeave._compatible_parentsa  s%   € õ �=×+Ò+¨JÑ7Ô7Ñ8Ô8¸AÒ=Ð=r%   c                 ór   ‡ — ‰                       |¦  «        g}ˆ fd„‰                      |¦  «        D ¦   «         S )z~Return a list of (version-id, line) tuples for version_id.

        The index indicates when the line originated in the weave.c                 óF   •— g | ]\  }}}‰                      |¦  «        |f‘ŒS r+   ró   )rI   rÞ   rß   r¼   r#   s       €r$   rš   z"Weave.annotate.<locals>.<listcomp>n  s?   ø€ ð &ð &ð &Ñ6J°f¸fÀd�×"Ò" 6Ñ*Ô*¨DÐ1ð &ð &ð &r%   )r‘   rÕ   )r#   r–   Úinclss   `  r$   ÚannotatezWeave.annotatei  sP   ø€ ð —’˜jÑ)Ô)Ð*ˆð&ð &ð &ð &Ø—’˜eÑ$Ô$ð&ñ &ô &ð 	&r%   c              #   óâ   K  — |€|                       ¦   «         }t          |¦  «        }|                      |¦  «        D ]1\  }}}}||vrŒ|                     d¦  «        s
|dz   |fV — Œ+||fV — Œ2dS )z<See VersionedFile.iter_lines_added_or_present_in_versions().Nó   
)r“   r    Ú_walk_internalÚendswith)r#   r¨   Úpbrß   ÚinsertedÚdeletesrà   s          r$   Ú'iter_lines_added_or_present_in_versionsz-Weave.iter_lines_added_or_present_in_versionsq  sª   è è € ð ÐØŸ-š-™/œ/ˆKÝ˜+Ñ&Ô&ˆØ/3×/BÒ/BØñ0ô 0ð 	%ð 	%Ñ+ˆF�H˜g tà˜{Ð*Ð*ØØ—=’= Ñ'Ô'ð %Ø˜U‘l HÐ,Ð,Ð,Ð,Ð,à˜H�nÐ$Ð$Ð$Ð$ð	%ð 	%r%   c              #   ó@  K  — g }t          ¦   «         }d}| j        D ]Ù}|j        t          k    r§|\  }}|dk    r!|                     | j        |         ¦  «         n–|dk    r|                     ¦   «          n{|dk    r!|                     | j        |         ¦  «         nT|dk    r!|                     | j        |         ¦  «         n-t          d|z  ¦  «        ‚||d         t          |¦  «        |fV — |dz  }ŒÚ|rt          d	|z  ¦  «        ‚|rt          d
|z  ¦  «        ‚dS )z Helper method for weave actions.r   rË   rÌ   rÎ   rÏ   zunexpected instruction %rrW   r   ú-unclosed insertion blocks at end of weave: %sú,unclosed deletion blocks at end of weave: %sN)r    rT   rz   rQ   rÓ   rg   ÚpopÚaddÚremover7   Ú	frozenset)r#   r¨   ÚistackÚdsetrß   rÛ   Úcrí   s           r$   r  zWeave._walk_internal€  sb  è è € ð ˆÝ‰uŒuˆàˆà”ð 	ð 	ˆAØŒ{�eÒ#Ð#Ø‘��1Ø˜’9�9Ø—M’M $¤+¨a¤.Ñ1Ô1Ð1Ð1Ø˜$’Y�YØ—J’J‘L”L�L�LØ˜$’Y�YØ—H’H˜Tœ[¨œ^Ñ,Ô,Ð,Ð,Ø˜$’Y�YØ—K’K ¤¨A¤Ñ/Ô/Ð/Ð/å*Ð+FÈÑ+JÑKÔKÐKà˜f Rœj­)°D©/¬/¸1Ð<Ð<Ð<Ð<Ø�a‰KˆFˆFàð 	CÝ"ð $9Ø;Añ$Bñ Cô Cð Càð 	GÝ"Ø>ÀÑEñGô Gð Gð	Gð 	Gr%   c              #   óÂ  K  — |                       |g¦  «        }|                       |g¦  «        }||z  }|                      ||g¦  «        D ]“\  }}}}	||z  rd|	fV — Œ||v rHt          ||z  ¦  «        }
t          ||z  ¦  «        }|
r	|rd|	fV — ŒF|
rd|	fV — ŒO|rd|	fV — ŒXd|	fV — Œ_||v r||z  rd|	fV — Œod|	fV — Œv||v r||z  rd|	fV — Œ†d	|	fV — Œ�d
|	fV — Œ”dS )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.
        zkilled-basezkilled-bothzkilled-azkilled-bÚ	unchangedzghost-aznew-azghost-bznew-bÚ
irrelevantN)r÷   r  Úbool)r#   Úver_aÚver_bÚinc_aÚinc_bÚinc_crß   r×   Ú	deletesetrà   Úkilled_aÚkilled_bs               r$   Ú
plan_mergezWeave.plan_merge   sÃ  è è € ð ×!Ò! 5 'Ñ*Ô*ˆØ×!Ò! 5 'Ñ*Ô*ˆØ˜‘ˆà/3×/BÒ/BØ˜�ñ0 ô 0 ð 	)ð 	)Ñ+ˆF�F˜I tà˜5Ñ ð )ð $ TÐ)Ð)Ð)Ð)Ð)Ø˜5��å 	¨EÑ 1Ñ2Ô2�Ý 	¨EÑ 1Ñ2Ô2�Øð , ð ,Ø'¨Ð-Ð-Ð-Ð-Ð-Øð ,Ø$ dÐ*Ð*Ð*Ð*Ð*Øð ,Ø$ dÐ*Ð*Ð*Ð*Ð*à% tÐ+Ð+Ð+Ð+Ð+Ø˜5��Ø˜uÑ$ð (Ø# T˜/Ð)Ð)Ð)Ð)ð " 4˜-Ð'Ð'Ð'Ð'Ø˜5��Ø˜uÑ$ð (Ø# T˜/Ð)Ð)Ð)Ð)à! 4˜-Ð'Ð'Ð'Ð'ð # DÐ(Ð(Ð(Ð(Ð(ð?	)ð 	)r%   c                 ó"  — |D ]&}t          |t          ¦  «        st          |¦  «        ‚Œ'|                      |¦  «        }g }t	          ¦   «         }t	          ¦   «         }d}d}g }	| j        D ]ü}
|
j        t          k    r´|
\  }}d}|dk    r+|                     |¦  «         | 	                    |¦  «         n­|dk    r(| 
                    |                     ¦   «         ¦  «         n|dk    r||v r| 	                    |¦  «         n_|dk    r||v r| 
                    |¦  «         n?t          ¦   «         ‚|€| o|o	|d         |v }|r|	                     |d         ||
f¦  «         |dz  }Œý|rt          d	|z  ¦  «        ‚|rt          d
|z  ¦  «        ‚|	S )a+  Yield 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.
        r   NrË   rÌ   rÎ   rÏ   rW   r   r  r  )r†   ÚintÚ
ValueErrorrÔ   r    rT   rz   rQ   rÓ   r  r  r  ÚAssertionErrorr7   )r#   r“   rè   Úincludedr  Úisetr  rß   Úisactiver©   rÛ   r  rí   s                r$   rÕ   zWeave._extractÍ  sð  € ð ð 	$ð 	$ˆAÝ˜a¥Ñ%Ô%ð $Ý  ‘m”mÐ#ð$ð ×#Ò# HÑ-Ô-ˆàˆÝ‰uŒuˆÝ‰uŒuˆàˆàˆàˆð4 ”ð 	ð 	ˆAØŒ{�eÒ#Ð#Ø‘��1Ø�Ø˜’9�9Ø—M’M !Ñ$Ô$Ð$Ø—H’H˜Q‘K”K�K�KØ˜$’Y�YØ—K’K §
¢
¡¤Ñ-Ô-Ð-Ð-Ø˜$’Y�YØ˜H�}�}ØŸš ™œ˜øØ˜$’Y�YØ˜H�}�}ØŸš A™œ˜øå(Ñ*Ô*Ð*àÐ#Ø$( ð  0¨fð  0Ø˜rœ
 hÐ.ð àð ;Ø—M’M 6¨"¤:¨v°qÐ"9Ñ:Ô:Ð:Ø�a‰KˆFˆFØð 	CÝ"ð $9Ø;Añ$Bñ Cô Cð Càð 	GÝ"Ø>ÀÑEñGô Gð Gàˆr%   c                 óZ   — t          |t          ¦  «        r|S |                      |¦  «        S )zgConvert possible symbolic name to index, or pass through indexes.

        NOT FOR PUBLIC USE.
        )r†   r#  r‘   )r#   Úname_or_indexs     r$   Ú_maybe_lookupzWeave._maybe_lookup  s.   € õ �m¥SÑ)Ô)ð 	/Ø Ð à—<’< Ñ.Ô.Ð.r%   c           
      óô   — |                       |¦  «        }d„ |                      |g¦  «        D ¦   «         }| j        |         }t          |¦  «        }||k    r t	          d| j        ›d|›d|›d|›�¦  «        ‚|S )zSee VersionedFile.get_lines().c                 ó   — g | ]\  }}}|‘Œ	S r+   r+   )rI   rÞ   rß   rà   s       r$   rš   z#Weave.get_lines.<locals>.<listcomp>-  s+   € ð 1ð 1ð 1Ñ1˜F F¨D�$ð 1ð 1ð 1r%   zfile z, revision z, expected: z, measured )r+  rÕ   rf   r   r>   ri   )r#   r–   Ú	int_indexr©   Úexpected_sha1Úmeasured_sha1s         r$   r\   zWeave.get_lines*  s£   € à×&Ò& zÑ2Ô2ˆ	ð1ð 1Ø—]’] I ;Ñ/Ô/ð1ñ 1ô 1ˆàœ IÔ.ˆÝ# FÑ+Ô+ˆØ˜MÒ)Ð)Ý&Ð&àÔ#Ð#Ð# Z Z ZØ �=�= - -ð1ñ2ô 2ð 2ð ˆr%   c                 óZ   — i }|D ]%}| j         |                      |¦  «                 ||<   Œ&|S )zSee VersionedFile.get_sha1s().)rf   r‘   )r#   r¨   r©   rí   s       r$   rM   zWeave.get_sha1s8  s7   € àˆØð 	5ð 	5ˆAØœ D§L¢L°¡O¤OÔ4ˆF�1‰IˆIØˆr%   c                 ó*   — t          | j        ¦  «        S )z$How many versions are in this weave?)rÄ   re   r|   s    r$   Únum_versionszWeave.num_versions?  s   € å�4”=Ñ!Ô!Ð!r%   c           	      óX  — t          |                      ¦   «         ¦  «        D ]X}t          | j        |         ¦  «        }|r:|                     ¦   «          |d         |k    rt          d|d         |fz  ¦  «        ‚ŒY|                      ¦   «         }i }i }i }t          |¦  «        D ]´}|                      |¦  «        }t          ¦   «         ||<   g ||<   |h}	| j        |         D ]0}
|	                     ||                      |
¦  «                 ¦  «         Œ1|	|  	                    |¦  «        k    r(t          d|	›d|  	                    |¦  «        ›�¦  «        ‚|	||<   Œµt          | j        ¦  «        }d}| j        rCt          j                             | j        ¦  «        }d                     |¦  «        }|d d…         }|                      ¦   «         D ]^\  }}}}|r|                     |||¦  «         |                     ¦   «         D ])\  }}||v r ||z  s||                              |¦  «         Œ*Œ_t          |¦  «        D ]n}|                      |¦  «        }||                              ¦   «                              ¦   «         }| j        |         }||k    rt/          d|›d	|›d
|›�¦  «        ‚Œod S )NrW   z(invalid included version %d for index %dzfailed z != zchecking weavezchecking {}é   zmismatched sha1 for version z: got z, expected )rê   r3  rÂ   re   Úsortr7   rŒ   r   rì   r÷   r%  rÄ   rT   ri   ÚosÚpathÚbasenameÚformatr  ÚitemsÚ	hexdigestÚencoderf   r>   )r#   Úprogress_barrU   Ú
inclusionsÚnvÚsha1sÚtextsrè   r�   Únew_incÚpÚnlinesÚupdate_textÚ
short_namerß   r×   r  rà   Úname_inclusionsÚhdÚexpecteds                        r$   ÚcheckzWeave.checkE  s  € õ ˜T×.Ò.Ñ0Ô0Ñ1Ô1ð 	5ð 	5ˆGÝ˜dœm¨GÔ4Ñ5Ô5ˆJØð 5Ø—’Ñ!Ô!Ð!Ø˜b”> WÒ,Ð,Ý*ØBØ% bœ>¨7Ð3ñ4ñ5ô 5ð 5øð
 ×ÒÑ Ô ˆØˆØˆØˆ
Ý�r‘”ð 	'ð 	'ˆAð ×$Ò$ QÑ'Ô'ˆDÝ™%œ%ˆE�$‰KØˆE�$‰KØ�fˆGØ”] 1Ô%ð Að A�Ø—’˜z¨$×*;Ò*;¸AÑ*>Ô*>Ô?Ñ@Ô@Ð@Ð@à˜$×+Ò+¨DÑ1Ô1Ò1Ð1Ý$�nà�w�w × 1Ò 1°$Ñ 7Ô 7Ð 7ð9ñ:ô :ð :ð  'ˆJ�tÑÐå�T”[Ñ!Ô!ˆà&ˆØÔð 	+Ýœ×)Ò)¨$Ô*:Ñ;Ô;ˆJØ'×.Ò.¨zÑ:Ô:ˆKØ% c r cÔ*ˆKà/3×/BÒ/BÑ/DÔ/Dð 
	-ð 
	-Ñ+ˆF�F˜I tØð AØ×#Ò# K°¸Ñ@Ô@Ð@à)3×)9Ò)9Ñ);Ô);ð -ð -Ñ%��oð ˜Ð.Ð.Ø&¨Ñ8ð /à˜$”K×&Ò& tÑ,Ô,Ð,øð-õ �r‘”ð 	/ð 	/ˆAØ×'Ò'¨Ñ*Ô*ˆGØ�w”×)Ò)Ñ+Ô+×2Ò2Ñ4Ô4ˆBØ”{ 1”~ˆHØ�XŠ~ˆ~Ý*Ð*ð �w�w    H Hð.ñ/ô /ð /ð ð		/ð 	/r%   c           	      óÜ   — g }|j         |         D ][}|j        |         }|| j        vr#t          d|›d|j        |         ›d| ›�¦  «        ‚|                     | j        |         ¦  «         Œ\|S )zAReturn list of parents in self corresponding to indexes in other.zmissing parent {z} of {z} in )re   rg   rh   r   rÓ   )r#   r„   Ú	other_idxÚnew_parentsÚ
parent_idxÚparent_names         r$   Ú_imported_parentszWeave._imported_parents‰  s‘   € àˆØœ.¨Ô3ð 	<ð 	<ˆJØœ, zÔ2ˆKØ $¤.Ð0Ð0å �jØ$/ K K°´ÀÔ1KÐ1KÐ1KÈTÈTð"Sñ Tô Tð Tà×Ò˜tœ~¨kÔ:Ñ;Ô;Ð;Ð;ØÐr%   c                 ór  ‡ ‡— ‰ j                              |d¦  «        }|dk    r“‰ j        |         ‰j        |         k    rt          |‰ ‰¦  «        ‚‰ j        |         }‰j        |         }ˆ fd„|D ¦   «         }ˆfd„|D ¦   «         }‰                      ||¦  «        st          d|›d|›d|›�¦  «        ‚dS dS )	aM  Check 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.rW   c                 ó*   •— h | ]}‰j         |         ’ŒS r+   r‹   )rI   rè   r#   s     €r$   rô   z2Weave._check_version_consistent.<locals>.<setcomp>§  s   ø€ Ð7Ð7Ð7 Q�$”+˜a”.Ð7Ð7Ð7r%   c                 ó*   •— h | ]}‰j         |         ’ŒS r+   r‹   )rI   rè   r„   s     €r$   rô   z2Weave._check_version_consistent.<locals>.<setcomp>¨  s   ø€ Ð9Ð9Ð9 a�%”,˜q”/Ð9Ð9Ð9r%   z"inconsistent parents for version {z}: z vs TF)rh   r±   rf   r@   re   rþ   r;   )	r#   r„   rM  r�   Úthis_idxÚself_parentsrý   Ún1Ún2s	   ``       r$   Ú_check_version_consistentzWeave._check_version_consistent•  sî   øø€ ð ”>×%Ò% d¨BÑ/Ô/ˆØ�rŠ>ˆ>ØŒ{˜8Ô$¨¬°YÔ(?Ò?Ð?Ý& t¨T°5Ñ9Ô9Ð9Øœ=¨Ô2ˆLØ!œN¨9Ô5ˆMØ7Ð7Ð7Ð7¨,Ð7Ñ7Ô7ˆBØ9Ð9Ð9Ð9¨=Ð9Ñ9Ô9ˆBØ×+Ò+¨B°Ñ3Ô3ð Ý)Ð)à48°D°D¸"¸"¸"¸b¸bðBñCô Cð Cð �tà�5r%   c                 óV   — t          | |||¬¦  «        }|                      |¦  «         dS )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[  zWeave._reweave²  s4   € õ ˜T 5¨R°SÐ9Ñ9Ô9ˆ	Ø× Ò  Ñ+Ô+Ð+Ð+Ð+r%   c                 ó~   — | j         D ]4}|dk    r,t          | |t          t          ||¦  «        ¦  «        ¦  «         Œ5dS )z#adsorb the content from otherweave.ri   N)Ú	__slots__Úsetattrr   Úgetattr)r#   Ú
otherweaveÚattrs      r$   r\  zWeave._copy_weave_content¼  sQ   € à”Nð 	Eð 	EˆDØ�}Ò$Ð$Ý˜˜d¥D­°¸TÑ)BÔ)BÑ$CÔ$CÑDÔDÐDøð	Eð 	Er%   )Nrl   NNF©NN)Tr   )+r'   r(   r)   rb   r_  r!   r}   r�   r   r‡   r‰   rŒ   r‘   r“   r—   Ú__contains__r¥   rP   r¬   r¹   r¾   rÉ   rÁ   rÔ   r÷   rÒ   rþ   r  r
  r  r!  rÕ   r+  r\   rM   r3  Ú__len__rK  rQ  rY  r[  r\  Ú__classcell__©rz   s   @r$   rd   rd   À   s²  ø€ € € € € ðVð Vðp?ð ?ð ?€Ið BFØ05ð.ð .ð .ð .ð .ð .ð6.ð .ð .ð:ð :ð :ðð ð ð,ð ,ð ,ð&ð &ð &ð$ð $ð $ð=ð =ð =ðð ð ð.ð .ð .ð €Lð7ð 7ð 7ð<ð ð ð @ð @ð @ðð ð ð@	ð 	ð 	ð=ð =ð =ðsð sð sð sðj	ð 	ð 	ð1ð 1ð 1ð 1ðBð Bð Bð>ð >ð >ð&ð &ð &ð CGØ37ð%ð %ð %ð %ðGð Gð Gð Gð@+)ð +)ð +)ðZOð Oð Oðb
/ð 
/ð 
/ðð ð ðð ð ð"ð "ð "ð €Gð>/ð >/ð >/ð >/ðH
ð 
ð 
ðð ð ð:,ð ,ð ,ðEð Eð Eð Eð Eð Eð Er%   rd   c                   ób   ‡ — e Zd ZdZdZ	 	 dˆ fd„	Zˆ fd„Zd„ Zd	„ Ze	d
„ ¦   «         Z
ˆ fd„Zˆ xZS )Ú	WeaveFilez<A WeaveFile represents a Weave on disk and writes on change.z.weaveNFrl   c                 ó¨  •— t          ¦   «                              |||d¬¦  «         || _        || _        	 | j                             |t
          j        z   ¦  «        5 }t          t          | 	                    ¦   «         ¦  «        | ¦  «         ddd¦  «         dS # 1 swxY w Y   dS # t          j        $ r |s‚ |                      ¦   «          Y dS w xY w)z]Create a WeaveFile.

        :param create: If not True, only open an existing knit.
        F)ro   ry   N)rp   r!   Ú
_transportÚ	_filemoder±   rj  ÚWEAVE_SUFFIXr   r   ÚreadÚ_mod_transportÚ
NoSuchFileÚ_save)	r#   r�   r	   ÚfilemodeÚcreaterw   ro   Úfrz   s	           €r$   r!   zWeaveFile.__init__È  s  ø€ õ 	‰Œ×Ò˜˜{°iØ7<ð 	ñ 	>ô 	>ð 	>à#ˆŒØ!ˆŒð	Ø”×$Ò$ T­IÔ,BÑ%BÑCÔCð 8ÀqÝ�w q§v¢v¡x¤xÑ0Ô0°$Ñ7Ô7Ð7ð8ð 8ð 8ñ 8ô 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8øøøð 8ð 8ð 8ð 8ð 8ð 8øåÔ(ð 	ð 	ð 	Øð Øà�JŠJ‰LŒLˆLˆLˆLˆLð		øøøs5   ¶'B' Á0BÂB' ÂBÂB' Â!BÂ"B' Â'&CÃCc	           
      óª   •— |                       |¦  «         t          ¦   «                              ||||||||¦  «        }	|                      ¦   «          |	S )z!Add a version and save the weave.)rŽ   rp   rÉ   rr  )r#   r–   rR   rZ   rÅ   rÆ   rÀ   rÇ   rÈ   r©   rz   s             €r$   rÉ   zWeaveFile._add_linesÛ  sY   ø€ ð 	×"Ò" :Ñ.Ô.Ð.Ý‘”×#Ò#Ø˜ ¨Ð6JØ˜ Mñ3ô 3ˆð 	�
Š
‰ŒˆØˆr%   c                 ó¾   — t          ¦   «         }t          | |¦  «         |                     d¦  «         |                     |t          j        z   || j        ¦  «         dS )zSee VersionedFile.copy_to().r   N)r   r   ÚseekÚput_filerj  rn  rm  )r#   r�   r	   Úsios       r$   Úcopy_tozWeaveFile.copy_toæ  sT   € õ ‰iŒiˆÝ�t˜SÑ!Ô!Ð!Ø�Š�‰ŒˆØ×Ò˜4¥)Ô"8Ñ8¸#¸t¼~ÑNÔNÐNÐNÐNr%   c                 óä  — |                       ¦   «          t          ¦   «         }t          | |¦  «         |                     d¦  «         |                     ¦   «         }| j        t          j        z   }	 | j         	                    ||| j
        ¦  «         dS # t          j        $ rL | j                             t          |¦  «        ¦  «         | j         	                    ||| j
        ¦  «         Y dS w xY w)zSave the weave.r   N)r�   r   r   rx  Úgetvalueri   rj  rn  rl  Ú	put_bytesrm  rp  rq  Úmkdirr   )r#   rz  rõ   r8  s       r$   rr  zWeaveFile._saveî  sä   € à×ÒÑÔÐÝ‰iŒiˆÝ�t˜SÑ!Ô!Ð!Ø�Š�‰ŒˆØ—’‘”ˆØÔ¥)Ô"8Ñ8ˆð	CØŒO×%Ò% d¨E°4´>ÑBÔBÐBÐBÐBøÝÔ(ð 	Cð 	Cð 	CØŒO×!Ò!¥'¨$¡-¤-Ñ0Ô0Ð0ØŒO×%Ò% d¨E°4´>ÑBÔBÐBÐBÐBÐBð	Cøøøs   Á1!B ÂAC/Ã.C/c                  ó   — t           j        gS )z!See VersionedFile.get_suffixes().)rj  rn  r+   r%   r$   Úget_suffixeszWeaveFile.get_suffixesü  s   € õ Ô&Ð'Ð'r%   c                 ór   •— t          ¦   «                              |¦  «         |                      ¦   «          d S r   )rp   r¹   rr  )r#   r³   rz   s     €r$   r¹   zWeaveFile.insert_record_stream  s,   ø€ Ý‰Œ×$Ò$ VÑ,Ô,Ð,Ø�
Š
‰Œˆˆˆr%   )NFrl   N)r'   r(   r)   rb   rn  r!   rÉ   r{  rr  Ústaticmethodr�  r¹   rg  rh  s   @r$   rj  rj  Ã  s¿   ø€ € € € € ØFÐFà€Là>CØ,0ðð ð ð ð ð ð&	ð 	ð 	ð 	ð 	ðOð Oð OðCð Cð Cð ð(ð (ñ „\ð(ðð ð ð ð ð ð ð ð r%   rj  c           	      óˆ  ‡— t          ¦   «         Št          | |¦  «        }t          d|¦  «         t                               |                     ¦   «         ¦  «        }t          d|¦  «         |r|sd}t          |¦  «        D �]?\  }}|r$|                     ||t          |¦  «        ¦  «         || j	        v rÌ|  
                    |¦  «        }||j	        v r­| 
                    |¦  «        }	||	k    r’t          d|¦  «         t          d| j        |j        ¦  «         ddl}
t          |
                     ||	| j        |j        ¦  «        ¦  «        }t          dd	                     |¦  «        ¦  «         t!          || |¦  «        ‚n| 
                    |¦  «        }‰                     ||ˆfd
„||         D ¦   «         ¦  «         �ŒA‰S )aB  Combine 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
    zcombined parents: %rzorder to reweave: %rÚreweavez%Weaves differ on content. rev_id {%s}zweaves: %s, %sr   Nz	lines:
%sÚ c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r+   rð   )rI   rè   Úwrs     €r$   rš   z_reweave.<locals>.<listcomp>1  s#   ø€ ÐLÐLÐL°˜bŸjšj¨™mœmÐLÐLÐLr%   )rd   Ú_reweave_parent_graphsr   r�   rž   r;  Ú	enumeraterì   rÄ   rh   r\   ri   ÚdifflibrÂ   Úunified_diffÚjoinr@   rÁ   )ÚwaÚwbr  r"   Úcombined_parentsÚorderr½   r�   rZ   Úlines_br‹  rˆ  s              @r$   r[  r[    s×  ø€ õ 
‰Œ€Bõ .¨b°"Ñ5Ô5ÐÝ
Ð!Ð#3Ñ4Ô4Ð4Ý�OŠOÐ,×2Ò2Ñ4Ô4Ñ5Ô5€EÝ
Ð! 5Ñ)Ô)Ð)à	ð �#ð Øˆå˜uÑ%Ô%ð Nñ N‰	ˆˆTØð 	,Ø�IŠI�c˜3¥ E¡
¤
Ñ+Ô+Ð+Ø�2”<ÐÐØ—L’L Ñ&Ô&ˆEØ�r”|Ð#Ð#ØŸ,š, tÑ,Ô,�Ø˜GÒ#Ð#ÝÐBÀDÑIÔIÐIÝÐ+¨R¬^¸R¼^ÑLÔLÐLØ"�N�N�NÝ  ×!5Ò!5°e¸WØ68´nÀbÄnñ"Vô "Vñ Wô W�Eå˜<¨¯ª°©¬Ñ8Ô8Ð8Ý*¨4°°RÑ8Ô8Ð8øà—L’L Ñ&Ô&ˆEØ
�Š��eÐLÐLÐLÐLÐ5EÀdÔ5KÐLÑLÔLÑMÔMÐMÑMØ€Ir%   c           	      óö   — i }| |fD ]q}t          |j        ¦  «        D ]Z\  }}|                     |t          ¦   «         ¦  «        }|                     t          |j        |j        |         ¦  «        ¦  «         Œ[Œr|S )zlReturn combined parent ancestry for two weaves.

    Returned as a list of (version_name, set(parent_names)))rŠ  rg   Ú
setdefaultr    rì   r§   rŒ   re   )rŽ  r�  Úcombinedr1   r½   r�   rD  s          r$   r‰  r‰  5  sŒ   € ð €HØ�b�ð Cð CˆÝ" 5¤<Ñ0Ô0ð 	Cð 	C‰IˆC�Ø×#Ò# D­#©%¬%Ñ0Ô0ˆAØ�HŠH•S˜Ô+¨U¬^¸CÔ-@ÑAÔAÑBÔBÐBÐBð	Cð €Or%   rd  )/rb   r   Úior   r7  rq   r   Úglobalsr†  r   r   r	   rp  r
   r   r   r   r   r   Úrevisionr   Útracer   Úversionedfiler   r   r   r   r   r   r   Ú	weavefiler   r   r    r   r-   r4   r7   r;   r>   r@   rE   rd   rj  r[  r‰  r+   r%   r$   ú<module>rœ     s’  ðð& 4Ð 3ð` Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð à %Ð %Ð %Ð %Ð %Ð %Ø €ˆGˆG‰IŒIð ñ ô ð ðð ð ð ð ð ð ð ð ð ð
ð ð ð ð ð ð ð ð =Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 6Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð ð �”ñ ô ð ðð ð ð ð  *ñ ô ð ðð ð ð ð ˜jñ ô ð ðð ð ð ð �zñ ô ð ðCð Cð Cð Cð C˜*ñ Cô Cð Cð
6ð 6ð 6ð 6ð 6˜:ñ 6ô 6ð 6ð
	ð 	ð 	ð 	ð 	�zñ 	ô 	ð 	ðPð Pð Pð Pð P˜.ñ Pô Pð Pð>@Eð @Eð @Eð @Eð @EˆMñ @Eô @Eð @EðF@ð @ð @ð @ð @�ñ @ô @ð @ðF,ð ,ð ,ð ,ð^	ð 	ð 	ð 	ð 	r%   