<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    Re*                 @   s   d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZmZmZ erd dl	mZ d dlmZ eeZG dd deZee dS )    )absolute_importN)configparser)
BadCommandSubProcessError)display_path)make_command)TempDirectory)MYPY_CHECK_RUNNING)path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs)
HiddenText)
RevOptionsc                   s   e Zd ZdZdZdZdZedd Zdd Z	d	d
 Z
dd Zdd Zedd Zedd Zedd Zedd Zedd Ze fddZ  ZS )	Mercurialhgz.hgclone)r   zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpc             C   s   | gS )N )revr   r   /builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_internal/vcs/mercurial.pyget_base_rev_args'   s    zMercurial.get_base_rev_argsc          	   C   s>   t dd*}| j|j|d | jd|g|jd W dQ R X dS )z?Export the Hg repository at the url to the destination locationexport)kind)urlarchive)cwdN)r   unpackpathrun_command)selflocationr   temp_dirr   r   r   r   +   s    zMercurial.exportc             C   sP   |  }td||t| | tddd|| | jtdd| |d d S )NzCloning hg %s%s to %sr   z
--noupdatez-qupdate)r   )
to_displayloggerinfor   r   r   to_args)r   destr   rev_optionsrev_displayr   r   r   	fetch_new5   s    
zMercurial.fetch_newc       	   
   C   s   t j|| jd}t }y>|| |dd|j t	|d}|
| W d Q R X W n6 ttjfk
r } ztd|| W d d }~X Y n X tdd| }| j||d d S )	Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr"   z-q)r   )osr   joindirnamer   RawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr$   warningr   r&   r   )	r   r'   r   r(   repo_configconfigconfig_fileexccmd_argsr   r   r   switchD   s    
zMercurial.switchc             C   s4   | j ddg|d tdd| }| j ||d d S )Npullz-q)r   r"   )r   r   r&   )r   r'   r   r(   r?   r   r   r   r"   U   s    zMercurial.updatec             C   s0   | j ddg|d }| |r(t|}| S )N
showconfigzpaths.default)r   )r   strip_is_local_repositoryr
   )clsr    r   r   r   r   get_remote_url[   s    
zMercurial.get_remote_urlc             C   s   | j ddg|d }|S )zW
        Return the repository-local changeset revision number, as an integer.
        parentsz--template={rev})r   )r   rC   )rE   r    current_revisionr   r   r   get_revisiond   s    zMercurial.get_revisionc             C   s   | j ddg|d }|S )zh
        Return the changeset identification hash, as a 40-character
        hexadecimal string
        rG   z--template={node})r   )r   rC   )rE   r    current_rev_hashr   r   r   get_requirement_revisionm   s    z"Mercurial.get_requirement_revisionc             C   s   dS )z&Always assume the versions don't matchFr   )rE   r'   namer   r   r   is_commit_id_equalx   s    zMercurial.is_commit_id_equalc             C   s@   | j dg|d }tj|s6tjtj||}t||S )z~
        Return the path to setup.py, relative to the repo root.
        Return None if setup.py is in the repo root.
        root)r   )r   rC   r/   r   isabsabspathr0   r   )rE   r    	repo_rootr   r   r   get_subdirectory}   s
    zMercurial.get_subdirectoryc                st   t t| |}|r|S y| jdg|dd}W n2 tk
rN   td| d S  tk
r`   d S X tj	
|dS )NrN   F)r   log_failed_cmdzIcould not determine if %s is under hg control because hg is not availablez
)superr   get_repository_rootr   r   r$   debugr   r/   r   normpathrstrip)rE   r    locr)	__class__r   r   rU      s    zMercurial.get_repository_root)__name__
__module____qualname__rL   r1   	repo_nameschemesstaticmethodr   r   r*   r@   r"   classmethodrF   rI   rK   rM   rR   rU   __classcell__r   r   )r[   r   r      s   
		r   )
__future__r   loggingr/   pip._vendor.six.movesr   pip._internal.exceptionsr   r   pip._internal.utils.miscr   pip._internal.utils.subprocessr   pip._internal.utils.temp_dirr   pip._internal.utils.typingr	   pip._internal.utils.urlsr
    pip._internal.vcs.versioncontrolr   r   r   r   r   	getLoggerr\   r$   r   registerr   r   r   r   <module>   s    
