§
    cÌcÑ  ã                   óJ   — d Z ddlZddlmZ d„ Zd„ Zdd„Zd	„ Zd
„ Zd„ Z	d„ Z
dS )zMiscellaneous useful stuff.é    Né   )Ú
controldirc                 óD   — ddl }|                     dd„ | ¦  «        \  } }| S )z,Replace xml-incompatible control characters.r   Nu   [^	
 -íŸ¿î€€-ï¿½]+c                 óR   — |                       d¦  «                             d¦  «        S )Nr   Úunicode_escape)ÚgroupÚencode)Úmatchs    úC/usr/lib/python3/dist-packages/breezy/plugins/fastimport/helpers.pyú<lambda>z'escape_commit_message.<locals>.<lambda>%   s   € �e—k’k !‘n”n×+Ò+Ð,<Ñ=Ô=€ ó    )ÚreÚsubn)Úmessager   Ú_s      r   Úescape_commit_messager      s7   € ð €I€I€IØ—’Ø4Ø=Ð=Øñô �J€GˆQð €Nr   c                 ó´  — | j         }g }t          t          j                             ¦   «         ¦  «        }|                     t          j                             ¦   «         ¦  «         |D ]S}t          j                             |¦  «        }t          |d¦  «        r"|j	        |k    r| 
                    ||f¦  «         ŒTt          |¦  «        r|d         \  }}|S dS )aÅ  Find the high-level format for branches and trees given a repository.

    When creating branches and working trees within a repository, Bazaar
    defaults to using the default format which may not be the best choice.
    This routine does a reverse lookup of the high-level format registry
    to find the high-level format that a shared repository was most likely
    created via.

    :return: the BzrDirFormat or None if no matches were found.
    Úrepository_formatr   N)Ú_formatÚsetr   Úformat_registryÚkeysÚdifference_updateÚaliasesÚmake_controldirÚhasattrr   ÚappendÚlen)ÚrepoÚrepo_formatÚ
candidatesÚnon_aliasesÚkeyÚformatÚnames          r   Ú'best_format_for_objects_in_a_repositoryr&   *   sÓ   € ð ”,€KØ€JÝ•jÔ0×5Ò5Ñ7Ô7Ñ8Ô8€KØ×!Ò!¥*Ô"<×"DÒ"DÑ"FÔ"FÑGÔGÐGØð 1ð 1ˆÝÔ+×;Ò;¸CÑ@Ô@ˆå�6Ð.Ñ/Ô/ð 	1ØÔ'¨;Ò6Ð6Ø×!Ò! 3¨ -Ñ0Ô0Ð0øÝ
ˆ:�„ð à! !”}‰ˆˆfØˆàˆtr   Tc                 óü  — ddl }ddlm}m}m}m} 	 |j                             | ¦  «        \  }}	|S # |j        $ r Y nw xY w|j	         
                    | ¦  «        r0|                     | ¦  «        }
|
r|                     d| ›�¦  «         nR	 |                     | ¦  «         n;# t          $ r.}|                     d                     | |¦  «        ¦  «        ‚d}~ww xY w|                     d¦  «         |€|j                             d¦  «        }|                     | ¦  «        }|                     ¦   «          |                     |¦  «        }|                     d	¬
¦  «        }|rddlm}  ||j        d¬¦  «         |S )aÉ  Open a destination directory and return the BzrDir.

    If destination has a control directory, it will be returned.
    Otherwise, the destination should be empty or non-existent and
    a shared repository will be created there.

    :param location: the destination directory
    :param format: the format to use or None for the default
    :param verbose: display the format used if a repository is created.
    :return: BzrDir for the destination
    r   Nr   )r   ÚerrorsÚtraceÚ	transportzTDestination must have a .bzr directory,  not yet exist or be empty - files found in zUnable to create {}: {}z#Creating destination repository ...ÚdefaultT)Úshared)Úshow_bzrdir_info)Úverbose)ÚosÚ r   r(   r)   r*   Ú
ControlDirÚopen_containingÚNotBranchErrorÚpathÚexistsÚlistdirÚCommandErrorÚmkdirÚOSErrorr$   Únoter   r   Úget_transportÚensure_baseÚinitialize_on_transportÚcreate_repositoryÚinfor-   )Úlocationr$   r.   r/   r   r(   r)   r*   ÚcontrolÚrelpathÚcontentsÚexÚto_transportr   r-   s                  r   Úopen_destination_directoryrF   H   sø  € ð €I€I€IØ8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8Ð8ðØ%Ô0×@Ò@ÀÑJÔJÑˆ�àˆøØÔ ð ð ð Øˆðøøøð 
„w‡~‚~�hÑÔð 
@Ø—:’:˜hÑ'Ô'ˆØð 	`Ø×ÒÐØT\ÐT\ð!_ñ `ô `ð `øð	@Ø�HŠH�XÑÔÐÐøÝð 	@ð 	@ð 	@Ø×%Ò%Ø)×0Ò0°¸2Ñ>Ô>ñ@ô @ð @øøøøð	@øøøð
 
‡J‚JÐ4Ñ5Ô5Ð5Ø€~ØÔ+×;Ò;¸IÑFÔFˆØ×*Ò*¨8Ñ4Ô4€LØ×ÒÑÔÐØ×,Ò,¨\Ñ:Ô:€GØ×$Ò$¨DÐ$Ñ1Ô1€DØð 5Ø,Ð,Ð,Ð,Ð,Ð,ØÐ˜œ°!Ð4Ñ4Ô4Ð4Ø€Ns$   ’1 ±
>½>ÂB" Â"
CÂ,)CÃCc                 óú   — | dk    r8|du rt           j        dz  S |du rt           j        dz  S t          d|z  ¦  «        ‚| dk    rt           j        S | dk    rt           j        S | d	k    rd
S t          d| z  ¦  «        ‚)NÚfileTéí  Fé¤  zExecutable %r invalidÚsymlinkÚ	directoryútree-referenceé à  zUnknown file kind '%s')ÚstatÚS_IFREGÚAssertionErrorÚS_IFLNKÚS_IFDIR)ÚkindÚ
executables     r   Úkind_to_moderV   x   sš   € Øˆv‚~€~Ø˜ÐÐÝ”< %Ñ'Ð'Ø˜5Ð Ð Ý”< %Ñ'Ð'å Ð!8¸:Ñ!EÑFÔFÐFØ	�Ò	Ð	ÝŒ|ÐØ	�Ò	Ð	ÝŒ|ÐØ	Ð!Ò	!Ð	!ØˆxåÐ5¸Ñ<Ñ=Ô=Ð=r   c                 ón   — | dv rdS | dv rdS | dk    rdS | dk    rdS | d	k    rd
S t          d| z  ¦  «        ‚)N)rJ   i¤�  )rH   F)rI   ií�  )rH   Ti @  )rL   Fi    )rK   FrN   )rM   Fzinvalid mode %o)rQ   )Úmodes    r   Úmode_to_kindrY   Š   sk   € àÐ Ð Ð Øˆ}Ø	Ð"Ð	"Ð	"Øˆ|Ø	�Ò	Ð	Ø!Ð!Ø	�Ò	Ð	ØÐØ	�Ò	Ð	Ø&Ð&åÐ.°Ñ5Ñ6Ô6Ð6r   c                 óÌ   — 	 ddl }|j        dk    rBt          | dd¦  «        }|r/ |¦   «         }|dk    rddl}|                     ||j        ¦  «         n# t          $ r Y nw xY w| S )zCEnsure a stream is binary on Windows.

    :return: the stream
    r   NÚntÚfileno)r/   r%   ÚgetattrÚmsvcrtÚsetmodeÚO_BINARYÚImportError)Ústreamr/   r\   Únor^   s        r   Úbinary_streamrd   š   s�   € ð

Øˆ	ˆ	ˆ	ØŒ7�dŠ?ˆ?Ý˜V X¨tÑ4Ô4ˆFØð 4Ø�V‘X”X�Ø˜’7�7Ø!�M�M�MØ—N’N 2 r¤{Ñ3Ô3Ð3øøÝð ð ð Øˆðøøøà€Ms   ‚AA Á
A!Á A!c                 ó   — | dk    r|S |S )z9Return a single or plural form of a noun based on number.é   © )ÚnÚsingleÚplurals      r   Úsingle_pluralrk   ­   s   € àˆA‚v€vØˆàˆr   )NT)Ú__doc__rO   r0   r   r   r&   rF   rV   rY   rd   rk   rg   r   r   ú<module>rm      s­   ðð  "Ð !à €€€ðð ð ð ð ð ð
ð ð ð"ð ð ð<-ð -ð -ð -ð`>ð >ð >ð$7ð 7ð 7ð ð ð ð&ð ð ð ð r   