HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-310.pyc
o

��h��@s�ddlmZddlZddlZddlZddlmZmZddlm	Z	m
Z
ddlmZddl
mZddlmZmZmZmZe�e�ZGdd	�d	e�Ze�e�dS)
�)�annotationsN)�
BadCommand�InstallationError)�
HiddenText�display_path)�make_command)�path_to_url)�
RevOptions�VersionControl�(find_path_to_project_root_from_repo_root�vcscs�eZdZdZdZdZdZed*d	d
��Zd+dd�Z		d,d+dd�Z
	d,d+dd�Zed-dd��Z
ed-dd��Zed-dd ��Zed.d$d%��Zed/d&d'��Zed/�fd(d)��Z�ZS)0�	Mercurial�hgz.hg�clone)zhg+filezhg+httpzhg+httpszhg+sshzhg+static-http�rev�str�return�	list[str]cCsd|��gS)Nz--rev=�)rrr�F/usr/local/lib/python3.10/dist-packages/pip/_internal/vcs/mercurial.py�get_base_rev_args!szMercurial.get_base_rev_args�dest�urlr�rev_optionsr	�	verbosity�int�NonecCs�|��}t�d||t|��|dkrd}n|dkrd}n	|dkr#d}nd}|�td	d
g|�|�|�R��|jtdg|�|���R�|d�dS)
NzCloning hg %s%s to %sr)z--quiet�r�)�	--verbose)rz--debugrz
--noupdate�update��cwd)�
to_display�logger�infor�run_commandr�to_args)�selfrrrr�rev_display�flagsrrr�	fetch_new%s&� 
�zMercurial.fetch_newrc
Cs�g}tj�||jd�}t��}|dkr|�d�z)|�|�|�dd|j	�t
|d��
}|�|�Wd�n1s;wYWnttj
fy^}	zt�d||	�WYd}	~	dSd}	~	wwtdg|�|���R�}
|j|
|d	�dS)
N�hgrcr�-q�paths�default�wz/Could not switch Mercurial repository to %s: %sr r!)�os�path�join�dirname�configparser�RawConfigParser�append�read�set�secret�open�write�OSError�NoSectionErrorr$�warningrr'r&)r(rrrr�extra_flags�repo_config�config�config_file�exc�cmd_argsrrr�switch=s$

����zMercurial.switchcCsTg}|dkr|�d�|jdg|�|d�tdg|�|���R�}|j||d�dS)Nrr-�pullr!r )r7r&rr')r(rrrrr@rErrrr Vs
zMercurial.update�locationcCs4|jddgdd|d���}|�|�rt|�}|��S)N�
showconfigz
paths.defaultFT��show_stdout�stdout_onlyr")r&�strip�_is_local_repositoryr)�clsrHrrrr�get_remote_urlfs��
zMercurial.get_remote_urlcC�|jddgdd|d���}|S)zW
        Return the repository-local changeset revision number, as an integer.
        �parentsz--template={rev}FTrJ�r&rM)rOrH�current_revisionrrr�get_revisionrs��zMercurial.get_revisioncCrQ)zh
        Return the changeset identification hash, as a 40-character
        hexadecimal string
        rRz--template={node}FTrJrS)rOrH�current_rev_hashrrr�get_requirement_revisions��z"Mercurial.get_requirement_revision�name�
str | None�boolcCsdS)z&Always assume the versions don't matchFr)rOrrXrrr�is_commit_id_equal�szMercurial.is_commit_id_equalcCsD|jdgdd|d���}tj�|�stj�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.
        �rootFTrJ)r&rMr1r2�isabs�abspathr3r)rOrH�	repo_rootrrr�get_subdirectory�s
��
zMercurial.get_subdirectorycsvt��|�}|r
|Sz|jdg|ddddd�}Wnty(t�d|�YdSty1YdSwtj�	|�
d��S)Nr\FT�raise)r"rKrL�
on_returncode�log_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)�super�get_repository_rootr&rr$�debugrr1r2�normpath�rstrip)rOrH�loc�r��	__class__rrre�s,
���zMercurial.get_repository_root)rrrr)
rrrrrr	rrrr)r)rHrrr)rrrXrYrrZ)rHrrrY)�__name__�
__module__�__qualname__rXr4�	repo_name�schemes�staticmethodrr+rFr �classmethodrPrUrWr[r`re�
__classcell__rrrkrr
s0
��

r
)�
__future__rr5�loggingr1�pip._internal.exceptionsrr�pip._internal.utils.miscrr�pip._internal.utils.subprocessr�pip._internal.utils.urlsr� pip._internal.vcs.versioncontrolr	r
rr�	getLoggerrmr$r
�registerrrrr�<module>s
&