AlkantarClanX12

Your IP : 3.145.81.252


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/pip/vcs/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/pip/vcs/__pycache__/mercurial.cpython-36.pyc

3

�Pf�
�@s�ddlmZddlZddlZddlZddlmZmZddlm	Z	m
Z
ddlmZddl
mZeje�ZGdd�de
�Ze	je�dS)	�)�absolute_importN)�display_path�rmtree)�vcs�VersionControl)�path_to_url)�configparserc@sdeZdZdZdZdZdZdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�	Mercurial�hgz.hg�clone�hg+http�hg+https�hg+ssh�hg+static-httpcCs>tjdd�}|j|�z|jd|gd|d�Wdt|�XdS)z?Export the Hg repository at the url to the destination locationz-exportzpip-�archiveF)�show_stdout�cwdN)�tempfileZmkdtemp�unpack�run_commandr)�self�locationZtemp_dir�r�/usr/lib/python3.6/mercurial.py�exports
zMercurial.exportcCs�tjj||jd�}tj�}y<|j|�|jdd|�t|d��}|j	|�WdQRXWn6t
tjfk
r�}ztj
d||�WYdd}~XnX|jddg||d�dS)	NZhgrc�paths�default�wz/Could not switch Mercurial repository to %s: %s�updatez-q)r)�os�path�join�dirnamerZSafeConfigParser�read�set�open�write�OSErrorZNoSectionError�loggerZwarningr)r�dest�url�rev_optionsZrepo_config�configZconfig_file�excrrr�switch s
zMercurial.switchcCs,|jddg|d�|jddg||d�dS)NZpullz-q)rr)r)rr)r+rrrr/szMercurial.updatecCsz|j�\}}|r |g}d|}ng}d}|j||||�rvtjd||t|��|jddd||g�|jddg||d�dS)	Nz (to revision %s)�zCloning hg %s%s to %srz
--noupdatez-qr)r)Zget_url_revZcheck_destinationr(�inforr)rr)r*Zrevr+Zrev_displayrrr�obtain3s

zMercurial.obtaincCs2|jddgd|d�j�}|j|�r*t|�}|j�S)NZ
showconfigz
paths.defaultF)rr)r�stripZ_is_local_repositoryr)rrr*rrr�get_urlEs
zMercurial.get_urlcCs|jddgd|d�j�}|S)N�parentsz--template={rev}F)rr)rr2)rrZcurrent_revisionrrr�get_revisionMszMercurial.get_revisioncCs|jddgd|d�j�}|S)Nr4z--template={node}F)rr)rr2)rr�current_rev_hashrrr�get_revision_hashSszMercurial.get_revision_hashcCsT|j|�}|j�jd�s d|}|j�jdd�d}|s<dS|j|�}d|||fS)Nzhg:zhg+�-�rz%s@%s#egg=%s)r3�lower�
startswithZegg_name�splitr7)rZdistrZrepoZegg_project_namer6rrr�get_src_requirementYs

zMercurial.get_src_requirementcCsdS)z&Always assume the versions don't matchFr)rr)r+rrr�
check_versioncszMercurial.check_versionN)r
rr
rr)�__name__�
__module__�__qualname__�namer"Z	repo_nameZschemesrr.rr1r3r5r7r=r>rrrrr	s

r	)Z
__future__rZloggingrrZ	pip.utilsrrZpip.vcsrrZpip.downloadrZpip._vendor.six.movesrZ	getLoggerr?r(r	�registerrrrr�<module>s
W