HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-38.pyc
U

�{�e��@s�ddlZddlZddlZddlmZmZmZddlmZm	Z	ddl
mZmZddl
mZddlmZddlmZmZmZmZe�e�ZGdd	�d	e�Ze�e�dS)
�N)�List�Optional�Tuple)�
BadCommand�InstallationError)�
HiddenText�display_path)�make_command)�path_to_url)�
RevOptions�VersionControl�(find_path_to_project_root_from_repo_root�vcscseZdZdZdZdZdZeee	ed�dd��Z
eeee
dd	�d
d�Zeeedd�d
d�Zeeedd�dd�Zeeed�dd��Zeeed�dd��Zeeed�dd��Zeeeeed�dd��Zeeeed�dd��Zeeeed��fdd��Z�ZS)�	Mercurial�hgz.hg�clone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http)�rev�returncCsd|��gS)Nz--rev=�)rrr�?/tmp/pip-unpacked-wheel-_0scjqea/pip/_internal/vcs/mercurial.py�get_base_rev_args szMercurial.get_base_rev_argsN)�dest�url�rev_options�	verbosityrcCs�|��}t�d||t|��|dkr*d}n |dkr8d}n|dkrFd}nd}|�td
|||f���|jtd||��f��|d�dS)NzCloning hg %s%s to %sr)z--quiet�r�)�	--verbose)rz--debugr�
--noupdate�update��cwd)rr)r)�
to_display�logger�infor�run_commandr	�to_args)�selfrrrr�rev_display�flagsrrr�	fetch_new$s&��zMercurial.fetch_new)rrrrc	
Cs�tj�||jd�}t��}z>|�|�|�dd|j�t	|d��}|�
|�W5QRXWn6ttjfk
r�}zt
�d||�W5d}~XYn Xtdd|���}|j||d�dS)	N�hgrc�paths�default�wz/Could not switch Mercurial repository to %s: %sr�-qr )�os�path�join�dirname�configparser�RawConfigParser�read�set�secret�open�write�OSError�NoSectionErrorr#�warningr	r&r%)	r'rrr�repo_config�config�config_file�exc�cmd_argsrrr�switch<s
 zMercurial.switchcCs4|jddg|d�tdd|���}|j||d�dS)N�pullr/r r)r%r	r&)r'rrrrBrrrrJszMercurial.update)�locationrcCs4|jddgdd|d���}|�|�r,t|�}|��S)N�
showconfigz
paths.defaultFT��show_stdout�stdout_onlyr!)r%�strip�_is_local_repositoryr
)�clsrErrrr�get_remote_urlOs�

zMercurial.get_remote_urlcCs|jddgdd|d���}|S)zW
        Return the repository-local changeset revision number, as an integer.
        �parentsz--template={rev}FTrG�r%rJ)rLrE�current_revisionrrr�get_revision[s�
zMercurial.get_revisioncCs|jddgdd|d���}|S)zh
        Return the changeset identification hash, as a 40-character
        hexadecimal string
        rNz--template={node}FTrGrO)rLrE�current_rev_hashrrr�get_requirement_revisionhs�
z"Mercurial.get_requirement_revision)r�namercCsdS)z&Always assume the versions don't matchFr)rLrrTrrr�is_commit_id_equalvszMercurial.is_commit_id_equalcCsD|jdgdd|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.
        �rootFTrG)r%rJr0r1�isabs�abspathr2r
)rLrE�	repo_rootrrr�get_subdirectory{s�
zMercurial.get_subdirectorycszt��|�}|r|Sz|jdg|ddddd�}Wn6tk
rRt�d|�YdStk
rfYdSXtj�	|�
d��S)NrVFT�raise)r!rHrI�
on_returncode�log_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)�super�get_repository_rootr%rr#�debugrr0r1�normpath�rstrip)rLrE�loc�r��	__class__rrr_�s*�
�zMercurial.get_repository_root)�__name__�
__module__�__qualname__rTr3�	repo_name�schemes�staticmethod�strrrrr�intr*rCr�classmethodrMrQrSr�boolrUrZr_�
__classcell__rrrerrs4�

r)r4�loggingr0�typingrrr�pip._internal.exceptionsrr�pip._internal.utils.miscrr�pip._internal.utils.subprocessr	�pip._internal.utils.urlsr
� pip._internal.vcs.versioncontrolrrr
r�	getLoggerrgr#r�registerrrrr�<module>s