| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.7/site-packages/pip/_internal/vcs/__pycache__/ |
Upload File : |
B
�N�aQ � @ s� d dl Z d dlZd dlZd dlmZmZ d dlmZmZ d dl m
Z
mZ d dlm
Z
d dlmZ d dlmZmZmZmZ e�e�ZG dd � d e�Ze�e� dS )
� N)�List�Optional)�
BadCommand�InstallationError)�
HiddenText�display_path)�make_command)�path_to_url)�
RevOptions�VersionControl�(find_path_to_project_root_from_repo_root�vcsc s� e Zd ZdZdZdZdZeee e d�dd��Z
eeedd �d
d�Z
eeedd �dd
�Zeeedd �dd�Zeeed�dd��Zeeed�dd��Zeeed�dd��Zeeee ed�dd��Zeeee d�dd��Zeeee d�� fdd��Z� ZS )� MercurialZhgz.hg�clone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http)�rev�returnc C s | gS )N� )r r r �?/usr/lib/python3.7/site-packages/pip/_internal/vcs/mercurial.py�get_base_rev_args s zMercurial.get_base_rev_argsN)�dest�url�rev_optionsr c C sP |� � }t�d||t|�� | �tddd||�� | jtdd|�� �|d� d S )NzCloning hg %s%s to %sr z
--noupdatez-q�update)�cwd)Z
to_display�logger�infor �run_commandr �to_args)�selfr r r Zrev_displayr r r � fetch_new$ s
zMercurial.fetch_newc
C s� t j�|| jd�}t�� }y>|�|� |�dd|j� t |d��}|�
|� W d Q R X W n6 ttjfk
r� } zt
�d||� W d d }~X Y n X tdd|�� �}| j||d� d S ) NZhgrc�paths�default�wz/Could not switch Mercurial repository to %s: %sr z-q)r )�os�path�join�dirname�configparserZRawConfigParser�read�setZsecret�open�write�OSErrorZNoSectionErrorr Zwarningr r r ) r r r r Zrepo_configZconfigZconfig_file�exc�cmd_argsr r r �switch2 s
zMercurial.switchc C s4 | j ddg|d� tdd|�� �}| j ||d� d S )NZpullz-q)r r )r r r )r r r r r. r r r r @ s zMercurial.update)�locationr c C s4 | j ddgdd|d��� }| �|�r,t|�}|�� S )NZ
showconfigz
paths.defaultFT)�show_stdout�stdout_onlyr )r �stripZ_is_local_repositoryr )�clsr0 r r r r �get_remote_urlE s
zMercurial.get_remote_urlc C s | j ddgdd|d��� }|S )zW
Return the repository-local changeset revision number, as an integer.
�parentsz--template={rev}FT)r1 r2 r )r r3 )r4 r0 Zcurrent_revisionr r r �get_revisionQ s zMercurial.get_revisionc C s | j ddgdd|d��� }|S )zh
Return the changeset identification hash, as a 40-character
hexadecimal string
r6 z--template={node}FT)r1 r2 r )r r3 )r4 r0 Zcurrent_rev_hashr r r �get_requirement_revision^ s z"Mercurial.get_requirement_revision)r �namer c C s dS )z&Always assume the versions don't matchFr )r4 r r9 r r r �is_commit_id_equall s zMercurial.is_commit_id_equalc C sD | j dgdd|d��� }tj�|�s:tj�tj�||��}t||�S )z�
Return the path to Python project root, relative to the repo root.
Return None if the project root is in the repo root.
�rootFT)r1 r2 r )r r3 r# r$ �isabs�abspathr% r )r4 r0 Z repo_rootr r r �get_subdirectoryq s
zMercurial.get_subdirectoryc sv t � �|�}|r|S y| jdg|ddddd�}W n2 tk
rP t�d|� d S tk
rb d S X tj� |�
d��S )Nr; FT�raise)r r1 r2 Z
on_returncodeZlog_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)�super�get_repository_rootr r r �debugr r# r$ �normpath�rstrip)r4 r0 �loc�r)� __class__r r rA s&