3
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 ejeZG d
d deZeje 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 ZdZdZdZdZed d
Zdd Z d
d Z
dd Zdd Ze
dd Ze
dd Ze
dd Ze
dd Ze
dd Ze
fddZ ZS ) Mercurialhgz.hgclonehg+filehg+httphg+httpshg+sshhg+static-httpc C s | gS )N )revr r /builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/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 |j }tjd||t| | jtddd|| | jtdd|j |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 jj|| jd}tj }y>|j| |jdd|j t |d}|j
| W d Q R X W n6 ttjfk
r } zt
jd|| W Y d d }~X n X tdd|j }| j||d d S ) Nhgrcpathsdefaultwz/Could not switch Mercurial repository to %s: %sr' z-q)r )osr" joindirnamer RawConfigParserreadsetsecretopenwriteOSErrorNoSectionErrorr) warningr r+ r# ) r$ r, r r- repo_configconfigconfig_fileexccmd_argsr r r switchD s
zMercurial.switchc C s4 | j ddg|d tdd|j }| j ||d d S )Npullz-q)r r' )r# r r+ )r$ r, r r- rD r r r r' U s zMercurial.updatec C s0 | j ddg|dj }| j|r(t|}|j S )N
showconfigz
paths.default)r )r# strip_is_local_repositoryr
)clsr% r r r r get_remote_url[ s
zMercurial.get_remote_urlc C s | j ddg|dj }|S )zW
Return the repository-local changeset revision number, as an integer.
parentsz--template={rev})r )r# rH )rJ r% current_revisionr r r get_revisiond s zMercurial.get_revisionc C s | j ddg|dj }|S )zh
Return the changeset identification hash, as a 40-character
hexadecimal string
rL z--template={node})r )r# rH )rJ r% current_rev_hashr r r get_requirement_revisionm s z"Mercurial.get_requirement_revisionc C s dS )z&Always assume the versions don't matchFr )rJ r, namer r r is_commit_id_equalx s zMercurial.is_commit_id_equalc C s@ | j dg|dj }tjj|s6tjjtjj||}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# rH r4 r" isabsabspathr5 r )rJ r% repo_rootr r r get_subdirectory} s
zMercurial.get_subdirectoryc st t t| j|}|r|S y| jdg|dd}W n2 tk
rN tjd| d S tk
r` d S X tj j
|jdS )NrS 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 r4 r" normpathrstrip)rJ r% locr) __class__r r rZ s zMercurial.get_repository_root)r r r r r r )__name__
__module____qualname__rQ r6 repo_nameschemesstaticmethodr r r/ rE r' classmethodrK rN rP rR rW rZ
__classcell__r r )r` r r s
r )
__future__r loggingr4 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 getLoggerra r) r registerr r r r