B Re* @ s d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl m Z d dlmZ d dl mZ d dlmZ d d lmZ d d lmZmZmZ erd dl mZ d dlmZ eeZG d d deZee dS ) )absolute_importN)configparser) BadCommandSubProcessError)display_path)make_command) TempDirectory)MYPY_CHECK_RUNNING)path_to_url)VersionControl!find_path_to_setup_from_repo_rootvcs) HiddenText) RevOptionsc s e Zd ZdZdZdZdZedd Zdd Z d d Z dd Zd d Ze dd Ze dd Ze dd Ze dd Ze dd Ze fddZ ZS ) Mercurialhgz.hgclone)r zhg+filezhg+httpzhg+httpszhg+sshzhg+static-httpc C s | gS )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.pyget_base_rev_args' s zMercurial.get_base_rev_argsc C s> t dd*}| j|j|d | jd|g|jd W dQ R X dS )z?Export the Hg repository at the url to the destination locationexport)kind)urlarchive)cwdN)r unpackpathrun_command)selflocationr temp_dirr r r r + s zMercurial.exportc C sP | }td||t| | tddd|| | jtdd| |d d S )NzCloning hg %s%s to %sr z --noupdatez-qupdate)r ) to_displayloggerinfor r r to_args)r destr rev_optionsrev_displayr r r fetch_new5 s zMercurial.fetch_newc C s t j|| jd}t }y>|| |dd|j t |d}| | W d Q R X W n6 ttjfk r } zt d|| W d d }~X Y n X tdd| }| j||d d S ) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr" z-q)r )osr joindirnamer RawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr$ warningr r&