<!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>
3
Pf                 @   s   d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm	Z	m
Z
 d dlmZ d dlmZ ejeZG dd de
Ze	je dS )	    )absolute_importN)display_pathrmtree)vcsVersionControl)path_to_url)configparserc               @   sd   e Zd ZdZdZdZdZdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd ZdS )	Mercurialhgz.hgclonehg+httphg+httpshg+sshhg+static-httpc             C   s>   t jdd}| j| z| jd|gd|d W dt| X dS )z?Export the Hg repository at the url to the destination locationz-exportzpip-archiveF)show_stdoutcwdN)tempfileZmkdtempunpackrun_commandr   )selflocationZtemp_dir r   /usr/lib/python3.6/mercurial.pyexport   s    
zMercurial.exportc             C   s   t jj|| jd}tj }y<|j| |jdd| t|d}|j	| W d Q R X W n6 t
tjfk
r } ztjd|| W Y d d }~X nX | jddg| |d d S )	NZhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %supdatez-q)r   )ospathjoindirnamer   ZSafeConfigParserreadsetopenwriteOSErrorZNoSectionErrorloggerZwarningr   )r   desturlrev_optionsZrepo_configconfigZconfig_fileexcr   r   r   switch    s    
zMercurial.switchc             C   s,   | j ddg|d | j ddg| |d d S )NZpullz-q)r   r   )r   )r   r)   r+   r   r   r   r   /   s    zMercurial.updatec             C   sz   | j  \}}|r |g}d| }ng }d}| j||||rvtjd||t| | jddd||g | jddg| |d d S )	Nz (to revision %s) zCloning hg %s%s to %sr   z
--noupdatez-qr   )r   )Zget_url_revZcheck_destinationr(   infor   r   )r   r)   r*   Zrevr+   Zrev_displayr   r   r   obtain3   s    

zMercurial.obtainc             C   s2   | j ddgd|dj }| j|r*t|}|j S )NZ
showconfigzpaths.defaultF)r   r   )r   stripZ_is_local_repositoryr   )r   r   r*   r   r   r   get_urlE   s    
zMercurial.get_urlc             C   s   | j ddgd|dj }|S )Nparentsz--template={rev}F)r   r   )r   r2   )r   r   Zcurrent_revisionr   r   r   get_revisionM   s    zMercurial.get_revisionc             C   s   | j ddgd|dj }|S )Nr4   z--template={node}F)r   r   )r   r2   )r   r   current_rev_hashr   r   r   get_revision_hashS   s    zMercurial.get_revision_hashc             C   sT   | j |}|j jds d| }|j jddd }|s<d S | j|}d|||f S )Nzhg:zhg+-   r   z%s@%s#egg=%s)r3   lower
startswithZegg_namesplitr7   )r   Zdistr   ZrepoZegg_project_namer6   r   r   r   get_src_requirementY   s    

zMercurial.get_src_requirementc             C   s   dS )z&Always assume the versions don't matchFr   )r   r)   r+   r   r   r   check_versionc   s    zMercurial.check_versionN)r
   r   r   r   r   )__name__
__module____qualname__namer"   Z	repo_nameZschemesr   r.   r   r1   r3   r5   r7   r=   r>   r   r   r   r   r	      s   

r	   )Z
__future__r   Zloggingr   r   Z	pip.utilsr   r   Zpip.vcsr   r   Zpip.downloadr   Zpip._vendor.six.movesr   Z	getLoggerr?   r(   r	   registerr   r   r   r   <module>   s   
W