§
    cÌc¦  ã                   ó&  — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	  G d„ d¦  «        Z
 G d„ d	e	j        ¦  «        Z G d
„ de¦  «        Z G d„ d¦  «        Z G d„ de	j        ¦  «        Z e¦   «         Z G d„ de¦  «        Z G d„ de¦  «        ZdS )zForeign branch utilities.é   )ÚBranch)Ú
Repository)ÚRevision)ÚerrorsÚregistryc                   ó8   — e Zd ZU dZdZdZeed<   d„ Zd„ Z	d„ Z
dS )Ú
VcsMappingzNDescribes the mapping between the semantics of Bazaar and a foreign VCS.

    FÚrevid_prefixc                 ó   — || _         dS )z[Create a new VcsMapping.

        :param vcs: VCS that this mapping maps to Bazaar
        N)Úvcs)Úselfr   s     ú0/usr/lib/python3/dist-packages/breezy/foreign.pyÚ__init__zVcsMapping.__init__,   s   € ð
 ˆŒˆˆó    c                 ó*   — t          | j        ¦  «        ‚)zÁParse a bzr revision id and convert it to a foreign revid.

        :param bzr_revid: The bzr revision id (a string).
        :return: A foreign revision id, can be any sort of object.
        ©ÚNotImplementedErrorÚrevision_id_bzr_to_foreign)r   Ú	bzr_revids     r   r   z%VcsMapping.revision_id_bzr_to_foreign3   ó   € õ " $Ô"AÑBÔBÐBr   c                 ó*   — t          | j        ¦  «        ‚)z¶Parse a foreign revision id and convert it to a bzr revid.

        :param foreign_revid: Foreign revision id, can be any sort of object.
        :return: A bzr revision id.
        )r   Úrevision_id_foreign_to_bzr©r   Úforeign_revids     r   r   z%VcsMapping.revision_id_foreign_to_bzr;   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚexperimentalÚroundtrippingÚbytesÚ__annotations__r   r   r   © r   r   r	   r	      sq   € € € € € € ðð ð €Lð €Mð ÐÐÑðð ð ðCð Cð CðCð Cð Cð Cð Cr   r	   c                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚVcsMappingRegistryzzRegistry for Bazaar<->foreign VCS mappings.

    There should be one instance of this registry for every foreign VCS.
    c                 óp   — d|v rt          d¦  «        ‚t          j                             | |||¦  «         dS )zÏRegister a mapping between Bazaar and foreign VCS semantics.

        The factory must be a callable that takes one parameter: the key.
        It must produce an instance of VcsMapping when called.
        ó   :z&mapping name can not contain colon (:)N©Ú
ValueErrorr   ÚRegistryÚregister)r   ÚkeyÚfactoryÚhelps       r   r+   zVcsMappingRegistry.registerJ   s?   € ð �3ˆ;ˆ;ÝÐEÑFÔFÐFÝÔ×"Ò" 4¨¨g°tÑ<Ô<Ð<Ð<Ð<r   c                 ó0   — |                       |¦  «         dS )zySet the 'default' key to be a clone of the supplied key.

        This method must be called once and only once.
        N)Ú_set_default_key)r   r,   s     r   Úset_defaultzVcsMappingRegistry.set_defaultT   s   € ð
 	×Ò˜cÑ"Ô"Ð"Ð"Ð"r   c                 óP   — |                       |                      ¦   «         ¦  «        S )z>Convenience function for obtaining the default mapping to use.)ÚgetÚ_get_default_key©r   s    r   Úget_defaultzVcsMappingRegistry.get_default[   s    € à�xŠx˜×-Ò-Ñ/Ô/Ñ0Ô0Ð0r   c                 ó*   — t          | j        ¦  «        ‚)z-Convert a bzr revision id to a foreign revid.r   ©r   Úrevids     r   r   z-VcsMappingRegistry.revision_id_bzr_to_foreign_   s   € å! $Ô"AÑBÔBÐBr   N)r   r   r   r   r+   r1   r6   r   r#   r   r   r%   r%   D   s_   € € € € € ðð ð
=ð =ð =ð#ð #ð #ð1ð 1ð 1ðCð Cð Cð Cð Cr   r%   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚForeignRevisionzlA Revision from a Foreign repository. Remembers
    information about foreign revision id and mapping.

    c                 óh   •— d|vrd|d<    t          ¦   «         j        |i |¤Ž || _        || _        d S )NÚinventory_sha1r   )Úsuperr   r   Úmapping)r   r   r?   ÚargsÚkwargsÚ	__class__s        €r   r   zForeignRevision.__init__j   sH   ø€ Ø 6Ð)Ð)Ø'*ˆFÐ#Ñ$Ø�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ø*ˆÔØˆŒˆˆr   ©r   r   r   r   r   Ú__classcell__©rB   s   @r   r;   r;   d   sB   ø€ € € € € ðð ð
ð ð ð ð ð ð ð ð r   r;   c                   ó.   — e Zd ZdZdZdZdd„Zd„ Zd„ ZdS )Ú
ForeignVcsz!A foreign version control system.Nc                 ó"   — || _         || _        dS )zÀCreate a new foreign vcs instance.

        :param mapping_registry: Registry with mappings for this VCS.
        :param abbreviation: Optional abbreviation ('bzr', 'svn', 'git', etc)
        N)ÚabbreviationÚmapping_registry)r   rJ   rI   s      r   r   zForeignVcs.__init__y   s   € ð )ˆÔØ 0ˆÔÐÐr   c                 ó   — i S )zºPrepare a foreign revision id for formatting using bzr log.

        :param foreign_revid: Foreign revision id.
        :return: Dictionary mapping string keys to string values.
        r#   r   s     r   Úshow_foreign_revidzForeignVcs.show_foreign_revid‚   s	   € ð ˆ	r   c                 ó*   — t          | j        ¦  «        ‚)zÇSerialize a foreign revision id for this VCS.

        :param foreign_revid: Foreign revision id
        :return: Bytestring with serialized revid, will not contain any
            newlines.
        )r   Úserialize_foreign_revidr   s     r   rN   z"ForeignVcs.serialize_foreign_revidŠ   s   € õ " $Ô">Ñ?Ô?Ð?r   ©N)	r   r   r   r   Úbranch_formatÚrepository_formatr   rL   rN   r#   r   r   rG   rG   r   s\   € € € € € Ø+Ð+à€MàÐð1ð 1ð 1ð 1ðð ð ð@ð @ð @ð @ð @r   rG   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚForeignVcsRegistryz�Registry for Foreign VCSes.

    There should be one entry per foreign VCS. Example entries would be
    "git", "svn", "hg", "darcs", etc.

    c                 óx   — d|v sd|v rt          d¦  «        ‚t          j                             | |||¦  «         dS )zÃRegister a foreign VCS.

        :param key: Prefix of the foreign VCS in revision ids
        :param foreign_vcs: ForeignVCS instance
        :param help: Description of the foreign VCS
        ú:ú-zvcs name can not contain : or -Nr(   )r   r,   Úforeign_vcsr.   s       r   r+   zForeignVcsRegistry.registerœ   sG   € ð �#ˆ:ˆ:˜ ˜˜ÝÐ>Ñ?Ô?Ð?ÝÔ×"Ò" 4¨¨k¸4Ñ@Ô@Ð@Ð@Ð@r   c                 ó<  — d|vsd|vrt          j        |d¦  «        ‚	 |                      |                     d¦  «        d                              d¦  «        ¦  «        }n## t
          $ r t          j        |d¦  «        ‚w xY w|j                             |¦  «        S )z½Parse a bzr revision and return the matching mapping and foreign
        revid.

        :param revid: The bzr revision id
        :return: tuple with foreign revid and vcs mapping
        r'   ó   -Né    Úascii)r   ÚInvalidRevisionIdr3   ÚsplitÚdecodeÚKeyErrorrJ   r   )r   r9   rW   s      r   Úparse_revision_idz$ForeignVcsRegistry.parse_revision_id§   s¨   € ð �uÐÐ ¨EÐ 1Ð 1ÝÔ*¨5°$Ñ7Ô7Ð7ð	8ØŸ(š( 5§;¢;¨tÑ#4Ô#4°QÔ#7×#>Ò#>¸wÑ#GÔ#GÑHÔHˆKˆKøÝð 	8ð 	8ð 	8ÝÔ*¨5°$Ñ7Ô7Ð7ð	8øøøàÔ+×FÒFÀuÑMÔMÐMs   ŸAA! Á! BN)r   r   r   r   r+   r`   r#   r   r   rS   rS   ”   sD   € € € € € ðð ð	Að 	Að 	AðNð Nð Nð Nð Nr   rS   c                   ó8   — e Zd ZU dZeed<   d„ Zd„ Zdd„Zd„ Z	dS )	ÚForeignRepositoryzØA Repository that exists in a foreign version control system.

    The data in this repository can not be represented natively using
    Bazaars internal datastructures, but have to converted using a VcsMapping.
    r   c                 ó*   — t          | j        ¦  «        ‚)zÂCheck whether the specified foreign revision is present.

        :param foreign_revid: A foreign revision id, in the format used
                              by this Repository's VCS.
        )r   Úhas_foreign_revisionr   s     r   rd   z&ForeignRepository.has_foreign_revisionÄ   s   € õ " $Ô";Ñ<Ô<Ð<r   c                 ó*   — t          | j        ¦  «        ‚)z¨Lookup a mapped or roundtripped revision by revision id.

        :param revid: Bazaar revision id
        :return: Tuple with foreign revision id and mapping.
        )r   Úlookup_revision_idr8   s     r   Úlookup_bzr_revision_idz(ForeignRepository.lookup_bzr_revision_idÌ   s   € õ " $Ô"9Ñ:Ô:Ð:r   Nc                 ó*   — t          | j        ¦  «        ‚)z"See Repository.all_revision_ids().)r   Úall_revision_ids)r   r?   s     r   ri   z"ForeignRepository.all_revision_idsÔ   s   € å! $Ô"7Ñ8Ô8Ð8r   c                 ó*   — t          | j        ¦  «        ‚)z,Get the default mapping for this repository.)r   Úget_default_mappingr5   s    r   rk   z%ForeignRepository.get_default_mappingØ   s   € å! $Ô":Ñ;Ô;Ð;r   rO   )
r   r   r   r   rG   r"   rd   rg   ri   rk   r#   r   r   rb   rb   º   sl   € € € € € € ðð ð 
€O€O�Oð=ð =ð =ð;ð ;ð ;ð9ð 9ð 9ð 9ð<ð <ð <ð <ð <r   rb   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚForeignBranchz7Branch that exists in a foreign version control system.c                 óV   •— || _         t          ¦   «                              ¦   «          d S rO   )r?   r>   r   )r   r?   rB   s     €r   r   zForeignBranch.__init__à   s&   ø€ ØˆŒÝ‰Œ×ÒÑÔÐÐÐr   rC   rE   s   @r   rm   rm   Ý   s>   ø€ € € € € ØAÐAðð ð ð ð ð ð ð ð r   rm   N)r   Úbranchr   Ú
repositoryr   Úrevisionr   Ú r   r   r	   r*   r%   r;   rG   rS   Úforeign_vcs_registryrb   rm   r#   r   r   ú<module>rt      sá  ðð"  Ð ðð ð ð ð ð ð #Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð#Cð #Cð #Cð #Cð #Cñ #Cô #Cð #CðLCð Cð Cð Cð C˜Ô*ñ Cô Cð Cð@ð ð ð ð �hñ ô ð ð@ð @ð @ð @ð @ñ @ô @ð @ðD Nð  Nð  Nð  Nð  N˜Ô*ñ  Nô  Nð  NðF *Ð)Ñ+Ô+Ð ð <ð  <ð  <ð  <ð  <˜
ñ  <ô  <ð  <ðFð ð ð ð �Fñ ô ð ð ð r   