U
    fmfu                     @   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rd 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                    s0   t t| j|| ttdd r,tjdg d S )Nuses_fragmentZlp)superr   __init__getattrurllib_parser   extend)selfargskwargs	__class__ z/home/dh_an3skk/arjun-chandrasekhar-teaching.com/tomato/tomatoenvy/lib/python3.8/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   K   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   updateO   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   T   s    
zBazaar.get_url_rev_and_authc                 C   st   | j dgd|d}| D ]T}| }dD ]B}||r*||d }| |r`t|    S |    S q*qd S )Nr.   Fr#   r4   )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 S )NZrevnoFr:   )r'   r<   )r8   r)   revisionr   r   r   get_revisionk   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_equalr   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   
^