관리-도구
편집 파일: mercurial.cpython-39.opt-1.pyc
a [��fQ � @ 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.9/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 --noupdate�-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�� }zR|�|� |�dd|j� t |d��}|� |� W d � n1 s`0 Y W n8 ttjfy� } zt �d||� W Y d }~n(d }~0 0 tdd|�� �}| j||d� d S ) NZhgrc�paths�default�wz/Could not switch Mercurial repository to %s: %sr r 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 )NZpullr r r )r r r )r r r r r0 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 )�clsr2 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}FTr3 �r r6 )r7 r2 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 r9 z--template={node}FTr3 r: )r7 r2 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 )r7 r r= 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. �rootFTr3 )r r6 r% r&