a
    ˆÀàg°  ã                   @   sÄ   d dl mZ d dlZd dlZd dlmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZmZ erœd d	lmZmZ d d
lmZ d dlmZmZ e e¡ZG dd„ deƒZe e¡ dS )é    )Úabsolute_importN)Úparse)Údisplay_pathÚrmtree)Úmake_command)ÚMYPY_CHECK_RUNNING)Úpath_to_url)ÚVersionControlÚvcs)ÚOptionalÚTuple)Ú
HiddenText)ÚAuthInfoÚ
RevOptionsc                       sŒ   e Zd ZdZdZdZdZ‡ fdd„Zedd„ ƒZ	d	d
„ Z
dd„ Zdd„ Zdd„ Ze‡ fdd„ƒZedd„ ƒZedd„ ƒZedd„ ƒZ‡  ZS )ÚBazaarÚbzrz.bzrÚbranch)r   zbzr+httpz	bzr+httpszbzr+sshzbzr+sftpzbzr+ftpzbzr+lpc                    s4   t t| ƒj|i |¤Ž ttdd ƒr0tj dg¡ d S )NÚuses_fragmentZlp)Úsuperr   Ú__init__ÚgetattrÚurllib_parser   Úextend)ÚselfÚargsÚkwargs©Ú	__class__© úQ/var/www/sistema_ama/venv/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.pyr   $   s    zBazaar.__init__c                 C   s   d| gS )Nz-rr   )Úrevr   r   r   Úget_base_rev_args+   s    zBazaar.get_base_rev_argsc                 C   sB   t j |¡rt|ƒ |  |¡\}}| jtd||| ¡ ƒdd� dS )zU
        Export the Bazaar repository at the url to the destination location
        ÚexportF)Úshow_stdoutN)ÚosÚpathÚexistsr   Zget_url_rev_optionsÚrun_commandr   Úto_args)r   ÚlocationÚurlÚrev_optionsr   r   r   r"   /   s    þzBazaar.exportc                 C   s>   |  ¡ }t d||t|ƒ¡ tdd| ¡ ||ƒ}|  |¡ d S )NzChecking out %s%s to %sr   ú-q)Z
to_displayÚloggerÚinfor   r   r(   r'   )r   Údestr*   r+   Zrev_displayÚcmd_argsr   r   r   Ú	fetch_new>   s    üÿzBazaar.fetch_newc                 C   s   | j td|ƒ|d� d S )NÚswitch©Úcwd)r'   r   )r   r/   r*   r+   r   r   r   r2   L   s    zBazaar.switchc                 C   s"   t dd| ¡ ƒ}| j||d� d S )NZpullr,   r3   )r   r(   r'   )r   r/   r*   r+   r0   r   r   r   ÚupdateP   s    zBazaar.updatec                    s2   t t| ƒ |¡\}}}| d¡r(d| }|||fS )Nzssh://zbzr+)r   r   Úget_url_rev_and_authÚ
startswith)Úclsr*   r    Ú	user_passr   r   r   r6   U   s    
zBazaar.get_url_rev_and_authc                 C   sv   | j dgdd|d�}| ¡ D ]T}| ¡ }dD ]B}| |¡r,| |¡d }|  |¡rbt|ƒ    S |    S q,qd S )Nr.   FT©r#   Zstdout_onlyr4   )zcheckout of branch: zparent branch: é   )r'   Ú
splitlinesÚstripr7   ÚsplitZ_is_local_repositoryr   )r8   r)   ÚurlsÚlineÚxZrepor   r   r   Úget_remote_url^   s    
ÿ

zBazaar.get_remote_urlc                 C   s    | j dgdd|d�}| ¡ d S )NZrevnoFTr:   éÿÿÿÿ)r'   r<   )r8   r)   Úrevisionr   r   r   Úget_revisionn   s    
ÿzBazaar.get_revisionc                 C   s   dS )z&Always assume the versions don't matchFr   )r8   r/   Únamer   r   r   Úis_commit_id_equalu   s    zBazaar.is_commit_id_equal)Ú__name__Ú
__module__Ú__qualname__rF   ÚdirnameZ	repo_nameÚschemesr   Ústaticmethodr!   r"   r1   r2   r5   Úclassmethodr6   rB   rE   rG   Ú__classcell__r   r   r   r   r      s&   


r   )Ú
__future__r   Úloggingr$   Úpip._vendor.six.moves.urllibr   r   Úpip._internal.utils.miscr   r   Zpip._internal.utils.subprocessr   Úpip._internal.utils.typingr   Úpip._internal.utils.urlsr   Ú pip._internal.vcs.versioncontrolr	   r
   Útypingr   r   r   r   r   Ú	getLoggerrH   r-   r   Úregisterr   r   r   r   Ú<module>   s   
`