£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
U
    .e                     @   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 d d	lmZ d d
lmZmZmZ erd dl	mZ d dlmZ eeZG dd deZee dS )    )absolute_importN)configparser)
BadCommandInstallationError)display_path)make_command)TempDirectory)MYPY_CHECK_RUNNING)path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs)
HiddenText)
RevOptionsc                       s   e Zd ZdZdZdZdZedd Zdd Z	d	d
 Z
dd Zdd Zedd Zedd Zedd Zedd Zedd Ze fddZ  ZS )	Mercurialhgz.hgclone)r   zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpc                 C   s   | gS )N )Zrevr   r   ?/usr/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args'   s    zMercurial.get_base_rev_argsc              	   C   s@   t dd,}| j|j|d | jd|gd|jd W 5 Q R X dS )z?Export the Hg repository at the url to the destination locationexport)Zkind)urlarchiveFshow_stdoutcwdN)r   unpackpathrun_command)selflocationr   Ztemp_dirr   r   r   r   +   s      zMercurial.exportc                 C   sP   |  }td||t| | tddd|| | jtdd| |d d S )NzCloning hg %s%s to %sr   z
--noupdate-qupdater   )Z
to_displayloggerinfor   r   r   to_args)r   destr   rev_optionsZrev_displayr   r   r   	fetch_new5   s    zMercurial.fetch_newc           	   
   C   s   t j|| jd}t }z>|| |dd|j t	|d}|
| W 5 Q R X W n6 ttjfk
r } ztd|| W 5 d }~X Y n X tdd| }| j||d d S )	NZhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr"   r!   r#   )osr   joindirnamer   ZRawConfigParserreadsetZsecretopenwriteOSErrorZNoSectionErrorr$   Zwarningr   r&   r   )	r   r'   r   r(   Zrepo_configZconfigZconfig_fileexccmd_argsr   r   r   switchD   s    
  zMercurial.switchc                 C   s4   | j ddg|d tdd| }| j ||d d S )NZpullr!   r#   r"   )r   r   r&   )r   r'   r   r(   r6   r   r   r   r"   U   s    zMercurial.updatec                 C   s2   | j ddgd|d }| |r*t|}| S )NZ
showconfigzpaths.defaultFr   )r   stripZ_is_local_repositoryr
   )clsr    r   r   r   r   get_remote_url[   s     

zMercurial.get_remote_urlc                 C   s   | j ddgd|d }|S )zW
        Return the repository-local changeset revision number, as an integer.
        parentsz--template={rev}Fr   r   r8   )r9   r    Zcurrent_revisionr   r   r   get_revisiond   s     
zMercurial.get_revisionc                 C   s   | j ddgd|d }|S )zh
        Return the changeset identification hash, as a 40-character
        hexadecimal string
        r;   z--template={node}Fr   r<   )r9   r    Zcurrent_rev_hashr   r   r   get_requirement_revisionn   s     
z"Mercurial.get_requirement_revisionc                 C   s   dS )z&Always assume the versions don't matchFr   )r9   r'   namer   r   r   is_commit_id_equaly   s    zMercurial.is_commit_id_equalc                 C   sB   | j dgd|d }tj|s8tjtj||}t||S )z~
        Return the path to setup.py, relative to the repo root.
        Return None if setup.py is in the repo root.
        rootFr   )r   r8   r-   r   isabsabspathr.   r   )r9   r    Z	repo_rootr   r   r   get_subdirectory~   s      
zMercurial.get_subdirectoryc              	      sP   t t| |rdS z| jdg|dddd W dS  ttfk
rJ   Y dS X d S )NTZidentifyFraise)r   r   Zon_returncodeZlog_failed_cmd)superr   controls_locationr   r   r   )r9   r    	__class__r   r   rG      s    zMercurial.controls_location)__name__
__module____qualname__r?   r/   Z	repo_nameZschemesstaticmethodr   r   r)   r7   r"   classmethodr:   r=   r>   r@   rD   rG   __classcell__r   r   rH   r   r      s,   



	



r   )Z
__future__r   Zloggingr-   Zpip._vendor.six.movesr   Zpip._internal.exceptionsr   r   Zpip._internal.utils.miscr   Zpip._internal.utils.subprocessr   Zpip._internal.utils.temp_dirr   Zpip._internal.utils.typingr	   Zpip._internal.utils.urlsr
   Z pip._internal.vcs.versioncontrolr   r   r   r   r   Z	getLoggerrJ   r$   r   registerr   r   r   r   <module>   s    
|